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

feature: Unify Thank you pages in a reusable component #140

Merged
merged 14 commits into from
May 9, 2024

Conversation

LeoBLightIt
Copy link
Contributor

Refactor Thank You pages ⚡⚡⚡

Resolve: closes -86dt88j0r

Description and Requires ⭐

Refactor code for thank you pages unifying in a single Thank You component

Checklist ✅

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@martinopp
Copy link

Task linked: CU-86dt88j0r Refactor Thank You pages

Comment on lines 73 to 76
We received your feedback!
<br />
<br />
Thank you!
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be passed as a children

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using that as a default because it's shared by 2 out of the 3 pages

Comment on lines 55 to 60
useMount(() => {
if (!isProfiling || usePayment) {

mutate({ email: isProfiling ? account.email : email, phase, submission_id })
};
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think instead of this it would be better to use a prop named mutateOnMount, and just do if (mutateOnMount).

Also, we could pass the mutationParams instead of doing this logic here (which is a bit weird because we are passing the phase from the survey store to the profiling mutation).

Copy link

@hyanez-lightit hyanez-lightit left a comment

Choose a reason for hiding this comment

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

Small suggestion

Comment on lines 34 to 36
if (!submission_id) {
navigate(exitRoute);
}

Choose a reason for hiding this comment

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

Another approach to early exit & navigate

Suggested change
if (!submission_id) {
navigate(exitRoute);
}
if (!submission_id) {
return <Navigate to={exitRoute} />
}

</a>{" "}
with a member of our team.
</Typography>
</>}

Choose a reason for hiding this comment

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

Fragment is unnecessary

}: ThankYouProps) => {
const [isLoading, setIsLoading] = useState(mutateOnMount);
const [searchParams] = useSearchParams();
const submission_id = searchParams.get("submission_id") ?? "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think all the submission_id related stuff should be in the parent components, it shouldn't be a responsibility of the ThankYou component.

We should pass it in the mutationKey and mutationParams, and move the navigate to the parent as well.

@LeoBLightIt LeoBLightIt merged commit ef9bab4 into develop May 9, 2024
1 check passed
@LeoBLightIt LeoBLightIt deleted the improvement/CU-86dt88j0r/unify-thankyou-pages branch May 9, 2024 12:44
LeoBLightIt added a commit that referenced this pull request May 9, 2024
LeoBLightIt added a commit that referenced this pull request May 9, 2024
@LeoBLightIt LeoBLightIt restored the improvement/CU-86dt88j0r/unify-thankyou-pages branch May 10, 2024 12:10
@LeoBLightIt LeoBLightIt deleted the improvement/CU-86dt88j0r/unify-thankyou-pages branch May 10, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants