clear code

This commit is contained in:
Hristo Nedelkov 2024-01-29 18:33:51 +02:00
parent 9ab31b1a57
commit ce9b1ae391

View File

@ -1,7 +1,7 @@
import { Stepper, Step } from 'react-form-stepper'
import { useNavigate } from 'react-router-dom'
import { useDispatch } from 'react-redux'
import { setActiveStep } from '../../../redux/ValidatorOnboarding/slice'
import { FORM_STEPS } from '../../../constants'
import { useWindowSize } from '../../../hooks/useWindowSize'
import './FormStepper.css'
@ -11,7 +11,6 @@ type FormStepperProps = {
}
const FormStepper = ({ activeStep }: FormStepperProps) => {
const dispatch = useDispatch()
const navigate = useNavigate()
const windowSize = useWindowSize()
@ -64,10 +63,13 @@ const FormStepper = ({ activeStep }: FormStepperProps) => {
const changeStepOnClickHandler = (index: number) => {
const path = stepToUrlMap[index]
if (path) {
if (path && index < activeStep) {
navigate(path)
}
}
if (activeStep > 1) {
activeStep = activeStep < 6 ? 2 : activeStep - 3
}
return (
<Stepper