Skip to content

Commit 88ee94d

Browse files
committed
add Preferences modal(30%done) & move some modules (actions, reducer, socket, store -> lib/~)
1 parent 1df4ed0 commit 88ee94d

16 files changed

Lines changed: 618 additions & 30 deletions

File tree

browser/main/HomePage.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import React, { PropTypes} from 'react'
22
import { connect } from 'react-redux'
3-
import { CREATE_MODE, IDLE_MODE, switchUser } from './actions'
3+
import { CREATE_MODE, IDLE_MODE, switchUser, NEW, refreshArticles } from 'boost/actions'
44
import UserNavigator from './HomePage/UserNavigator'
55
import ArticleNavigator from './HomePage/ArticleNavigator'
66
import ArticleTopBar from './HomePage/ArticleTopBar'
77
import ArticleList from './HomePage/ArticleList'
88
import ArticleDetail from './HomePage/ArticleDetail'
99
import { findWhere, findIndex, pick } from 'lodash'
1010
import keygen from 'boost/keygen'
11-
import { NEW, refreshArticles } from './actions'
1211
import api from 'boost/api'
1312
import auth from 'boost/auth'
14-
import './socket'
13+
import 'boost/socket'
1514

1615
class HomePage extends React.Component {
1716
componentDidMount () {

browser/main/HomePage/ArticleDetail.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { findWhere, uniq } from 'lodash'
44
import ModeIcon from 'boost/components/ModeIcon'
55
import MarkdownPreview from 'boost/components/MarkdownPreview'
66
import CodeEditor from 'boost/components/CodeEditor'
7-
import { UNSYNCED, IDLE_MODE, CREATE_MODE, EDIT_MODE, switchMode, switchArticle, updateArticle, destroyArticle } from '../actions'
7+
import { UNSYNCED, IDLE_MODE, CREATE_MODE, EDIT_MODE, switchMode, switchArticle, updateArticle, destroyArticle } from 'boost/actions'
88
import aceModes from 'boost/ace-modes'
99
import Select from 'react-select'
1010
import linkState from 'boost/linkState'
@@ -20,7 +20,7 @@ var modeOptions = aceModes.map(function (mode) {
2020

2121
function makeInstantArticle (article) {
2222
let instantArticle = Object.assign({}, article)
23-
instantArticle.Tags = (typeof instantArticle.Tags === 'array') ? instantArticle.Tags.map(tag => tag.name) : []
23+
instantArticle.Tags = Array.isArray(instantArticle.Tags) ? instantArticle.Tags.map(tag => tag.name) : []
2424
return instantArticle
2525
}
2626

@@ -107,7 +107,7 @@ export default class ArticleDetail extends React.Component {
107107
<i className='fa fa-fw fa-check'/> Sure
108108
</button>
109109
<button onClick={e => this.handleDeleteCancleButtonClick(e)}>
110-
<i className='fa fa-fw fa-times'/> Cancle
110+
<i className='fa fa-fw fa-times'/> Cancel
111111
</button>
112112
</div>
113113
</div>

browser/main/HomePage/ArticleList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { PropTypes } from 'react'
22
import ProfileImage from 'boost/components/ProfileImage'
33
import ModeIcon from 'boost/components/ModeIcon'
44
import moment from 'moment'
5-
import { switchArticle, NEW } from '../actions'
5+
import { switchArticle, NEW } from 'boost/actions'
66
import FolderMark from 'boost/components/FolderMark'
77

88
export default class ArticleList extends React.Component {

browser/main/HomePage/ArticleNavigator.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import React, { PropTypes } from 'react'
22
import ProfileImage from 'boost/components/ProfileImage'
33
import { findWhere } from 'lodash'
4-
import { switchMode, CREATE_MODE } from '../actions'
4+
import { switchMode, CREATE_MODE } from 'boost/actions'
55
import { openModal } from 'boost/modal'
6-
import CreateNewFolder from 'boost/components/modal/CreateNewFolder'
76
import FolderMark from 'boost/components/FolderMark'
7+
import Preferences from 'boost/components/modal/Preferences'
8+
import CreateNewFolder from 'boost/components/modal/CreateNewFolder'
89

910
export default class ArticleNavigator extends React.Component {
11+
componentDidMount () {
12+
this.handlePreferencesButtonClick()
13+
}
14+
15+
handlePreferencesButtonClick (e) {
16+
openModal(Preferences)
17+
}
18+
1019
handleNewPostButtonClick (e) {
1120
let { dispatch } = this.props
1221

@@ -27,7 +36,7 @@ export default class ArticleNavigator extends React.Component {
2736
let folders = activeUser.Folders.map((folder, index) => {
2837
return (
2938
<button key={'folder-' + folder.id} className={activeFolder != null && activeFolder.id === folder.id ? 'active' : ''}>
30-
<FolderMark id={folder.id}/> {folder.name}</button>
39+
<FolderMark id={folder.id}/> {folder.name} {folder.public ? <i className='fa fa-fw fa-lock'/> : null}</button>
3140
)
3241
})
3342

@@ -47,7 +56,7 @@ export default class ArticleNavigator extends React.Component {
4756
<div className='userInfo'>
4857
<div className='userProfileName'>{activeUser.profileName}</div>
4958
<div className='userName'>{activeUser.name}</div>
50-
<button className='settingBtn'><i className='fa fa-fw fa-chevron-down'/></button>
59+
<button onClick={e => this.handlePreferencesButtonClick(e)} className='settingBtn'><i className='fa fa-fw fa-chevron-down'/></button>
5160
</div>
5261

5362
<div className='controlSection'>
@@ -89,3 +98,4 @@ ArticleNavigator.propTypes = {
8998
}),
9099
dispatch: PropTypes.func
91100
}
101+

browser/main/index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@
5353
<div id="content"></div>
5454

5555
<script src="../../submodules/ace/src-min/ace.js"></script>
56-
<script>
56+
<script type="text/javascript">
5757
var version = require('remote').require('app').getVersion()
58-
global.version = version
5958
document.title = 'Boost' + ((version == null || version.length === 0) ? ' DEV' : '')
6059
// require("babel-core/register")
6160
// require('./index')
61+
document.addEventListener('mousewheel', function(e) {
62+
if(e.deltaY % 1 !== 0) {
63+
e.preventDefault()
64+
}
65+
})
6266
</script>
6367
<script src="http://localhost:8080/assets/main.js"></script>
6468
</body>

browser/main/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from 'react'
22
import { Provider } from 'react-redux'
3-
import { updateUser } from './actions'
3+
import { updateUser } from 'boost/actions'
44
import { fetchCurrentUser } from 'boost/api'
55
import { Router, Route, IndexRoute } from 'react-router'
66
import MainPage from './MainPage'
77
import LoginPage from './LoginPage'
88
import SignupPage from './SignupPage'
99
import HomePage from './HomePage'
1010
import auth from 'boost/auth'
11-
import store, { devToolElement } from './store'
11+
import store, { devToolElement } from 'boost/store'
1212
require('../styles/main/index.styl')
1313

1414
function onlyUser (state, replaceState) {

browser/styles/main/HomeContainer/index.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
@require './lib/modal'
88
@require './lib/CreateNewTeam'
99
@require './lib/CreateNewFolder'
10+
@require './lib/Preferences'
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
menuColor = #808080
2+
menuBgColor = #E6E6E6
3+
closeBtnBgColor = #1790C6
4+
iptFocusBorderColor = #369DCD
5+
6+
.Preferences.modal
7+
padding 0
8+
border-radius 5px
9+
overflow hidden
10+
width 720px
11+
height 450px
12+
&>.header
13+
absolute top left right
14+
height 50px
15+
border-bottom 1px solid borderColor
16+
background-color menuBgColor
17+
&>.title
18+
font-size 22px
19+
font-weight bold
20+
float left
21+
padding-left 30px
22+
line-height 50px
23+
&>.closeBtn
24+
float right
25+
font-size 14px
26+
background-color closeBtnBgColor
27+
color white
28+
padding 0 15px
29+
height 33px
30+
margin-top 9px
31+
margin-right 15px
32+
border none
33+
border-radius 5px
34+
&:hover
35+
background-color lighten(closeBtnBgColor, 10%)
36+
&>.nav
37+
absolute left bottom
38+
top 50px
39+
width 180px
40+
background-color menuBgColor
41+
border-right 1px solid borderColor
42+
&>button
43+
width 100%
44+
height 44px
45+
font-size 18px
46+
color menuColor
47+
border none
48+
background-color transparent
49+
transition 0.1s
50+
text-align left
51+
padding-left 15px
52+
&:hover
53+
background-color darken(menuBgColor, 10%)
54+
&.active, &:active
55+
background-color brandColor
56+
color white
57+
&>.content
58+
absolute right bottom
59+
top 50px
60+
left 180px
61+
&>.section
62+
padding 10px
63+
border-bottom 1px solid borderColor
64+
overflow-y auto
65+
&:nth-last-child(1)
66+
border-bottom none
67+
&>.sectionTitle
68+
font-size 18px
69+
margin 10px 0 5px
70+
color brandColor
71+
&>.sectionInput
72+
height 33px
73+
margin-bottom 5px
74+
clearfix()
75+
label
76+
width 180px
77+
padding-left 15px
78+
float left
79+
line-height 33px
80+
input
81+
width 300px
82+
float left
83+
height 33px
84+
border-radius 5px
85+
border 1px solid borderColor
86+
padding 0 10px
87+
font-size 14px
88+
outline none
89+
&:focus
90+
border-color iptFocusBorderColor
91+
&>.sectionConfirm
92+
clearfix()
93+
padding 5px 15px
94+
button
95+
float right
96+
background-color brandColor
97+
color white
98+
border none
99+
border-radius 5px
100+
height 33px
101+
padding 0 15px
102+
font-size 14px
103+
&:hover
104+
background-color lighten(brandColor, 10%)
105+
.alert
106+
float right
107+
height 33px
108+
padding 0 15px
109+
border-radius 5px
110+
margin-right 5px
111+
line-height 33px
112+
font-size 14px
113+
&.info
114+
background-color infoBackgroundColor
115+
color infoTextColor
116+
&.error
117+
background-color errorBackgroundColor
118+
color errorTextColor
119+
&.success
120+
background-color successBackgroundColor
121+
color successTextColor
122+
123+
.description
124+
marked()
125+
126+

browser/styles/vars.styl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
borderColor = #D0D0D0
1+
borderColor = #D0D0D0 // using
22
highlightenBorderColor = darken(borderColor, 20%)
33
invBorderColor = #404849
44
brandBorderColor = #3FB399
@@ -7,12 +7,12 @@ buttonBorderColor = #4C4C4C
77

88
lightButtonColor = #898989
99

10-
hoverBackgroundColor= transparentify(#444, 4%)
10+
hoverBackgroundColor= transparentify(#444, 4%) // using
1111

12-
inactiveTextColor = #888
13-
textColor = #4D4D4D
12+
inactiveTextColor = #888 // using
13+
textColor = #4D4D4D // using
1414
backgroundColor= white
15-
fontSize= 14px
15+
fontSize= 14px // using
1616

1717
shadowColor= #C5C5C5
1818

@@ -34,6 +34,7 @@ tableEvenBgColor = white
3434
facebookColor= #3b5998
3535
githubBtn= #201F1F
3636

37+
// using
3738
successBackgroundColor= #E0F0D9
3839
successTextColor= #3E753F
3940
errorBackgroundColor= #F2DEDE
File renamed without changes.

0 commit comments

Comments
 (0)