@@ -11,33 +11,33 @@ interface TwoFactorRecoveryCodesProps {
11
11
}
12
12
13
13
export default function TwoFactorRecoveryCodes ( { recoveryCodesList, fetchRecoveryCodes } : TwoFactorRecoveryCodesProps ) {
14
- const [ codesAeVisible , setCodesAeVisible ] = useState < boolean > ( false ) ;
14
+ const [ codesAreVisible , setCodesAreVisible ] = useState < boolean > ( false ) ;
15
15
const codesSectionRef = useRef < HTMLDivElement | null > ( null ) ;
16
16
17
17
const toggleCodesVisibility = useCallback ( async ( ) => {
18
- if ( ! codesAeVisible && ! recoveryCodesList . length ) {
18
+ if ( ! codesAreVisible && ! recoveryCodesList . length ) {
19
19
await fetchRecoveryCodes ( ) ;
20
20
}
21
21
22
- setCodesAeVisible ( ! codesAeVisible ) ;
22
+ setCodesAreVisible ( ! codesAreVisible ) ;
23
23
24
- if ( ! codesAeVisible ) {
24
+ if ( ! codesAreVisible ) {
25
25
setTimeout ( ( ) => {
26
26
codesSectionRef . current ?. scrollIntoView ( {
27
27
behavior : 'smooth' ,
28
28
block : 'nearest' ,
29
29
} ) ;
30
30
} ) ;
31
31
}
32
- } , [ codesAeVisible , recoveryCodesList . length , fetchRecoveryCodes ] ) ;
32
+ } , [ codesAreVisible , recoveryCodesList . length , fetchRecoveryCodes ] ) ;
33
33
34
34
useEffect ( ( ) => {
35
35
if ( ! recoveryCodesList . length ) {
36
36
fetchRecoveryCodes ( ) ;
37
37
}
38
38
} , [ recoveryCodesList . length , fetchRecoveryCodes ] ) ;
39
39
40
- const RecoveryCodeIconComponent = codesAeVisible ? EyeOff : Eye ;
40
+ const RecoveryCodeIconComponent = codesAreVisible ? EyeOff : Eye ;
41
41
42
42
return (
43
43
< Card >
@@ -52,12 +52,12 @@ export default function TwoFactorRecoveryCodes({ recoveryCodesList, fetchRecover
52
52
</ CardHeader >
53
53
< CardContent >
54
54
< div className = "flex flex-col gap-3 select-none sm:flex-row sm:items-center sm:justify-between" >
55
- < Button onClick = { toggleCodesVisibility } className = "w-fit" aria-expanded = { codesAeVisible } aria-controls = "recovery-codes-section" >
55
+ < Button onClick = { toggleCodesVisibility } className = "w-fit" aria-expanded = { codesAreVisible } aria-controls = "recovery-codes-section" >
56
56
< RecoveryCodeIconComponent className = "size-4" aria-hidden = "true" />
57
- { codesAeVisible ? 'Hide' : 'View' } Recovery Codes
57
+ { codesAreVisible ? 'Hide' : 'View' } Recovery Codes
58
58
</ Button >
59
59
60
- { codesAeVisible && (
60
+ { codesAreVisible && (
61
61
< Form { ...regenerateRecoveryCodes . form ( ) } options = { { preserveScroll : true } } onSuccess = { fetchRecoveryCodes } >
62
62
{ ( { processing } ) => (
63
63
< Button variant = "secondary" type = "submit" disabled = { processing } aria-describedby = "regenerate-warning" >
@@ -69,8 +69,8 @@ export default function TwoFactorRecoveryCodes({ recoveryCodesList, fetchRecover
69
69
</ div >
70
70
< div
71
71
id = "recovery-codes-section"
72
- className = { `relative overflow-hidden transition-all duration-300 ${ codesAeVisible ? 'h-auto opacity-100' : 'h-0 opacity-0' } ` }
73
- aria-hidden = { ! codesAeVisible }
72
+ className = { `relative overflow-hidden transition-all duration-300 ${ codesAreVisible ? 'h-auto opacity-100' : 'h-0 opacity-0' } ` }
73
+ aria-hidden = { ! codesAreVisible }
74
74
>
75
75
< div className = "mt-3 space-y-3" >
76
76
< div
0 commit comments