Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set review stepper state to complete after user submits registration #1162

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion web/gds-user-ui/src/components/ReviewSubmit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import useCertificateStepper from 'hooks/useCertificateStepper';
import { STEPPER_NETWORK } from 'utils/constants';

import WarningBox from 'components/WarningBox';
import { setHasReachSubmitStep } from 'application/store/stepper.slice';
import { setHasReachSubmitStep, setStepStatus } from 'application/store/stepper.slice';
import { useAppDispatch } from 'application/store';
import { StepsIndexes } from 'constants/steps';
import { useFetchCertificateStep } from 'hooks/useFetchCertificateStep';
import { StepEnum } from 'types/enums';
import useSubmissionStatus from 'modules/dashboard/registration/hooks/useSubmissionStatus';
import { LSTATUS } from 'components/RegistrationForm/CertificateStepLabel';

interface ReviewSubmitProps {
onSubmitHandler: (e: React.FormEvent, network: string) => void;
Expand Down Expand Up @@ -71,6 +72,11 @@ const ReviewSubmit: React.FC<ReviewSubmitProps> = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isSent]);

// Update the review step status to complete if the user submits a registration.
if (isTestNetSubmitted || isMainNetSubmitted) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stepper label color doesn't immediately update after the registration is submitted. To fix this, I think react-query will have to be used which would require some refactoring that should be handled in a separate story.

dispatch(setStepStatus({ step: 6, status: LSTATUS.COMPLETE }));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the significance of the 6? Is it the step number?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 6 is the review step number. There are constants for steps 1-5. I was unable to determine why 6 was excluded, since 6 is listed as a step number a few times in the code. However, I did notice some cases where the constants weren't used for other step numbers, so a story updating this should be added.

}

const handleJumpToTrisaImplementationStep = () => {
dispatch(setHasReachSubmitStep({ hasReachSubmitStep: false }));
jumpToStep(StepsIndexes.TRISA_IMPLEMENTATION);
Expand Down
Loading