fix(continue button): add logic for confirm phrase back button
This commit is contained in:
parent
bcc3fd86ff
commit
a406e0d14a
|
@ -7,7 +7,7 @@ import { useNavigate } from 'react-router-dom'
|
||||||
import { RootState } from '../../redux/store'
|
import { RootState } from '../../redux/store'
|
||||||
import LinkWithArrow from '../../components/General/LinkWithArrow'
|
import LinkWithArrow from '../../components/General/LinkWithArrow'
|
||||||
import { setActiveStep } from '../../redux/ValidatorOnboarding/slice'
|
import { setActiveStep } from '../../redux/ValidatorOnboarding/slice'
|
||||||
import { KEYSTORE_FILES, STEPPER_PATHS } from '../../constants'
|
import { FORM_STEPS, KEYSTORE_FILES, STEPPER_PATHS } from '../../constants'
|
||||||
import {
|
import {
|
||||||
setIsConfirmPhraseStage,
|
setIsConfirmPhraseStage,
|
||||||
setIsCopyPastedPhrase,
|
setIsCopyPastedPhrase,
|
||||||
|
@ -46,11 +46,13 @@ const ContinueButton = () => {
|
||||||
'/validator-onboarding/deposit': 8,
|
'/validator-onboarding/deposit': 8,
|
||||||
'/validator-onboarding/activation': 9,
|
'/validator-onboarding/activation': 9,
|
||||||
}
|
}
|
||||||
dispatch(
|
const handleActiveStep = () => {
|
||||||
setActiveStep(
|
if (location.pathname === '/validator-onboarding/recovery-phrase') {
|
||||||
pathToStepMap[location.pathname as keyof typeof pathToStepMap] || 0,
|
return 7
|
||||||
),
|
}
|
||||||
)
|
return pathToStepMap[location.pathname as keyof typeof pathToStepMap] || 0
|
||||||
|
}
|
||||||
|
dispatch(setActiveStep(handleActiveStep()))
|
||||||
|
|
||||||
const { isValidatorSet } = useSelector(
|
const { isValidatorSet } = useSelector(
|
||||||
(state: RootState) => state.validatorSetup,
|
(state: RootState) => state.validatorSetup,
|
||||||
|
@ -109,12 +111,13 @@ const ContinueButton = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const continueHandler = () => {
|
const continueHandler = () => {
|
||||||
let nextPath = STEPPER_PATHS[activeStep] || '/validator-onboarding/'
|
let nextPath = STEPPER_PATHS[activeStep + 1] || ''
|
||||||
|
|
||||||
if (activeStep === 7) {
|
if (activeStep === 7) {
|
||||||
nextPath = isConfirmPhraseStage
|
nextPath = isConfirmPhraseStage
|
||||||
? '/validator-onboarding/deposit'
|
? '/validator-onboarding/deposit'
|
||||||
: '/validator-onboarding/key-generation'
|
: '/validator-onboarding/recovery-phrase'
|
||||||
|
|
||||||
handleRecoveryMechanism()
|
handleRecoveryMechanism()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +139,7 @@ const ContinueButton = () => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{windowSize.width >= 1155 && <CopyPastedRecoveryPhrase />}
|
{windowSize.width >= 1155 && <CopyPastedRecoveryPhrase />}
|
||||||
<BackButton prevPageIndex={activeStep}></BackButton>
|
<BackButton></BackButton>
|
||||||
{isActivationValScreen && (
|
{isActivationValScreen && (
|
||||||
<LinkWithArrow
|
<LinkWithArrow
|
||||||
text="Skip to Dashboard"
|
text="Skip to Dashboard"
|
||||||
|
@ -146,7 +149,7 @@ const ContinueButton = () => {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Button onPress={continueHandler} size={40} disabled={isDisabled}>
|
<Button onPress={continueHandler} size={40} disabled={isDisabled}>
|
||||||
{activeStep < 6 ? 'Continue' : 'Continue to Dashboard'}
|
{'Continue'}
|
||||||
</Button>
|
</Button>
|
||||||
</XStack>
|
</XStack>
|
||||||
</YStack>
|
</YStack>
|
||||||
|
|
Loading…
Reference in New Issue