diff options
Diffstat (limited to 'frontend/app/components')
| -rw-r--r-- | frontend/app/components/ExecStatusIndicatorIcon.tsx | 4 | ||||
| -rw-r--r-- | frontend/app/components/GolfWatchApp.client.tsx | 51 | ||||
| -rw-r--r-- | frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx | 62 |
3 files changed, 56 insertions, 61 deletions
diff --git a/frontend/app/components/ExecStatusIndicatorIcon.tsx b/frontend/app/components/ExecStatusIndicatorIcon.tsx index c5b37f8..b5c53ec 100644 --- a/frontend/app/components/ExecStatusIndicatorIcon.tsx +++ b/frontend/app/components/ExecStatusIndicatorIcon.tsx @@ -5,10 +5,10 @@ import { faRotate, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { VerificationResultStatus } from "../models/VerificationResult"; +import { ExecResultStatus } from "../models/ExecResult"; type Props = { - status: VerificationResultStatus; + status: ExecResultStatus; }; export default function ExecStatusIndicatorIcon({ status }: Props) { diff --git a/frontend/app/components/GolfWatchApp.client.tsx b/frontend/app/components/GolfWatchApp.client.tsx index 3f97d2a..7041572 100644 --- a/frontend/app/components/GolfWatchApp.client.tsx +++ b/frontend/app/components/GolfWatchApp.client.tsx @@ -78,14 +78,14 @@ export default function GolfWatchApp({ iconPath: playerA?.icon_path ?? null, score: null, code: "", - submissionResult: undefined, + submitResult: undefined, }); const [playerInfoB, setPlayerInfoB] = useState<PlayerInfo>({ displayName: playerB?.display_name ?? null, iconPath: playerB?.icon_path ?? null, score: null, code: "", - submissionResult: undefined, + submitResult: undefined, }); if (readyState === ReadyState.UNINSTANTIATED) { @@ -125,12 +125,12 @@ export default function GolfWatchApp({ player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB; setter((prev) => ({ ...prev, - submissionResult: { + submitResult: { status: "running", - verificationResults: game.verification_steps.map((v) => ({ - testcase_id: v.testcase_id, + execResults: game.verification_steps.map((r) => ({ + testcase_id: r.testcase_id, status: "running", - label: v.label, + label: r.label, stdout: "", stderr: "", })), @@ -143,21 +143,20 @@ export default function GolfWatchApp({ player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB; setter((prev) => { const ret = { ...prev }; - if (ret.submissionResult === undefined) { + if (ret.submitResult === undefined) { return ret; } - ret.submissionResult = { - ...ret.submissionResult, - verificationResults: ret.submissionResult.verificationResults.map( - (v) => - v.testcase_id === testcase_id && v.status === "running" - ? { - ...v, - status, - stdout, - stderr, - } - : v, + ret.submitResult = { + ...ret.submitResult, + execResults: ret.submitResult.execResults.map((r) => + r.testcase_id === testcase_id && r.status === "running" + ? { + ...r, + status, + stdout, + stderr, + } + : r, ), }; return ret; @@ -168,11 +167,11 @@ export default function GolfWatchApp({ player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB; setter((prev) => { const ret = { ...prev }; - if (ret.submissionResult === undefined) { + if (ret.submitResult === undefined) { return ret; } - ret.submissionResult = { - ...ret.submissionResult, + ret.submitResult = { + ...ret.submitResult, status, }; if (status === "success") { @@ -182,10 +181,10 @@ export default function GolfWatchApp({ } } } else { - ret.submissionResult.verificationResults = - ret.submissionResult.verificationResults.map((v) => - v.status === "running" ? { ...v, status: "canceled" } : v, - ); + ret.submitResult.execResults = ret.submitResult.execResults.map( + (r) => + r.status === "running" ? { ...r, status: "canceled" } : r, + ); } return ret; }); diff --git a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx index 5ca778b..bdd1ac3 100644 --- a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx +++ b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx @@ -1,5 +1,5 @@ import { PlayerInfo } from "../../models/PlayerInfo"; -import { submissionResultStatusToLabel } from "../../models/SubmissionResult"; +import { submitResultStatusToLabel } from "../../models/SubmitResult"; import ExecStatusIndicatorIcon from "../ExecStatusIndicatorIcon"; type Props = { @@ -60,28 +60,26 @@ export default function GolfWatchAppGaming({ </div> <div> <div> - {submissionResultStatusToLabel( - playerInfoA.submissionResult?.status ?? null, + {submitResultStatusToLabel( + playerInfoA.submitResult?.status ?? null, )} </div> <div> <ol> - {playerInfoA.submissionResult?.verificationResults.map( - (result) => ( - <li key={result.testcase_id ?? -1}> + {playerInfoA.submitResult?.execResults.map((result) => ( + <li key={result.testcase_id ?? -1}> + <div> <div> - <div> - <ExecStatusIndicatorIcon status={result.status} />{" "} - {result.label} - </div> - <div> - {result.stdout} - {result.stderr} - </div> + <ExecStatusIndicatorIcon status={result.status} />{" "} + {result.label} </div> - </li> - ), - )} + <div> + {result.stdout} + {result.stderr} + </div> + </div> + </li> + ))} </ol> </div> </div> @@ -92,28 +90,26 @@ export default function GolfWatchAppGaming({ </div> <div> <div> - {submissionResultStatusToLabel( - playerInfoB.submissionResult?.status ?? null, + {submitResultStatusToLabel( + playerInfoB.submitResult?.status ?? null, )} </div> <div> <ol> - {playerInfoB.submissionResult?.verificationResults.map( - (result, idx) => ( - <li key={idx}> + {playerInfoB.submitResult?.execResults.map((result, idx) => ( + <li key={idx}> + <div> + <div> + <ExecStatusIndicatorIcon status={result.status} />{" "} + {result.label} + </div> <div> - <div> - <ExecStatusIndicatorIcon status={result.status} />{" "} - {result.label} - </div> - <div> - {result.stdout} - {result.stderr} - </div> + {result.stdout} + {result.stderr} </div> - </li> - ), - )} + </div> + </li> + ))} </ol> </div> </div> |
