aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/components/GolfPlayApp.client.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-05 05:35:45 +0900
committernsfisis <nsfisis@gmail.com>2024-08-05 05:35:45 +0900
commitb0ff29a3c88bd3014cc966c619683c8d7e33d703 (patch)
tree529f1debc2972ac1486e8c0ca4b25827ccd069a6 /frontend/app/components/GolfPlayApp.client.tsx
parent9ff9c151e5defd9eed5cba3c88bc341b4360d09c (diff)
parentdc16e903999af89d87364ad6619e7c8b41301da4 (diff)
downloadphperkaigi-2025-albatross-b0ff29a3c88bd3014cc966c619683c8d7e33d703.tar.gz
phperkaigi-2025-albatross-b0ff29a3c88bd3014cc966c619683c8d7e33d703.tar.zst
phperkaigi-2025-albatross-b0ff29a3c88bd3014cc966c619683c8d7e33d703.zip
Merge branch 'feat/task-queue'
Diffstat (limited to 'frontend/app/components/GolfPlayApp.client.tsx')
-rw-r--r--frontend/app/components/GolfPlayApp.client.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/frontend/app/components/GolfPlayApp.client.tsx b/frontend/app/components/GolfPlayApp.client.tsx
index 80e7182..911fae0 100644
--- a/frontend/app/components/GolfPlayApp.client.tsx
+++ b/frontend/app/components/GolfPlayApp.client.tsx
@@ -73,6 +73,8 @@ export default function GolfPlayApp({
const [currentScore, setCurrentScore] = useState<number | null>(null);
+ const [lastExecStatus, setLastExecStatus] = useState<string | null>(null);
+
const onCodeChange = useDebouncedCallback((code: string) => {
console.log("player:c2s:code");
sendJsonMessage({
@@ -121,13 +123,14 @@ export default function GolfPlayApp({
setGameState("starting");
}
} else if (lastJsonMessage.type === "player:s2c:execresult") {
- const { score } = lastJsonMessage.data;
+ const { status, score } = lastJsonMessage.data;
if (
score !== null &&
(currentScore === null || score < currentScore)
) {
setCurrentScore(score);
}
+ setLastExecStatus(status);
}
} else {
setGameState("waiting");
@@ -150,6 +153,7 @@ export default function GolfPlayApp({
onCodeChange={onCodeChange}
onCodeSubmit={onCodeSubmit}
currentScore={currentScore}
+ lastExecStatus={lastExecStatus}
/>
);
} else if (gameState === "finished") {