Skip to content

Commit 7f91243

Browse files
committed
选项界面调整。
1 parent c500192 commit 7f91243

File tree

6 files changed

+40
-49
lines changed

6 files changed

+40
-49
lines changed

app/ui/bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
exports.version = [3,3,5,5262];
1+
exports.version = [3,3,5,5263];

ui/frame/frame.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default class MyFrame extends React.Component {
6060
if (!this.props.show) {
6161
return null
6262
}
63-
let {show, title, body, lang, width} = this.props
63+
let {show, title, body, lang, width, okText} = this.props
6464

6565
return (
6666
<Modal
@@ -75,7 +75,7 @@ export default class MyFrame extends React.Component {
7575
{lang.cancel}
7676
</Button>,
7777
<Button key="submit" type="primary" size="large" loading={false} onClick={this.onOK.bind(this)}>
78-
{lang.ok}
78+
{okText || lang.ok}
7979
</Button>
8080
]}
8181
>

ui/frame/preferences.jsx

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
'use strict'
77

88
import React from 'react'
9+
import { Checkbox, Input, Radio, Select } from 'antd'
910
import MyFrame from './frame'
1011
import classnames from 'classnames'
1112
import Agent from '../Agent'
1213
import { version as current_version } from '../../app/version'
1314
import formatVersion from '../../app/libs/formatVersion'
1415
import './preferences.less'
1516

17+
const RadioGroup = Radio.Group
18+
const Option = Select.Option
1619
const pref_keys = ['after_cmd', 'auto_launch', 'choice_mode', 'hide_at_launch', 'is_dock_icon_hidden', 'user_language']
1720

1821
export default class PreferencesPrompt extends React.Component {
@@ -80,7 +83,7 @@ export default class PreferencesPrompt extends React.Component {
8083
getLanguageOptions () {
8184
return this.state.lang_list.map(({key, name}, idx) => {
8285
return (
83-
<option value={key} key={idx}>{name}</option>
86+
<Option value={key} key={idx}>{name}</Option>
8487
)
8588
})
8689
}
@@ -122,15 +125,14 @@ export default class PreferencesPrompt extends React.Component {
122125
<div className="ln">
123126
<div className="title">{lang.language}</div>
124127
<div className="cnt">
125-
<select
128+
<Select
126129
value={this.state.user_language || ''}
127-
onChange={(e) => this.updateLangKey(e.target.value)}
130+
onChange={v => this.updateLangKey(v)}
128131
>
129132
{this.getLanguageOptions()}
130-
</select>
133+
</Select>
131134

132-
<div
133-
className="inform">{lang.should_restart_after_change_language}</div>
135+
<div className="inform">{lang.should_restart_after_change_language}</div>
134136
</div>
135137
</div>
136138
)
@@ -143,20 +145,13 @@ export default class PreferencesPrompt extends React.Component {
143145
<div className="ln">
144146
<div className="title">{lang.pref_choice_mode}</div>
145147
<div className="cnt">
146-
<input type="radio" id="pref-choice-mode-single" name="choice_mode"
147-
value="single"
148-
defaultChecked={this.state.choice_mode === 'single'}
149-
onChange={(e) => this.updateChoiceMode(e.target.value)}
150-
/>
151-
<label
152-
htmlFor="pref-choice-mode-single">{lang.pref_choice_mode_single}</label>
153-
<input type="radio" id="pref-choice-mode-multiple" name="choice_mode"
154-
value="multiple"
155-
defaultChecked={this.state.choice_mode === 'multiple'}
156-
onChange={(e) => this.updateChoiceMode(e.target.value)}
157-
/>
158-
<label
159-
htmlFor="pref-choice-mode-multiple">{lang.pref_choice_mode_multiple}</label>
148+
<RadioGroup
149+
onChange={e => this.updateChoiceMode(e.target.value)}
150+
value={this.state.choice_mode}
151+
>
152+
<Radio value="single">{lang.pref_choice_mode_single}</Radio>
153+
<Radio value="multiple">{lang.pref_choice_mode_multiple}</Radio>
154+
</RadioGroup>
160155
</div>
161156
</div>
162157
)
@@ -170,8 +165,9 @@ export default class PreferencesPrompt extends React.Component {
170165
<div className="title">{lang.pref_after_cmd}</div>
171166
<div className="cnt">
172167
<div className="inform">{lang.pref_after_cmd_info}</div>
173-
<textarea
174-
name=""
168+
<Input
169+
type="textarea"
170+
rows={4}
175171
defaultValue={this.state.after_cmd}
176172
placeholder={lang.pref_after_cmd_placeholder}
177173
onChange={(e) => this.updateAfterCmd(e.target.value)}
@@ -188,9 +184,9 @@ export default class PreferencesPrompt extends React.Component {
188184
<div className="ln">
189185
<div className="title">{lang.auto_launch}</div>
190186
<div className="cnt">
191-
<input type="checkbox" name=""
192-
defaultChecked={this.state.auto_launch}
193-
onChange={(e) => this.updateAutoLaunch(e.target.checked)}
187+
<Checkbox
188+
defaultValue={this.state.auto_launch}
189+
onChange={(e) => this.updateAutoLaunch(e.target.checked)}
194190
/>
195191
</div>
196192
</div>
@@ -204,9 +200,9 @@ export default class PreferencesPrompt extends React.Component {
204200
<div className="ln">
205201
<div className="title">{lang.hide_at_launch}</div>
206202
<div className="cnt">
207-
<input type="checkbox" name=""
208-
defaultChecked={this.state.hide_at_launch}
209-
onChange={(e) => this.updateMinimizeAtLaunch(e.target.checked)}
203+
<Checkbox
204+
defaultValue={this.state.hide_at_launch}
205+
onChange={(e) => this.updateMinimizeAtLaunch(e.target.checked)}
210206
/>
211207
</div>
212208
</div>
@@ -243,12 +239,13 @@ export default class PreferencesPrompt extends React.Component {
243239
return (
244240
<MyFrame
245241
show={this.state.show}
246-
head={lang.preferences}
242+
title={lang.preferences}
247243
body={this.body()}
248244
onOK={() => this.onOK()}
249245
onCancel={() => this.onCancel()}
250246
cancel_title={lang.cancel}
251-
ok_title={lang.set_and_relaunch_app}
247+
okText={lang.set_and_relaunch_app}
248+
lang={lang}
252249
/>
253250
)
254251
}

ui/frame/preferences.less

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
.frame {
2-
textarea {
3-
width: 300px;
4-
height: 80px;
5-
padding: 2px 4px;
6-
outline: none;
7-
border: solid 1px #ccc;
8-
}
9-
102
.current-version {
113
float: right;
12-
margin-top: -60px;
4+
margin-top: -50px;
5+
margin-right: 30px;
136
color: #999;
147

158
a {

ui/frame/sudo.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ export default class SudoPrompt extends React.Component {
3434
}
3535

3636
onOK () {
37-
let pswd = this.refs.pswd.value
37+
let {pswd} = this.state
3838
if (!pswd) {
39-
let el = this.refs.body
40-
el && el.querySelector('input').focus()
39+
//let el = body
40+
//el && el.querySelector('input').focus()
41+
this.refs.pswd.focus()
4142
return
4243
}
4344

4445
this.setState({
45-
show: false,
46-
pswd: pswd
46+
show: false
4747
})
4848

4949
Agent.emit('sudo_pswd', pswd)
@@ -72,6 +72,7 @@ export default class SudoPrompt extends React.Component {
7272
type="password"
7373
ref="pswd"
7474
onKeyDown={e => (e.keyCode === 13 && this.onOK() || e.keyCode === 27 && this.onCancel())}
75+
onChange={e => this.setState({pswd: e.target.value})}
7576
/>
7677
</div>
7778
</div>

0 commit comments

Comments
 (0)