diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-12 02:08:55 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-12 02:10:36 +0900 |
| commit | 699c5ce665bae6bcc406a0f7de994bb218a9977e (patch) | |
| tree | a1c97c6e9f123bffbc5836a9a603352a0fb426aa /frontend/app/components/GolfWatchApp.client.tsx | |
| parent | 9f022ce7e59213284896a07a53bfef232a6e62d3 (diff) | |
| download | iosdc-japan-2025-albatross-699c5ce665bae6bcc406a0f7de994bb218a9977e.tar.gz iosdc-japan-2025-albatross-699c5ce665bae6bcc406a0f7de994bb218a9977e.tar.zst iosdc-japan-2025-albatross-699c5ce665bae6bcc406a0f7de994bb218a9977e.zip | |
feat(frontend): show submission result at first rendering
Diffstat (limited to 'frontend/app/components/GolfWatchApp.client.tsx')
| -rw-r--r-- | frontend/app/components/GolfWatchApp.client.tsx | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/frontend/app/components/GolfWatchApp.client.tsx b/frontend/app/components/GolfWatchApp.client.tsx index 481b997..7f582c9 100644 --- a/frontend/app/components/GolfWatchApp.client.tsx +++ b/frontend/app/components/GolfWatchApp.client.tsx @@ -78,14 +78,32 @@ export default function GolfWatchApp({ iconPath: playerA?.icon_path ?? null, score: null, code: "", - submitResult: undefined, + submitResult: { + status: "waiting_submission", + execResults: game.exec_steps.map((r) => ({ + testcase_id: r.testcase_id, + status: "waiting_submission", + label: r.label, + stdout: "", + stderr: "", + })), + }, }); const [playerInfoB, setPlayerInfoB] = useState<PlayerInfo>({ displayName: playerB?.display_name ?? null, iconPath: playerB?.icon_path ?? null, score: null, code: "", - submitResult: undefined, + submitResult: { + status: "waiting_submission", + execResults: game.exec_steps.map((r) => ({ + testcase_id: r.testcase_id, + status: "waiting_submission", + label: r.label, + stdout: "", + stderr: "", + })), + }, }); if (readyState === ReadyState.UNINSTANTIATED) { @@ -127,10 +145,9 @@ export default function GolfWatchApp({ ...prev, submitResult: { status: "running", - execResults: game.exec_steps.map((r) => ({ - testcase_id: r.testcase_id, + execResults: prev.submitResult.execResults.map((r) => ({ + ...r, status: "running", - label: r.label, stdout: "", stderr: "", })), @@ -143,9 +160,6 @@ export default function GolfWatchApp({ player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB; setter((prev) => { const ret = { ...prev }; - if (ret.submitResult === undefined) { - return ret; - } ret.submitResult = { ...ret.submitResult, execResults: ret.submitResult.execResults.map((r) => @@ -167,9 +181,6 @@ export default function GolfWatchApp({ player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB; setter((prev) => { const ret = { ...prev }; - if (ret.submitResult === undefined) { - return ret; - } ret.submitResult = { ...ret.submitResult, status, @@ -217,7 +228,6 @@ export default function GolfWatchApp({ } } }, [ - game.exec_steps, game.started_at, lastJsonMessage, readyState, |
