aboutsummaryrefslogtreecommitdiff
path: root/jb-ui/src/pages/Result.tsx
diff options
context:
space:
mode:
authorMax Nanis2026-09-13 19:03:55 +0000
committerMax Nanis2026-09-13 19:03:55 +0000
commit8fbe8d439b418796932aaa88297e006c714e4d13 (patch)
tree6c800476edc1e771fc570b559d483df8d59d4324 /jb-ui/src/pages/Result.tsx
parent12f6fee851b68e86af658dfa17e4a0daed457dd1 (diff)
parent2c94f248d2438071a918fa9a30bf114ef9aa29b4 (diff)
downloadamt-jb-8fbe8d439b418796932aaa88297e006c714e4d13.tar.gz
amt-jb-8fbe8d439b418796932aaa88297e006c714e4d13.zip
Merges pull request #3
Off of Amazon!!!
Diffstat (limited to 'jb-ui/src/pages/Result.tsx')
-rw-r--r--jb-ui/src/pages/Result.tsx198
1 files changed, 100 insertions, 98 deletions
diff --git a/jb-ui/src/pages/Result.tsx b/jb-ui/src/pages/Result.tsx
index 47af248..6385bc7 100644
--- a/jb-ui/src/pages/Result.tsx
+++ b/jb-ui/src/pages/Result.tsx
@@ -10,114 +10,116 @@ import { useEffect } from "react";
// }
export const Complete = () => {
- const ts = useAppSelector(state => state.app.taskStatus)
-
- return (
- <>
- <h2 className="text-lg">Survey Completed</h2>
- <p className="text-emerald-700 text-lg font-bold">Congratulations! You completed the Survey.</p>
- <p className="text-emerald-700 text-2xl font-bold">{ts?.user_payout_string}</p>
- <p className="text-slate-300">You may close this tab and return to submit the HIT</p>
- </>
- )
-}
+ const ts = useAppSelector((state) => state.app.taskStatus);
+
+ return (
+ <>
+ <h2 className="text-lg">Survey Completed</h2>
+ <p className="text-emerald-700 text-lg font-bold">
+ Congratulations! You completed the Survey.
+ </p>
+ <p className="text-emerald-700 text-2xl font-bold">
+ {ts?.user_payout_string}
+ </p>
+ <p className="text-slate-300">You may close this tab</p>
+ </>
+ );
+};
export const Enter = () => {
- return (
- <>
- <h2 className="text-lg">Entered</h2>
- <p className="text-slate-800 text-lg font-bold">You're currently in the Survey</p>
- <p className="text-slate-300">You may close this tab and return to submit the HIT</p>
- </>
- )
-}
+ return (
+ <>
+ <h2 className="text-lg">Entered</h2>
+ <p className="text-slate-800 text-lg font-bold">
+ You're currently in the Survey
+ </p>
+ <p className="text-slate-300">You may close this tab</p>
+ </>
+ );
+};
export const InComplete = () => {
- const ts = useAppSelector(state => state.app.taskStatus)
- if (!ts) { return null; }
-
- return (
- <>
- <h2 className="text-lg">HIT Complete</h2>
- <p className="text-rose-800 text-lg font-bold">Survey terminated the attempt.</p>
- <p className="text-slate-300">You may close this tab and return to submit the HIT</p>
- </>
-
- )
-}
+ const ts = useAppSelector((state) => state.app.taskStatus);
+ if (!ts) {
+ return null;
+ }
+
+ return (
+ <>
+ <h2 className="text-lg">Attempt Complete</h2>
+ <p className="text-rose-800 text-lg font-bold">
+ Survey terminated the attempt.
+ </p>
+ <p className="text-slate-300">You may close this tab</p>
+ </>
+ );
+};
export const Unknown = () => {
-
- return (
- <>
- <h2 className="text-lg">Task Issue</h2>
- <p className="text-rose-800 text-lg font-bold">You're not currently eligible for any Surveys</p>
- <p className="text-slate-300">You may close this tab and return to submit the HIT</p>
- </>
- )
-}
+ return (
+ <>
+ <h2 className="text-lg">Task Issue</h2>
+ <p className="text-rose-800 text-lg font-bold">
+ You're not currently eligible for any Surveys
+ </p>
+ <p className="text-slate-300">You may close this tab</p>
+ </>
+ );
+};
export const Loading = () => {
-
- return (
- <p className="text-2xl font-semibold">Loading...</p>
- )
-}
-
+ return <p className="text-2xl font-semibold">Loading...</p>;
+};
const Result = () => {
-
- const ts = useAppSelector(state => state.app.taskStatus)
-
- const confettiCannons = () => {
- const end = Date.now() + 3 * 1000
- const colors = ["#84cc16", "#1e3a8a", "#ec4899"]
- const frame = () => {
- if (Date.now() > end) return
- confetti({
- particleCount: 3,
- angle: 60,
- spread: 55,
- startVelocity: 80,
- gravity: 0.7,
- origin: { x: 0, y: 0.8 },
- colors: colors,
- })
- confetti({
- particleCount: 3,
- angle: 120,
- spread: 55,
- startVelocity: 80,
- gravity: 0.7,
- origin: { x: 1, y: 0.8 },
- colors: colors,
- })
- requestAnimationFrame(frame)
- }
- frame()
+ const ts = useAppSelector((state) => state.app.taskStatus);
+
+ const confettiCannons = () => {
+ const end = Date.now() + 3 * 1000;
+ const colors = ["#84cc16", "#1e3a8a", "#ec4899"];
+ const frame = () => {
+ if (Date.now() > end) return;
+ confetti({
+ particleCount: 3,
+ angle: 60,
+ spread: 55,
+ startVelocity: 80,
+ gravity: 0.7,
+ origin: { x: 0, y: 0.8 },
+ colors: colors,
+ });
+ confetti({
+ particleCount: 3,
+ angle: 120,
+ spread: 55,
+ startVelocity: 80,
+ gravity: 0.7,
+ origin: { x: 1, y: 0.8 },
+ colors: colors,
+ });
+ requestAnimationFrame(frame);
+ };
+ frame();
+ };
+
+ useEffect(() => {
+ if (ts?.status === 3) {
+ confettiCannons();
}
-
- useEffect(() => {
- if (ts?.status === 3) {
- confettiCannons()
- }
- }, [ts])
-
-
- switch (ts?.status) {
- case 0: // UNKNOWN
- return <Unknown />;
- case 1: // ENTER
- return <Enter />;
- case 2: // INCOMPLETE
- return <InComplete />;
- case 3: // COMPLETE
- return <Complete />;
- default:
- return <Loading />;
- }
-
+ }, [ts]);
+
+ switch (ts?.status) {
+ case 0: // UNKNOWN
+ return <Unknown />;
+ case 1: // ENTER
+ return <Enter />;
+ case 2: // INCOMPLETE
+ return <InComplete />;
+ case 3: // COMPLETE
+ return <Complete />;
+ default:
+ return <Loading />;
+ }
};
-
-export default Result; \ No newline at end of file
+export default Result;