From c1c6cb24617ac0d90bd142c40ab9aa39cab577d3 Mon Sep 17 00:00:00 2001 From: thisconnect Date: Tue, 9 Dec 2025 17:22:01 +0100 Subject: [PATCH] frontend: rename internal state used for setup choices A small left over from earlier refactorings, this component ended up with state and appState. Where as appState is the setup choice the user picked. Changed to a more descriptive name for this state. --- .../web/src/routes/device/bitbox02/wizard.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/frontends/web/src/routes/device/bitbox02/wizard.tsx b/frontends/web/src/routes/device/bitbox02/wizard.tsx index 3215dab080..4df0db5a01 100644 --- a/frontends/web/src/routes/device/bitbox02/wizard.tsx +++ b/frontends/web/src/routes/device/bitbox02/wizard.tsx @@ -41,7 +41,7 @@ export const Wizard = ({ deviceID }: TProps) => { verifyAttestation(deviceID).then(cb); }) ); - const [appStatus, setAppStatus] = useState<'' | TWalletSetupChoices>(''); + const [setupChoice, setSetupChoice] = useState<'' | TWalletSetupChoices>(''); const [createOptions, setCreateOptions] = useState(); const [showWizard, setShowWizard] = useState(false); // If true, we just pair and unlock, so we can hide some steps. @@ -68,7 +68,7 @@ export const Wizard = ({ deviceID }: TProps) => { }, [status, showWizard, unlockOnly]); const handleAbort = () => { - setAppStatus(''); + setSetupChoice(''); setCreateOptions(undefined); }; if (status === undefined) { @@ -91,7 +91,7 @@ export const Wizard = ({ deviceID }: TProps) => { return null; } // fixes empty main element, happens when after unlocking the device, reason wizard is now always mounted in app.tsx - if (appStatus === '' && status === 'initialized') { + if (setupChoice === '' && status === 'initialized') { return null; } return ( @@ -110,7 +110,7 @@ export const Wizard = ({ deviceID }: TProps) => { pairingFailed={status === 'pairingFailed'} /> )} - { (!unlockOnly && appStatus === '') && ( + { (!unlockOnly && setupChoice === '') && ( { type: TWalletSetupChoices, createOptions?: TWalletCreateOptions, ) => { - setAppStatus(type); + setSetupChoice(type); setCreateOptions(createOptions); }} /> )} - { (!unlockOnly && appStatus === 'create-wallet') && ( + { (!unlockOnly && setupChoice === 'create-wallet') && ( { )} {/* keeping the backups mounted even restoreBackupStatus === 'restore' is not true so it catches potential errors */} - { (!unlockOnly && appStatus === 'restore-sdcard' && status !== 'initialized') && ( + { (!unlockOnly && setupChoice === 'restore-sdcard' && status !== 'initialized') && ( )} - { (!unlockOnly && appStatus === 'restore-mnemonic' && status !== 'initialized') && ( + { (!unlockOnly && setupChoice === 'restore-mnemonic' && status !== 'initialized') && ( )} - { (appStatus === 'create-wallet' && status === 'initialized') && ( + { (setupChoice === 'create-wallet' && status === 'initialized') && ( )} - { (appStatus === 'restore-sdcard' && status === 'initialized') && ( + { (setupChoice === 'restore-sdcard' && status === 'initialized') && ( )} - { (appStatus === 'restore-mnemonic' && status === 'initialized') && ( + { (setupChoice === 'restore-mnemonic' && status === 'initialized') && ( )}