Skip to content

Commit c6307e4

Browse files
committed
version 0.2.10
- Hotkeyの設定機能 - Stylus refactor
1 parent e317075 commit c6307e4

12 files changed

Lines changed: 219 additions & 65 deletions

File tree

browser/main/Components/AboutModal.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
var remote = require('remote')
2-
var version = remote.getGlobal('version')
3-
41
var React = require('react/addons')
52

63
var ExternalLink = require('../Mixins/ExternalLink')
@@ -19,8 +16,9 @@ module.exports = React.createClass({
1916
}
2017
},
2118
render: function () {
19+
var version = global.version
2220
return (
23-
<div className='AboutModal modal'>
21+
<div className='PreferencesModal sideNavModal modal'>
2422
<div className='about1'>
2523
<img className='logo' src='resources/favicon-230x230.png'/>
2624
<div className='appInfo'>Boost {version == null || version.length === 0 ? 'DEV version' : 'v' + version}</div>

browser/main/Components/EditProfileModal.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ module.exports = React.createClass({
6969
this.setState({
7070
passwordSubmitStatus: 'sending'
7171
}, function () {
72-
console.log(this.state.password)
7372
Hq.changePassword(this.state.password)
7473
.then(function (res) {
7574
this.setState({
@@ -103,9 +102,9 @@ module.exports = React.createClass({
103102
}
104103

105104
return (
106-
<div className='EditProfileModal modal tabModal'>
105+
<div className='EditProfileModal sideNavModal modal'>
107106
<div className='leftPane'>
108-
<div className='tabLabel'>Edit profile</div>
107+
<div className='modalLabel'>Edit profile</div>
109108
<div className='tabList'>
110109
<button className={this.state.currentTab === 'userInfo' ? 'active' : ''} onClick={this.selectTab('userInfo')}><i className='fa fa-user fa-fw'/> User Info</button>
111110
<button className={this.state.currentTab === 'password' ? 'active' : ''} onClick={this.selectTab('password')}><i className='fa fa-lock fa-fw'/> Password</button>
@@ -119,7 +118,7 @@ module.exports = React.createClass({
119118
},
120119
renderUserInfoTab: function () {
121120
return (
122-
<div className='userInfoTab'>
121+
<div className='userInfoTab tab'>
123122
<div className='formField'>
124123
<label>Profile Name</label>
125124
<input valueLink={this.linkState('user.profileName')}/>
@@ -142,18 +141,18 @@ module.exports = React.createClass({
142141
},
143142
renderPasswordTab: function () {
144143
return (
145-
<div className='passwordTab'>
144+
<div className='passwordTab tab'>
146145
<div className='formField'>
147146
<label>Current password</label>
148-
<input valueLink={this.linkState('password.currentPassword')}/>
147+
<input type='password' valueLink={this.linkState('password.currentPassword')}/>
149148
</div>
150149
<div className='formField'>
151150
<label>New password</label>
152-
<input valueLink={this.linkState('password.newPassword')}/>
151+
<input type='password' valueLink={this.linkState('password.newPassword')}/>
153152
</div>
154153
<div className='formField'>
155154
<label>Confirmation</label>
156-
<input valueLink={this.linkState('password.passwordConfirmation')}/>
155+
<input type='password' valueLink={this.linkState('password.passwordConfirmation')}/>
157156
</div>
158157

159158
<div className='formConfirm'>

browser/main/Components/HomeNavigator.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var Modal = require('../Mixins/Modal')
1111

1212
var UserStore = require('../Stores/UserStore')
1313

14-
var AboutModal = require('./AboutModal')
14+
var PreferencesModal = require('./PreferencesModal')
1515
var PlanetCreateModal = require('./PlanetCreateModal')
1616
var TeamCreateModal = require('./TeamCreateModal')
1717
var LogoutModal = require('./LogoutModal')
@@ -65,8 +65,8 @@ module.exports = React.createClass({
6565
openTeamCreateModal: function () {
6666
this.openModal(TeamCreateModal, {user: this.state.currentUser, transitionTo: this.transitionTo})
6767
},
68-
openAboutModal: function () {
69-
this.openModal(AboutModal)
68+
openPreferencesModal: function () {
69+
this.openModal(PreferencesModal)
7070
},
7171
openPlanetCreateModal: function () {
7272
this.openModal(PlanetCreateModal, {transitionTo: this.transitionTo})
@@ -168,7 +168,7 @@ module.exports = React.createClass({
168168

169169
<ul className='controlGroup'>
170170
<li>
171-
<button onClick={this.openAboutModal}><i className='fa fa-info-circle fa-fw'/> About this app</button>
171+
<button onClick={this.openPreferencesModal}><i className='fa fa-gears fa-fw'/> Preferences</button>
172172
</li>
173173
<li>
174174
<button onClick={this.handleLogoutClick}><i className='fa fa-sign-out fa-fw'/> Log out</button>

browser/main/Components/PlanetSettingModal.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ module.exports = React.createClass({
125125
content = this.state.currentTab === 'profile' ? this.renderPlanetProfileTab() : this.renderPlanetDeleteTab()
126126

127127
return (
128-
<div className='PlanetSettingModal modal tabModal'>
128+
<div className='PlanetSettingModal sideNavModal modal'>
129129
<div className='leftPane'>
130-
<h1 className='tabLabel'>Planet setting</h1>
130+
<h1 className='modalLabel'>Planet setting</h1>
131131
<nav className='tabList'>
132132
<button onClick={this.activePlanetProfile} className={this.state.currentTab === 'profile' ? 'active' : ''}><i className='fa fa-globe fa-fw'/> Planet profile</button>
133133
<button onClick={this.activePlanetDelete} className={this.state.currentTab === 'delete' ? 'active' : ''}><i className='fa fa-trash fa-fw'/> Delete Planet</button>
@@ -142,7 +142,7 @@ module.exports = React.createClass({
142142
},
143143
renderPlanetProfileTab: function () {
144144
return (
145-
<div className='planetProfileTab'>
145+
<div className='planetProfileTab tab'>
146146
<div className='formField'>
147147
<label>Planet name </label>
148148
<input valueLink={this.linkState('planet.name')}/>
@@ -169,7 +169,7 @@ module.exports = React.createClass({
169169
var disabled = !this.state.deleteConfirmation.match(new RegExp('^' + this.props.planet.userName + '/' + this.props.planet.name + '$'))
170170

171171
return (
172-
<div className='planetDeleteTab'>
172+
<div className='planetDeleteTab tab'>
173173
<p>Are you sure to destroy <strong>'{this.props.planet.userName + '/' + this.props.planet.name}'</strong>?</p>
174174
<p>If you are sure, write <strong>'{this.props.planet.userName + '/' + this.props.planet.name}'</strong> to input below and click <strong>'{this.state.randomDeleteText}'</strong> button.</p>
175175
<input valueLink={this.linkState('deleteConfirmation')} placeholder='userName/planetName'/>
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
var ipc = require('ipc')
2+
var remote = require('remote')
3+
4+
var React = require('react/addons')
5+
6+
var LinkedState = require('../Mixins/LinkedState')
7+
var ExternalLink = require('../Mixins/ExternalLink')
8+
var KeyCaster = require('../Mixins/KeyCaster')
9+
10+
module.exports = React.createClass({
11+
mixins: [LinkedState, ExternalLink, KeyCaster('aboutModal')],
12+
propTypes: {
13+
close: React.PropTypes.func
14+
},
15+
getInitialState: function () {
16+
var keymap = remote.getGlobal('keymap')
17+
console.log(keymap)
18+
return {
19+
currentTab: 'settings',
20+
keymap: keymap
21+
}
22+
},
23+
onKeyCast: function (e) {
24+
switch (e.status) {
25+
case 'closeModal':
26+
this.props.close()
27+
break
28+
}
29+
},
30+
activeSettings: function () {
31+
this.setState({currentTab: 'settings'})
32+
},
33+
activeAbout: function () {
34+
this.setState({currentTab: 'about'})
35+
},
36+
saveKeymap: function () {
37+
ipc.send('hotkeyUpdated', JSON.stringify(this.state.keymap))
38+
},
39+
render: function () {
40+
var content = this.state.currentTab === 'settings' ? this.renderSettingsTab() : this.renderAboutTab()
41+
42+
return (
43+
<div className='PreferencesModal sideNavModal modal'>
44+
<div className='leftPane'>
45+
<h1 className='modalLabel'>Preferences</h1>
46+
<nav className='tabList'>
47+
<button onClick={this.activeSettings} className={this.state.currentTab === 'settings' ? 'active' : ''}><i className='fa fa-gear fa-fw'/> Settings</button>
48+
<button onClick={this.activeAbout} className={this.state.currentTab === 'about' ? 'active' : ''}><i className='fa fa-info-circle fa-fw'/> About this app</button>
49+
</nav>
50+
</div>
51+
<div className='rightPane'>
52+
{content}
53+
</div>
54+
</div>
55+
)
56+
},
57+
renderSettingsTab: function () {
58+
return (
59+
<div className='settingsTab tab'>
60+
<div className='categoryLabel'>Hotkey</div>
61+
<div className='formField'>
62+
<label>Toggle finder</label>
63+
<input valueLink={this.linkState('keymap.toggleFinder')}/>
64+
</div>
65+
<div className='formConfirm'>
66+
<button onClick={this.saveKeymap}>Save</button>
67+
</div>
68+
<div className='example'>
69+
<h3>Example</h3>
70+
<ul>
71+
<li><code>0</code> to <code>9</code></li>
72+
<li><code>A</code> to <code>Z</code></li>
73+
<li><code>F1</code> to <code>F24</code></li>
74+
<li>Punctuations like <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code>, etc.</li>
75+
<li><code>Plus</code></li>
76+
<li><code>Space</code></li>
77+
<li><code>Backspace</code></li>
78+
<li><code>Delete</code></li>
79+
<li><code>Insert</code></li>
80+
<li><code>Return</code> (or <code>Enter</code> as alias)</li>
81+
<li><code>Up</code>, <code>Down</code>, <code>Left</code> and <code>Right</code></li>
82+
<li><code>Home</code> and <code>End</code></li>
83+
<li><code>PageUp</code> and <code>PageDown</code></li>
84+
<li><code>Escape</code> (or <code>Esc</code> for short)</li>
85+
<li><code>VolumeUp</code>, <code>VolumeDown</code> and <code>VolumeMute</code></li>
86+
<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> and <code>MediaPlayPause</code></li>
87+
</ul>
88+
</div>
89+
</div>
90+
)
91+
},
92+
renderAboutTab: function () {
93+
var version = global.version
94+
return (
95+
<div className='aboutTab tab'>
96+
<div className='about1'>
97+
<img className='logo' src='resources/favicon-230x230.png'/>
98+
<div className='appInfo'>Boost {version == null || version.length === 0 ? 'DEV version' : 'v' + version}</div>
99+
</div>
100+
101+
<div className='about2'>
102+
<div className='externalLabel'>External links</div>
103+
<ul className='externalList'>
104+
<li><a onClick={this.openExternal} href='http://b00st.io'>Boost Homepage <i className='fa fa-external-link'/></a></li>
105+
<li><a onClick={this.openExternal} href='http://boostio.github.io/regulations.html'>Regulation <i className='fa fa-external-link'/></a></li>
106+
<li><a onClick={this.openExternal} href='http://boostio.github.io/privacypolicies.html'>Private policy <i className='fa fa-external-link'/></a></li>
107+
</ul>
108+
</div>
109+
</div>
110+
)
111+
}
112+
})

browser/main/Components/TeamSettingsModal.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ module.exports = React.createClass({
176176
}
177177

178178
return (
179-
<div className='TeamSettingsModal modal tabModal'>
179+
<div className='TeamSettingsModal sideNavModal modal'>
180180
<div className='leftPane'>
181-
<div className='tabLabel'>Team settings</div>
181+
<div className='modalLabel'>Team settings</div>
182182
<div className='tabList'>
183183
<button className={this.state.currentTab === 'teamInfo' ? 'active' : ''} onClick={this.selectTab('teamInfo')}><i className='fa fa-info-circle fa-fw'/> Team Info</button>
184184
<button className={this.state.currentTab === 'members' ? 'active' : ''} onClick={this.selectTab('members')}><i className='fa fa-users fa-fw'/> Members</button>
@@ -192,7 +192,7 @@ module.exports = React.createClass({
192192
},
193193
renderTeamInfoTab: function () {
194194
return (
195-
<div className='userInfoTab'>
195+
<div className='userInfoTab tab'>
196196
<div className='formField'>
197197
<label>Profile Name</label>
198198
<input valueLink={this.linkState('team.profileName')}/>
@@ -239,7 +239,7 @@ module.exports = React.createClass({
239239
var belowLimit = members.length < 5
240240

241241
return (
242-
<div className='membersTab'>
242+
<div className='membersTab tab'>
243243
<table className='memberTable'>
244244
<thead>
245245
<tr>

browser/main/Containers/MainContainer.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ module.exports = React.createClass({
5555
return
5656
} else {
5757
this.transitionTo('home')
58-
return
5958
}
6059
}
6160

browser/main/index.electron.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@
8787
</script>
8888
<script src="../ace/src-min/ace.js"></script>
8989
<script>
90-
91-
var version = require('remote').getGlobal('version')
90+
var version = require('remote').require('app').getVersion()
91+
global.version = version
9292
document.title = 'Boost ' + ((version == null || version.length === 0) ? 'DEV version' : 'v' + version)
9393
require('../electron-stylus')(__dirname + '/../styles/main/index.styl', 'mainCss')
94+
// require('../electron-stylus')(__dirname + '/../styles/main/index.styl')
9495
require('node-jsx').install({ harmony: true, extension: '.jsx' })
9596
require('./index.jsx')
9697
</script>

browser/styles/shared/modal.styl

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
.modal-control
3333
float right
3434

35-
.tabModal
35+
.sideNavModal
3636
height 500px
3737
.leftPane
3838
absolute top bottom left
3939
width 175px
4040
padding 20px
4141
border-right solid 1px borderColor
42-
.tabLabel
42+
.modalLabel
4343
font-size 1.5em
4444
margin-top 25px
4545
margin-bottom 35px
@@ -57,9 +57,7 @@
5757
left 175px
5858
padding 15px
5959
overflow-y auto
60-
61-
.EditProfileModal, .PlanetSettingModal, .TeamSettingsModal
62-
.userInfoTab, .passwordTab, .planetProfileTab, .userInfoTab, .membersTab
60+
.tab
6361
padding-top 45px
6462
.formField
6563
position relative
@@ -111,6 +109,33 @@
111109
alertSuccess()
112110
.alertError
113111
alertError()
112+
.PreferencesModal
113+
.settingsTab
114+
.categoryLabel
115+
font-size 1.5em
116+
margin-bottom 25px
117+
.example
118+
marked()
119+
.aboutTab
120+
padding-top 30px
121+
.about1
122+
margin-bottom 25px
123+
.logo
124+
display block
125+
margin 0 auto
126+
.appInfo
127+
font-size 1.5em
128+
text-align center
129+
.about2
130+
width 200px
131+
margin 0 auto
132+
.externalLabel
133+
font-size 1.2em
134+
margin-bottom 15px
135+
.externalList
136+
li
137+
margin-bottom 15px
138+
.PlanetSettingModal
114139
.planetDeleteTab
115140
padding-top 65px
116141
p
@@ -153,6 +178,7 @@
153178
alertSuccess()
154179
.alertError
155180
alertError()
181+
.TeamSettingsModal
156182
.membersTab
157183
.memberTable
158184
width 100%
@@ -262,25 +288,6 @@
262288
border-radius 5px
263289
marked()
264290

265-
.AboutModal
266-
width 320px
267-
.about1
268-
margin-bottom 25px
269-
.logo
270-
display block
271-
margin 0 auto
272-
.appInfo
273-
font-size 1.5em
274-
text-align center
275-
.about2
276-
width 200px
277-
margin 0 auto
278-
.externalLabel
279-
font-size 1.2em
280-
margin-bottom 15px
281-
.externalList
282-
li
283-
margin-bottom 15px
284291

285292
.PlanetCreateModal.modal, .TeamCreateModal.modal, .AddMemberModal.modal
286293
padding 60px 0

0 commit comments

Comments
 (0)