66'use strict'
77
88import React from 'react'
9+ import { Checkbox , Input , Radio , Select } from 'antd'
910import MyFrame from './frame'
1011import classnames from 'classnames'
1112import Agent from '../Agent'
1213import { version as current_version } from '../../app/version'
1314import formatVersion from '../../app/libs/formatVersion'
1415import './preferences.less'
1516
17+ const RadioGroup = Radio . Group
18+ const Option = Select . Option
1619const pref_keys = [ 'after_cmd' , 'auto_launch' , 'choice_mode' , 'hide_at_launch' , 'is_dock_icon_hidden' , 'user_language' ]
1720
1821export 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 }
0 commit comments