Add advisories logic into continue button
This commit is contained in:
parent
3b2caa55cf
commit
436787702a
|
@ -1,7 +1,7 @@
|
||||||
import { Stack, XStack } from 'tamagui'
|
import { Stack, XStack } from 'tamagui'
|
||||||
import { Button, InformationBox } from '@status-im/components'
|
import { Button, InformationBox } from '@status-im/components'
|
||||||
import { CloseCircleIcon } from '@status-im/icons'
|
import { CloseCircleIcon } from '@status-im/icons'
|
||||||
import { useSelector } from 'react-redux'
|
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
@ -15,6 +15,7 @@ import {
|
||||||
setIsCopyPastedPhrase,
|
setIsCopyPastedPhrase,
|
||||||
setValidWords,
|
setValidWords,
|
||||||
} from '../../redux/ValidatorOnboarding/KeyGeneration/slice'
|
} from '../../redux/ValidatorOnboarding/KeyGeneration/slice'
|
||||||
|
import { setSubStepAdvisories, setIsAdvisoriesComplete } from '../../redux/ValidatorOnboarding/Advisories/slice'
|
||||||
|
|
||||||
const ContinueButton = () => {
|
const ContinueButton = () => {
|
||||||
const [isDisabled, setIsDisabled] = useState(false)
|
const [isDisabled, setIsDisabled] = useState(false)
|
||||||
|
@ -26,9 +27,14 @@ const ContinueButton = () => {
|
||||||
recoveryMechanism,
|
recoveryMechanism,
|
||||||
generatedMnemonic,
|
generatedMnemonic,
|
||||||
} = useSelector((state: RootState) => state.keyGeneration)
|
} = useSelector((state: RootState) => state.keyGeneration)
|
||||||
|
|
||||||
const { activeStep, subStepValidatorSetup } = useSelector(
|
const { activeStep, subStepValidatorSetup } = useSelector(
|
||||||
(state: RootState) => state.validatorOnboarding,
|
(state: RootState) => state.validatorOnboarding,
|
||||||
)
|
)
|
||||||
|
const { subStepAdvisories, isAdvisoriesComplete, isValidatorSet } = useSelector(
|
||||||
|
(state: RootState) => state.advisories,
|
||||||
|
)
|
||||||
|
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const isActivationValScreen = activeStep === 3 && subStepValidatorSetup === 3
|
const isActivationValScreen = activeStep === 3 && subStepValidatorSetup === 3
|
||||||
|
@ -76,13 +82,22 @@ const ContinueButton = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const continueHandler = () => {
|
const continueHandler = () => {
|
||||||
if (activeStep === 3) {
|
if (activeStep === 1) {
|
||||||
|
if (activeStep === 1 && isAdvisoriesComplete === false) {
|
||||||
|
if (subStepAdvisories === 5) {
|
||||||
|
dispatch(setIsAdvisoriesComplete(true))
|
||||||
|
dispatch(setActiveStep(activeStep + 1))
|
||||||
|
dispatch(setSubStepAdvisories(0))
|
||||||
|
}
|
||||||
|
return setSubStepAdvisories(subStepAdvisories + 1)
|
||||||
|
}
|
||||||
|
} else if (activeStep === 3) {
|
||||||
handleStep3()
|
handleStep3()
|
||||||
} else if (activeStep === 4) {
|
} else if (activeStep === 4) {
|
||||||
handleStep4()
|
handleStep4()
|
||||||
} else {
|
} else {
|
||||||
if (activeStep < 5) {
|
if (activeStep < 5) {
|
||||||
setActiveStep(activeStep + 1)
|
dispatch(setActiveStep(activeStep + 1))
|
||||||
} else {
|
} else {
|
||||||
navigate('/')
|
navigate('/')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue