@@ -18,6 +18,9 @@ import PageTitle from 'components/PageTitle'
1818import { withRouter } from 'react-router-dom'
1919import InfoMessage from 'components/InfoMessage'
2020import Setting from 'components/Setting'
21+ import AccountProvider from 'common/providers/AccountProvider'
22+ import DarkModeSwitch from 'components/DarkModeSwitch'
23+ import SettingTitle from 'components/SettingTitle'
2124
2225class AccountSettingsPage extends Component {
2326 static displayName = 'AccountSettingsPage'
@@ -174,153 +177,149 @@ class AccountSettingsPage extends Component {
174177 Log Out
175178 </ Button >
176179 }
177- title = { 'Account' }
180+ title = { 'Account Settings ' }
178181 />
179182 < Tabs uncontrolled className = 'mt-0' history = { this . props . history } >
180183 < TabItem tabLabel = 'General' >
181- < div className = 'mt-4' >
182- < h5 className = 'mb-5' > General Settings </ h5 >
184+ < div className = 'mt-4 col-md-8 ' >
185+ < SettingTitle > Account Information </ SettingTitle >
183186 < JSONReference
184187 showNamesButton
185188 title = { 'User' }
186189 json = { AccountStore . getUser ( ) }
187190 />
188- < div className = 'col-md-6' >
189- < form className = 'mb-0' onSubmit = { this . save } >
190- { ! [ 'LDAP' , 'SAML' ] . includes (
191- AccountStore . model . auth_type ,
192- ) && (
193- < div >
194- < InputGroup
195- className = 'mt-2'
196- title = 'Email Address'
197- data-test = 'firstName'
198- inputProps = { {
199- className : 'full-width' ,
200- name : 'groupName' ,
201- readOnly : true ,
202- } }
203- value = { email }
204- onChange = { ( e ) =>
205- this . setState ( {
206- first_name : Utils . safeParseEventValue ( e ) ,
207- } )
191+ < form className = 'mb-0' onSubmit = { this . save } >
192+ { ! [ 'LDAP' , 'SAML' ] . includes (
193+ AccountStore . model . auth_type ,
194+ ) && (
195+ < div >
196+ < InputGroup
197+ className = 'mt-2'
198+ title = 'Email Address'
199+ data-test = 'firstName'
200+ inputProps = { {
201+ className : 'full-width' ,
202+ name : 'groupName' ,
203+ readOnly : true ,
204+ } }
205+ value = { email }
206+ onChange = { ( e ) =>
207+ this . setState ( {
208+ first_name : Utils . safeParseEventValue ( e ) ,
209+ } )
210+ }
211+ type = 'text'
212+ name = 'Email Address'
213+ />
214+ < div className = 'text-right' >
215+ < Button
216+ onClick = { ( ) =>
217+ openModal (
218+ 'Change Email Address' ,
219+ < ChangeEmailAddress
220+ onComplete = { ( ) => {
221+ closeModal ( )
222+ AppActions . logout ( )
223+ } }
224+ /> ,
225+ 'p-0' ,
226+ )
208227 }
209- type = 'text'
210- name = 'Email Address'
211- />
212- < div className = 'text-right mt-5' >
213- < Button
214- onClick = { ( ) =>
215- openModal (
216- 'Change Email Address' ,
217- < ChangeEmailAddress
218- onComplete = { ( ) => {
219- closeModal ( )
220- AppActions . logout ( )
221- } }
222- /> ,
223- 'p-0' ,
224- )
225- }
226- id = 'change-email-button'
227- data-test = 'change-email-button'
228- type = 'button'
229- class = 'input-group-addon'
230- >
231- Change Email Address
232- </ Button >
233- </ div >
228+ id = 'change-email-button'
229+ data-test = 'change-email-button'
230+ type = 'button'
231+ class = 'input-group-addon'
232+ >
233+ Change Email Address
234+ </ Button >
234235 </ div >
235- ) }
236- < InputGroup
237- className = 'mt-2 mb-4'
238- title = 'First Name'
239- data-test = 'firstName'
240- inputProps = { {
241- className : 'full-width' ,
242- name : 'groupName' ,
243- } }
244- value = { first_name }
245- onChange = { ( e ) =>
246- this . setState ( {
247- first_name : Utils . safeParseEventValue ( e ) ,
248- } )
249- }
250- isValid = { first_name && first_name . length }
251- type = 'text'
252- name = 'First Name*'
253- />
254- < InputGroup
255- className = 'mb-5'
256- title = 'Last Name'
257- data-test = 'lastName'
258- inputProps = { {
259- className : 'full-width' ,
260- name : 'groupName' ,
261- } }
262- value = { last_name }
263- onChange = { ( e ) =>
264- this . setState ( {
265- last_name : Utils . safeParseEventValue ( e ) ,
266- } )
267- }
268- isValid = { last_name && last_name . length }
269- type = 'text'
270- name = 'Last Name*'
271- />
272- { error && < ErrorMessage > { error } </ ErrorMessage > }
273- < div className = 'text-right mt-2' >
274- < Button
275- type = 'submit'
276- disabled = { isSaving || ! first_name || ! last_name }
277- >
278- Save Details
279- </ Button >
280236 </ div >
281- </ form >
282- </ div >
283- < hr className = 'py-0 my-4' />
284- < div className = 'col-md-6' >
285- < Setting
286- onChange = { ( v ) => {
287- flagsmith . setTrait ( 'json_inspect' , v ) . then ( ( ) => {
288- toast ( 'Updated' )
237+ ) }
238+ < InputGroup
239+ className = 'mt-2'
240+ title = 'First Name'
241+ data-test = 'firstName'
242+ inputProps = { {
243+ className : 'full-width' ,
244+ name : 'groupName' ,
245+ } }
246+ value = { first_name }
247+ onChange = { ( e ) =>
248+ this . setState ( {
249+ first_name : Utils . safeParseEventValue ( e ) ,
289250 } )
251+ }
252+ isValid = { first_name && first_name . length }
253+ type = 'text'
254+ name = 'First Name*'
255+ />
256+ < InputGroup
257+ className = 'mb-5'
258+ title = 'Last Name'
259+ data-test = 'lastName'
260+ inputProps = { {
261+ className : 'full-width' ,
262+ name : 'groupName' ,
290263 } }
291- checked = { flagsmith . getTrait ( 'json_inspect' ) }
292- title = { 'Show JSON References' }
293- description = { `Enabling this will allow you to inspect the JSON of entities such as features within the platform.` }
264+ value = { last_name }
265+ onChange = { ( e ) =>
266+ this . setState ( {
267+ last_name : Utils . safeParseEventValue ( e ) ,
268+ } )
269+ }
270+ isValid = { last_name && last_name . length }
271+ type = 'text'
272+ name = 'Last Name*'
294273 />
295- </ div >
296- < hr className = 'py-0 my-4' />
297- < div className = 'col-md-6' >
298- < Row className = 'mt-4' space >
299- < div className = 'col-md-7 pl-0' >
300- < h5 > Delete Account</ h5 >
301- < p className = 'fs-small lh-sm mb-0' >
302- Your account data will be permanently deleted.
303- </ p >
304- </ div >
274+ { error && < ErrorMessage > { error } </ ErrorMessage > }
275+ < div className = 'text-right' >
305276 < Button
306- id = 'delete-user-btn'
307- data-test = 'delete-user-btn'
308- onClick = { ( ) =>
309- this . confirmDeleteAccount (
310- lastUserOrganisations ,
311- id ,
312- email ,
313- auth_type ,
314- )
315- }
316- className = 'btn-with-icon btn-remove'
277+ type = 'submit'
278+ disabled = { isSaving || ! first_name || ! last_name }
317279 >
318- < Icon name = 'trash-2' width = { 20 } fill = '#EF4D56' />
280+ Save Details
319281 </ Button >
320- </ Row >
321- </ div >
282+ </ div >
283+ </ form >
284+ < SettingTitle > Appearance</ SettingTitle >
285+ < DarkModeSwitch />
286+ < SettingTitle > Developer</ SettingTitle >
287+ < Setting
288+ onChange = { ( v ) => {
289+ flagsmith . setTrait ( 'json_inspect' , v ) . then ( ( ) => {
290+ toast ( 'Updated' )
291+ } )
292+ } }
293+ checked = { flagsmith . getTrait ( 'json_inspect' ) }
294+ title = { 'Show JSON References' }
295+ description = { `Enabling this will allow you to inspect the JSON of entities such as features within the platform.` }
296+ />
297+ < SettingTitle danger > Delete Account</ SettingTitle >
298+ < Row className = '' space >
299+ < div className = 'pl-0' >
300+ < p className = 'fs-small lh-sm mb-0' >
301+ Your account data will be permanently deleted.
302+ </ p >
303+ </ div >
304+ < Button
305+ id = 'delete-user-btn'
306+ data-test = 'delete-user-btn'
307+ onClick = { ( ) =>
308+ this . confirmDeleteAccount (
309+ lastUserOrganisations ,
310+ id ,
311+ email ,
312+ auth_type ,
313+ )
314+ }
315+ theme = 'danger'
316+ >
317+ Delete Account
318+ </ Button >
319+ </ Row >
322320 </ div >
323321 </ TabItem >
322+
324323 < TabItem tabLabel = 'API Keys' >
325324 < div className = 'mt-6' >
326325 < div className = 'col-md-6' >
0 commit comments