@@ -60,6 +60,7 @@ import { SettingsSection } from "../../shared/SettingsSection";
6060import SettingsSubsection , { SettingsSubsectionText } from "../../shared/SettingsSubsection" ;
6161import { SettingsSubsectionHeading } from "../../shared/SettingsSubsectionHeading" ;
6262import Heading from "../../../typography/Heading" ;
63+ import InlineSpinner from "../../../elements/InlineSpinner" ;
6364
6465interface IProps {
6566 closeSettingsFn : ( ) => void ;
@@ -196,7 +197,6 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
196197 ) ;
197198 logger . warn ( e ) ;
198199 }
199-
200200 this . setState ( {
201201 emails : threepids . filter ( ( a ) => a . medium === ThreepidMedium . Email ) ,
202202 msisdns : threepids . filter ( ( a ) => a . medium === ThreepidMedium . Phone ) ,
@@ -329,16 +329,6 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
329329 }
330330
331331 private renderAccountSection ( ) : JSX . Element {
332- let passwordChangeForm : ReactNode = (
333- < ChangePassword
334- className = "mx_GeneralUserSettingsTab_section--account_changePassword"
335- rowClassName = ""
336- buttonKind = "primary"
337- onError = { this . onPasswordChangeError }
338- onFinished = { this . onPasswordChanged }
339- />
340- ) ;
341-
342332 let threepidSection : ReactNode = null ;
343333
344334 // For older homeservers without separate 3PID add and bind methods (MSC2290),
@@ -351,33 +341,52 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
351341 ( this . state . haveIdServer || this . state . serverSupportsSeparateAddAndBind === true )
352342 ) {
353343 const emails = this . state . loading3pids ? (
354- < Spinner />
344+ < InlineSpinner />
355345 ) : (
356346 < AccountEmailAddresses emails = { this . state . emails } onEmailsChange = { this . onEmailsChange } />
357347 ) ;
358348 const msisdns = this . state . loading3pids ? (
359- < Spinner />
349+ < InlineSpinner />
360350 ) : (
361351 < AccountPhoneNumbers msisdns = { this . state . msisdns } onMsisdnsChange = { this . onMsisdnsChange } />
362352 ) ;
363353 threepidSection = (
364- < div >
365- < span className = "mx_SettingsTab_subheading" > { _t ( "Email addresses" ) } </ span >
366- { emails }
354+ < >
355+ < SettingsSubsection
356+ heading = { _t ( "Email addresses" ) }
357+ stretchContent
358+ data-testid = "mx_AccountEmailAddresses"
359+ >
360+ { emails }
361+ </ SettingsSubsection >
367362
368- < span className = "mx_SettingsTab_subheading" > { _t ( "Phone numbers" ) } </ span >
369- { msisdns }
370- </ div >
363+ < SettingsSubsection
364+ heading = { _t ( "Phone numbers" ) }
365+ stretchContent
366+ data-testid = "mx_AccountPhoneNumbers"
367+ >
368+ { msisdns }
369+ </ SettingsSubsection >
370+ </ >
371371 ) ;
372372 } else if ( this . state . serverSupportsSeparateAddAndBind === null ) {
373373 threepidSection = < Spinner /> ;
374374 }
375375
376- let passwordChangeText : ReactNode = _t ( "Set a new account password…" ) ;
377- if ( ! this . state . canChangePassword ) {
378- // Just don't show anything if you can't do anything.
379- passwordChangeText = null ;
380- passwordChangeForm = null ;
376+ let passwordChangeSection : ReactNode = null ;
377+ if ( this . state . canChangePassword ) {
378+ passwordChangeSection = (
379+ < >
380+ < SettingsSubsectionText > { _t ( "Set a new account password…" ) } </ SettingsSubsectionText >
381+ < ChangePassword
382+ className = "mx_GeneralUserSettingsTab_section--account_changePassword"
383+ rowClassName = ""
384+ buttonKind = "primary"
385+ onError = { this . onPasswordChangeError }
386+ onFinished = { this . onPasswordChanged }
387+ />
388+ </ >
389+ ) ;
381390 }
382391
383392 let externalAccountManagement : JSX . Element | undefined ;
@@ -386,13 +395,13 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
386395
387396 externalAccountManagement = (
388397 < >
389- < p className = "mx_SettingsTab_subsectionText" data-testid = "external-account-management-outer" >
398+ < SettingsSubsectionText data-testid = "external-account-management-outer" >
390399 { _t (
391400 "Your account details are managed separately at <code>%(hostname)s</code>." ,
392401 { hostname } ,
393402 { code : ( sub ) => < code > { sub } </ code > } ,
394403 ) }
395- </ p >
404+ </ SettingsSubsectionText >
396405 < AccessibleButton
397406 onClick = { null }
398407 element = "a"
@@ -408,13 +417,13 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
408417 ) ;
409418 }
410419 return (
411- < div className = "mx_SettingsTab_section mx_GeneralUserSettingsTab_section--account" >
412- < span className = "mx_SettingsTab_subheading" > { _t ( "Account" ) } </ span >
413- { externalAccountManagement }
414- < p className = "mx_SettingsTab_subsectionText" > { passwordChangeText } </ p >
415- { passwordChangeForm }
420+ < >
421+ < SettingsSubsection heading = { _t ( "Account" ) } stretchContent data-testid = "accountSection" >
422+ { externalAccountManagement }
423+ { passwordChangeSection }
424+ </ SettingsSubsection >
416425 { threepidSection }
417- </ div >
426+ </ >
418427 ) ;
419428 }
420429
@@ -540,7 +549,11 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
540549 { _t ( "Discovery" ) }
541550 </ Heading >
542551 ) ;
543- discoverySection = < SettingsSection heading = { heading } > { this . renderDiscoverySection ( ) } </ SettingsSection > ;
552+ discoverySection = (
553+ < SettingsSection heading = { heading } data-testid = "discoverySection" >
554+ { this . renderDiscoverySection ( ) }
555+ </ SettingsSection >
556+ ) ;
544557 }
545558
546559 return (
0 commit comments