Skip to content

Commit 52f02f0

Browse files
committed
Merge branch 'frontend-cleanup-wizard-state-naming'
2 parents 2347c9b + c1c6cb2 commit 52f02f0

File tree

1 file changed

+11
-11
lines changed
  • frontends/web/src/routes/device/bitbox02

1 file changed

+11
-11
lines changed

frontends/web/src/routes/device/bitbox02/wizard.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const Wizard = ({ deviceID }: TProps) => {
2727
verifyAttestation(deviceID).then(cb);
2828
})
2929
);
30-
const [appStatus, setAppStatus] = useState<'' | TWalletSetupChoices>('');
30+
const [setupChoice, setSetupChoice] = useState<'' | TWalletSetupChoices>('');
3131
const [createOptions, setCreateOptions] = useState<TWalletCreateOptions>();
3232
const [showWizard, setShowWizard] = useState<boolean>(false);
3333
// If true, we just pair and unlock, so we can hide some steps.
@@ -54,7 +54,7 @@ export const Wizard = ({ deviceID }: TProps) => {
5454
}, [status, showWizard, unlockOnly]);
5555

5656
const handleAbort = () => {
57-
setAppStatus('');
57+
setSetupChoice('');
5858
setCreateOptions(undefined);
5959
};
6060
if (status === undefined) {
@@ -77,7 +77,7 @@ export const Wizard = ({ deviceID }: TProps) => {
7777
return null;
7878
}
7979
// fixes empty main element, happens when after unlocking the device, reason wizard is now always mounted in app.tsx
80-
if (appStatus === '' && status === 'initialized') {
80+
if (setupChoice === '' && status === 'initialized') {
8181
return null;
8282
}
8383
return (
@@ -96,20 +96,20 @@ export const Wizard = ({ deviceID }: TProps) => {
9696
pairingFailed={status === 'pairingFailed'} />
9797
)}
9898

99-
{ (!unlockOnly && appStatus === '') && (
99+
{ (!unlockOnly && setupChoice === '') && (
100100
<SetupOptions
101101
key="choose-setup"
102102
versionInfo={versionInfo}
103103
onSelectSetup={(
104104
type: TWalletSetupChoices,
105105
createOptions?: TWalletCreateOptions,
106106
) => {
107-
setAppStatus(type);
107+
setSetupChoice(type);
108108
setCreateOptions(createOptions);
109109
}} />
110110
)}
111111

112-
{ (!unlockOnly && appStatus === 'create-wallet') && (
112+
{ (!unlockOnly && setupChoice === 'create-wallet') && (
113113
<CreateWallet
114114
backupType={(createOptions?.withMnemonic ? 'mnemonic' : 'sdcard')}
115115
backupSeedLength={createOptions?.with12Words ? 16 : 32}
@@ -119,30 +119,30 @@ export const Wizard = ({ deviceID }: TProps) => {
119119
)}
120120

121121
{/* keeping the backups mounted even restoreBackupStatus === 'restore' is not true so it catches potential errors */}
122-
{ (!unlockOnly && appStatus === 'restore-sdcard' && status !== 'initialized') && (
122+
{ (!unlockOnly && setupChoice === 'restore-sdcard' && status !== 'initialized') && (
123123
<RestoreFromSDCard
124124
key="restore-sdcard"
125125
deviceID={deviceID}
126126
onAbort={handleAbort} />
127127
)}
128128

129-
{ (!unlockOnly && appStatus === 'restore-mnemonic' && status !== 'initialized') && (
129+
{ (!unlockOnly && setupChoice === 'restore-mnemonic' && status !== 'initialized') && (
130130
<RestoreFromMnemonic
131131
key="restore-mnemonic"
132132
deviceID={deviceID}
133133
onAbort={handleAbort} />
134134
)}
135135

136-
{ (appStatus === 'create-wallet' && status === 'initialized') && (
136+
{ (setupChoice === 'create-wallet' && status === 'initialized') && (
137137
<CreateWalletSuccess
138138
key="success"
139139
backupType={(createOptions?.withMnemonic ? 'mnemonic' : 'sdcard')}
140140
onContinue={handleGetStarted} />
141141
)}
142-
{ (appStatus === 'restore-sdcard' && status === 'initialized') && (
142+
{ (setupChoice === 'restore-sdcard' && status === 'initialized') && (
143143
<RestoreFromSDCardSuccess key="backup-success" onContinue={handleGetStarted} />
144144
)}
145-
{ (appStatus === 'restore-mnemonic' && status === 'initialized') && (
145+
{ (setupChoice === 'restore-mnemonic' && status === 'initialized') && (
146146
<RestoreFromMnemonicSuccess key="backup-mnemonic-success" onContinue={handleGetStarted} />
147147
)}
148148
</Main>

0 commit comments

Comments
 (0)