-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new form to save athletes feedback survey and refactor some…
… stuff
- Loading branch information
1 parent
982d37c
commit 1c94c3e
Showing
21 changed files
with
312 additions
and
263 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useEffect } from "react"; | ||
import { useSearchParams } from "react-router-dom"; | ||
|
||
import { ATHLETE_SURVEY_FORM } from "~/configs/env"; | ||
import { jotformScript } from "~/helpers/jotform_script"; | ||
import { LayoutDefault } from "~/layouts"; | ||
|
||
|
||
|
||
|
||
|
||
export const AthleteSurveyForm = () => { | ||
const [searchParams] = useSearchParams(); | ||
|
||
const email = searchParams.get("email") || ""; | ||
const symptoms = searchParams.get("symptoms") || ""; | ||
|
||
useEffect(() => { | ||
jotformScript(ATHLETE_SURVEY_FORM); | ||
}, []); | ||
return ( | ||
<LayoutDefault> | ||
<div className="mb-10 flex h-screen flex-col"> | ||
<iframe | ||
id={`JotFormIFrame-${ATHLETE_SURVEY_FORM}`} | ||
title="" | ||
onLoad={() => window.parent.scrollTo(0, 0)} | ||
allow="geolocation; microphone; camera" | ||
allowTransparency={true} | ||
allowFullScreen={true} | ||
src={`https://form.jotform.com/${ATHLETE_SURVEY_FORM}?email=${email}&symptoms=${symptoms}`} | ||
className="h-full w-full" | ||
style={{ | ||
minWidth: "100%", | ||
height: "539px", | ||
border: "none", | ||
}} | ||
></iframe> | ||
</div> | ||
</LayoutDefault> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { useMutation } from "@tanstack/react-query"; | ||
import axios from "axios"; | ||
import { useNavigate, useSearchParams } from "react-router-dom"; | ||
import { toast } from "react-toastify"; | ||
|
||
import { Typography } from "@eo/ui"; | ||
|
||
import { useApi } from "~/api/useApi"; | ||
import { useMount } from "~/hooks/useMount"; | ||
import { LayoutDefault } from "~/layouts"; | ||
import { ROUTES } from "~/router"; | ||
|
||
|
||
|
||
|
||
|
||
export const AthleteSurveyThankYou = () => { | ||
const [searchParams] = useSearchParams(); | ||
|
||
const submission_id = searchParams.get("submission_id") || ""; | ||
|
||
const navigate = useNavigate(); | ||
|
||
if (!submission_id) { | ||
navigate(ROUTES.cancerProfile); | ||
} | ||
|
||
const { postAthleteSurveyFormSubmission } = useApi(); | ||
|
||
const { mutate } = useMutation({ | ||
mutationFn: postAthleteSurveyFormSubmission, | ||
mutationKey: ["postAthleteSurveyFormSubmission", submission_id], | ||
onError: (result) => { | ||
if (axios.isAxiosError(result)) { | ||
if (result.response?.status !== 200) { | ||
toast.error("Something went wrong"); | ||
} | ||
} else { | ||
toast.error("Something went wrong"); | ||
} | ||
}, | ||
}); | ||
|
||
useMount(() => mutate({ submission_id })); | ||
|
||
return ( | ||
<LayoutDefault> | ||
<div className="flex h-full flex-col items-center justify-center px-[20%]"> | ||
<Typography | ||
variant="large" | ||
className="font-nunito font-bold" | ||
style={{ | ||
fontFamily: "nunito", | ||
lineHeight: "55px", | ||
fontSize: "45px", | ||
}} | ||
> | ||
All done! | ||
</Typography> | ||
<br /> | ||
<Typography | ||
variant="base" | ||
font="regular" | ||
className="text-center font-nunito" | ||
style={{ | ||
fontWeight: "300px", | ||
fontFamily: "nunito", | ||
lineHeight: "40px", | ||
fontSize: "28px", | ||
}} | ||
> | ||
We receive your feedback! <br /> | ||
<br /> | ||
Thank you! <br /> | ||
<br /> | ||
Have questions? We’re here. Email [email protected], call{" "} | ||
<a href="tel:+1-877-707-0706">877-707-0706</a>, or schedule a free | ||
consultation. | ||
</Typography> | ||
</div> | ||
</LayoutDefault> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.