From ed201936813d9a720b51e6cb40a05267b94e7314 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Thu, 10 Sep 2026 17:46:41 -0700 Subject: Typescript prettier Committing seperate so it's easier to see actual changes. --- jb-ui/src/pages/Result.tsx | 206 ++++++++++++++++++++++++--------------------- 1 file changed, 108 insertions(+), 98 deletions(-) (limited to 'jb-ui/src/pages/Result.tsx') diff --git a/jb-ui/src/pages/Result.tsx b/jb-ui/src/pages/Result.tsx index 47af248..477f77e 100644 --- a/jb-ui/src/pages/Result.tsx +++ b/jb-ui/src/pages/Result.tsx @@ -10,114 +10,124 @@ import { useEffect } from "react"; // } export const Complete = () => { - const ts = useAppSelector(state => state.app.taskStatus) - - return ( - <> -
Congratulations! You completed the Survey.
-{ts?.user_payout_string}
-You may close this tab and return to submit the HIT
- > - ) -} + const ts = useAppSelector((state) => state.app.taskStatus); + + return ( + <> ++ Congratulations! You completed the Survey. +
++ {ts?.user_payout_string} +
++ You may close this tab and return to submit the HIT +
+ > + ); +}; export const Enter = () => { - return ( - <> -You're currently in the Survey
-You may close this tab and return to submit the HIT
- > - ) -} + return ( + <> ++ You're currently in the Survey +
++ You may close this tab and return to submit the HIT +
+ > + ); +}; export const InComplete = () => { - const ts = useAppSelector(state => state.app.taskStatus) - if (!ts) { return null; } - - return ( - <> -Survey terminated the attempt.
-You may close this tab and return to submit the HIT
- > - - ) -} + const ts = useAppSelector((state) => state.app.taskStatus); + if (!ts) { + return null; + } + + return ( + <> ++ Survey terminated the attempt. +
++ You may close this tab and return to submit the HIT +
+ > + ); +}; export const Unknown = () => { - - return ( - <> -You're not currently eligible for any Surveys
-You may close this tab and return to submit the HIT
- > - ) -} + return ( + <> ++ You're not currently eligible for any Surveys +
++ You may close this tab and return to submit the HIT +
+ > + ); +}; export const Loading = () => { - - return ( -Loading...
- ) -} - + returnLoading...
; +}; 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