From 0765f61a494de1f284042ba56382983d58d5a6f5 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 21 Aug 2024 01:20:20 +0900 Subject: feat(frontend): partially implement game result --- frontend/app/components/GolfWatchApp.client.tsx | 1 + .../GolfWatchApps/GolfWatchAppGaming.tsx | 26 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/frontend/app/components/GolfWatchApp.client.tsx b/frontend/app/components/GolfWatchApp.client.tsx index e2bc7d4..22f87fa 100644 --- a/frontend/app/components/GolfWatchApp.client.tsx +++ b/frontend/app/components/GolfWatchApp.client.tsx @@ -260,6 +260,7 @@ export default function GolfWatchApp({ playerInfoB={playerInfoB} problemTitle={game.problem.title} problemDescription={game.problem.description} + gameResult={null /* TODO */} /> ); } else { diff --git a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx index e325cf7..28babff 100644 --- a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx +++ b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx @@ -13,6 +13,7 @@ type Props = { playerInfoB: PlayerInfo; problemTitle: string; problemDescription: string; + gameResult: "winA" | "winB" | "draw" | null; }; export default function GolfWatchAppGaming({ @@ -23,6 +24,7 @@ export default function GolfWatchAppGaming({ playerInfoB, problemTitle, problemDescription, + gameResult, }: Props) { const leftTime = (() => { const k = gameDurationSeconds + leftTimeSeconds; @@ -34,11 +36,19 @@ export default function GolfWatchAppGaming({ return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`; })(); + const topBg = gameResult + ? gameResult === "winA" + ? "bg-orange-400" + : gameResult === "winB" + ? "bg-purple-400" + : "bg-pink-500" + : "bg-iosdc-japan"; + return (
-
+
-
+
{playerInfoA.iconPath && (
{gameDisplayName}
-
{leftTime}
+
+ {gameResult + ? gameResult === "winA" + ? `勝者 ${playerInfoA.displayName}` + : gameResult === "winB" + ? `勝者 ${playerInfoB.displayName}` + : "引き分け" + : leftTime} +
{playerInfoB.score}
-
+
Player 2
{playerInfoB.displayName}
-- cgit v1.2.3-70-g09d2