From a406e0d14a93fdb68385155cc84b2e38a27cf20b Mon Sep 17 00:00:00 2001 From: Hristo Nedelkov Date: Tue, 13 Feb 2024 13:12:58 +0200 Subject: [PATCH] fix(continue button): add logic for confirm phrase back button --- .../ValidatorOnboarding/ContinueButton.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/pages/ValidatorOnboarding/ContinueButton.tsx b/src/pages/ValidatorOnboarding/ContinueButton.tsx index 782611ad..a5904f4c 100644 --- a/src/pages/ValidatorOnboarding/ContinueButton.tsx +++ b/src/pages/ValidatorOnboarding/ContinueButton.tsx @@ -7,7 +7,7 @@ import { useNavigate } from 'react-router-dom' import { RootState } from '../../redux/store' import LinkWithArrow from '../../components/General/LinkWithArrow' import { setActiveStep } from '../../redux/ValidatorOnboarding/slice' -import { KEYSTORE_FILES, STEPPER_PATHS } from '../../constants' +import { FORM_STEPS, KEYSTORE_FILES, STEPPER_PATHS } from '../../constants' import { setIsConfirmPhraseStage, setIsCopyPastedPhrase, @@ -46,11 +46,13 @@ const ContinueButton = () => { '/validator-onboarding/deposit': 8, '/validator-onboarding/activation': 9, } - dispatch( - setActiveStep( - pathToStepMap[location.pathname as keyof typeof pathToStepMap] || 0, - ), - ) + const handleActiveStep = () => { + if (location.pathname === '/validator-onboarding/recovery-phrase') { + return 7 + } + return pathToStepMap[location.pathname as keyof typeof pathToStepMap] || 0 + } + dispatch(setActiveStep(handleActiveStep())) const { isValidatorSet } = useSelector( (state: RootState) => state.validatorSetup, @@ -109,12 +111,13 @@ const ContinueButton = () => { } const continueHandler = () => { - let nextPath = STEPPER_PATHS[activeStep] || '/validator-onboarding/' + let nextPath = STEPPER_PATHS[activeStep + 1] || '' if (activeStep === 7) { nextPath = isConfirmPhraseStage ? '/validator-onboarding/deposit' - : '/validator-onboarding/key-generation' + : '/validator-onboarding/recovery-phrase' + handleRecoveryMechanism() } @@ -136,7 +139,7 @@ const ContinueButton = () => { }} > {windowSize.width >= 1155 && } - + {isActivationValScreen && ( { /> )}