improve code

This commit is contained in:
Hristo Nedelkov 2023-10-06 13:54:36 +03:00
parent 2523319f69
commit 456887fc80
1 changed files with 3 additions and 11 deletions

View File

@ -37,21 +37,12 @@ const ValidatorOnboarding = () => {
const [isAdvisoriesComplete, setIsAdvisoriesComplete] = useState(false) const [isAdvisoriesComplete, setIsAdvisoriesComplete] = useState(false)
const unicodeNumbers = ['➀', '➁', '➂', '➃', '➄', '➅'] const unicodeNumbers = ['➀', '➁', '➂', '➃', '➄', '➅']
const advisoriesIcon = unicodeNumbers.map((number, index) => { const advisoriesIcon = unicodeNumbers.map((number, index) => index <= subStepAdvisories ? '✓' : number)
if (index <= subStepAdvisories) {
return '✓';
} else {
return number;
}
})
const changeActiveStep = (step: number) => { const changeActiveStep = (step: number) => {
if (step < activeStep) { if (step < activeStep) {
return setActiveStep(step) return setActiveStep(step)
} }
removeCopyPastePhraseInfoBox() removeCopyPastePhraseInfoBox()
removeConfirmPhraseStage() removeConfirmPhraseStage()
} }
@ -61,6 +52,7 @@ const ValidatorOnboarding = () => {
if (subStepAdvisories === 5) { if (subStepAdvisories === 5) {
setIsAdvisoriesComplete(true) setIsAdvisoriesComplete(true)
setActiveStep(activeStep + 1) setActiveStep(activeStep + 1)
setSubStepAdvisories(0)
} }
return setSubStepAdvisories(subStepAdvisories + 1) return setSubStepAdvisories(subStepAdvisories + 1)
} else if (activeStep === 4 && isConfirmPhraseStage === false) { } else if (activeStep === 4 && isConfirmPhraseStage === false) {
@ -120,7 +112,7 @@ const ValidatorOnboarding = () => {
<FormStepper activeStep={activeStep} changeActiveStep={changeActiveStep} /> <FormStepper activeStep={activeStep} changeActiveStep={changeActiveStep} />
<ValidatorBoxWrapper> <ValidatorBoxWrapper>
{activeStep === 0 && <Overview />} {activeStep === 0 && <Overview />}
{activeStep === 1 && <Advisories advisoriesIcons={advisoriesIcon} subStepAdvisories={subStepAdvisories}/>} {activeStep === 1 && <Advisories advisoriesIcons={advisoriesIcon} subStepAdvisories={subStepAdvisories} />}
{activeStep === 2 && <ClientSetup />} {activeStep === 2 && <ClientSetup />}
{activeStep === 3 && subStepValidatorSetup === 0 && <ValidatorSetup />} {activeStep === 3 && subStepValidatorSetup === 0 && <ValidatorSetup />}