aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-18 12:36:47 +0900
committernsfisis <nsfisis@gmail.com>2024-08-18 13:12:34 +0900
commit67c7233b20263650f4956b43d8935303bb285cd8 (patch)
tree743fb16604410035b7d3e16f503e19bdb3745c30
parentc337d3066797050605b2e4e9c181c689f61d7482 (diff)
downloadiosdc-japan-2025-albatross-67c7233b20263650f4956b43d8935303bb285cd8.tar.gz
iosdc-japan-2025-albatross-67c7233b20263650f4956b43d8935303bb285cd8.tar.zst
iosdc-japan-2025-albatross-67c7233b20263650f4956b43d8935303bb285cd8.zip
feat(frontend): do not transit to finished screen in watch page
-rw-r--r--frontend/app/components/GolfWatchApp.client.tsx5
-rw-r--r--frontend/app/components/GolfWatchApps/GolfWatchAppFinished.tsx9
-rw-r--r--frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx3
3 files changed, 4 insertions, 13 deletions
diff --git a/frontend/app/components/GolfWatchApp.client.tsx b/frontend/app/components/GolfWatchApp.client.tsx
index 7eb20cf..9a641f0 100644
--- a/frontend/app/components/GolfWatchApp.client.tsx
+++ b/frontend/app/components/GolfWatchApp.client.tsx
@@ -3,7 +3,6 @@ import type { components } from "../.server/api/schema";
import useWebSocket, { ReadyState } from "../hooks/useWebSocket";
import type { PlayerInfo } from "../models/PlayerInfo";
import GolfWatchAppConnecting from "./GolfWatchApps/GolfWatchAppConnecting";
-import GolfWatchAppFinished from "./GolfWatchApps/GolfWatchAppFinished";
import GolfWatchAppGaming from "./GolfWatchApps/GolfWatchAppGaming";
import GolfWatchAppStarting from "./GolfWatchApps/GolfWatchAppStarting";
import GolfWatchAppWaiting from "./GolfWatchApps/GolfWatchAppWaiting";
@@ -240,7 +239,7 @@ export default function GolfWatchApp({
return <GolfWatchAppWaiting />;
} else if (gameState === "starting") {
return <GolfWatchAppStarting leftTimeSeconds={leftTimeSeconds!} />;
- } else if (gameState === "gaming") {
+ } else if (gameState === "gaming" || gameState === "finished") {
return (
<GolfWatchAppGaming
gameDisplayName={game.display_name}
@@ -252,8 +251,6 @@ export default function GolfWatchApp({
problemDescription={game.problem.description}
/>
);
- } else if (gameState === "finished") {
- return <GolfWatchAppFinished />;
} else {
return null;
}
diff --git a/frontend/app/components/GolfWatchApps/GolfWatchAppFinished.tsx b/frontend/app/components/GolfWatchApps/GolfWatchAppFinished.tsx
deleted file mode 100644
index 58cb2df..0000000
--- a/frontend/app/components/GolfWatchApps/GolfWatchAppFinished.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-export default function GolfWatchAppFinished() {
- return (
- <div className="min-h-screen bg-gray-100 flex items-center justify-center">
- <div className="text-center">
- <h1 className="text-4xl font-bold text-black-600 mb-4">Finished</h1>
- </div>
- </div>
- );
-}
diff --git a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx
index abdc855..b2598fc 100644
--- a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx
+++ b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx
@@ -25,6 +25,9 @@ export default function GolfWatchAppGaming({
}: Props) {
const leftTime = (() => {
const k = gameDurationSeconds + leftTimeSeconds;
+ if (k <= 0) {
+ return "00:00";
+ }
const m = Math.floor(k / 60);
const s = k % 60;
return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;