@@ -10,10 +10,7 @@ interface TwoFactorRecoveryCodesProps {
1010 fetchRecoveryCodes : ( ) => Promise < void > ;
1111}
1212
13- export default function TwoFactorRecoveryCodes ( {
14- recoveryCodesList,
15- fetchRecoveryCodes,
16- } : TwoFactorRecoveryCodesProps ) {
13+ export default function TwoFactorRecoveryCodes ( { recoveryCodesList, fetchRecoveryCodes } : TwoFactorRecoveryCodesProps ) {
1714 const [ isCodesVisible , setIsCodesVisible ] = useState < boolean > ( false ) ;
1815 const codesSectionRef = useRef < HTMLDivElement | null > ( null ) ;
1916
@@ -28,7 +25,7 @@ export default function TwoFactorRecoveryCodes({
2825 setTimeout ( ( ) => {
2926 codesSectionRef . current ?. scrollIntoView ( {
3027 behavior : 'smooth' ,
31- block : 'nearest'
28+ block : 'nearest' ,
3229 } ) ;
3330 } ) ;
3431 }
@@ -50,34 +47,21 @@ export default function TwoFactorRecoveryCodes({
5047 2FA Recovery Codes
5148 </ CardTitle >
5249 < CardDescription >
53- Recovery codes let you regain access if you lose your 2FA device. Store them in a secure password manager.
50+ Recovery codes let you regain access if you lose your 2FA device. Store them in a secure password manager.
5451 </ CardDescription >
5552 </ CardHeader >
5653 < CardContent >
5754 < div className = "flex flex-col gap-3 select-none sm:flex-row sm:items-center sm:justify-between" >
58- < Button
59- onClick = { toggleCodesVisibility }
60- className = "w-fit"
61- aria-expanded = { isCodesVisible }
62- aria-controls = "recovery-codes-section"
63- >
55+ < Button onClick = { toggleCodesVisibility } className = "w-fit" aria-expanded = { isCodesVisible } aria-controls = "recovery-codes-section" >
6456 < IconComponent className = "size-4" aria-hidden = "true" />
6557 { isCodesVisible ? 'Hide' : 'View' } Recovery Codes
6658 </ Button >
6759
6860 { isCodesVisible && (
6961 < Form { ...regenerateRecoveryCodes . form ( ) } options = { { preserveScroll : true } } onSuccess = { fetchRecoveryCodes } >
7062 { ( { processing } ) => (
71- < Button
72- variant = "secondary"
73- type = "submit"
74- disabled = { processing }
75- aria-describedby = "regenerate-warning"
76- >
77- < RefreshCw
78- className = { `mr-2 size-4 ${ processing ? 'animate-spin' : '' } ` }
79- aria-hidden = "true"
80- />
63+ < Button variant = "secondary" type = "submit" disabled = { processing } aria-describedby = "regenerate-warning" >
64+ < RefreshCw className = { `mr-2 size-4 ${ processing ? 'animate-spin' : '' } ` } aria-hidden = "true" />
8165 { processing ? 'Regenerating...' : 'Regenerate Codes' }
8266 </ Button >
8367 ) }
@@ -86,9 +70,7 @@ export default function TwoFactorRecoveryCodes({
8670 </ div >
8771 < div
8872 id = "recovery-codes-section"
89- className = { `relative overflow-hidden transition-all duration-300 ${
90- isCodesVisible ? 'h-auto opacity-100' : 'h-0 opacity-0'
91- } `}
73+ className = { `relative overflow-hidden transition-all duration-300 ${ isCodesVisible ? 'h-auto opacity-100' : 'h-0 opacity-0' } ` }
9274 aria-hidden = { ! isCodesVisible }
9375 >
9476 < div className = "mt-3 space-y-3" >
@@ -101,11 +83,7 @@ export default function TwoFactorRecoveryCodes({
10183 { ! recoveryCodesList . length ? (
10284 < div className = "space-y-2" aria-label = "Loading recovery codes" >
10385 { Array . from ( { length : 8 } , ( _ , index ) => (
104- < div
105- key = { index }
106- className = "h-4 animate-pulse rounded bg-muted-foreground/20"
107- aria-hidden = "true"
108- />
86+ < div key = { index } className = "h-4 animate-pulse rounded bg-muted-foreground/20" aria-hidden = "true" />
10987 ) ) }
11088 </ div >
11189 ) : (
@@ -118,8 +96,8 @@ export default function TwoFactorRecoveryCodes({
11896 </ div >
11997 < div className = "text-xs text-muted-foreground select-none" >
12098 < p id = "regenerate-warning" >
121- Each recovery code can be used once to access your account and will be removed after use.
122- If you need more, click < span className = "font-bold" > Regenerate Codes</ span > above.
99+ Each recovery code can be used once to access your account and will be removed after use. If you need more, click { ' ' }
100+ < span className = "font-bold" > Regenerate Codes</ span > above.
123101 </ p >
124102 </ div >
125103 </ div >
0 commit comments