From a46f583437e9b66ebec6fa22e27567a71b17b497 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sun, 21 Jul 2024 16:13:58 +0900
Subject: react router

---
 frontend/src/routes/golf/play/apps/Finished.tsx | 30 +++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 frontend/src/routes/golf/play/apps/Finished.tsx

(limited to 'frontend/src/routes/golf/play/apps/Finished.tsx')

diff --git a/frontend/src/routes/golf/play/apps/Finished.tsx b/frontend/src/routes/golf/play/apps/Finished.tsx
new file mode 100644
index 0000000..9922e07
--- /dev/null
+++ b/frontend/src/routes/golf/play/apps/Finished.tsx
@@ -0,0 +1,30 @@
+type Props = {
+  gameId: number;
+  playerId: number;
+  result: { yourScore: number | null, opponentScore: number | null };
+};
+
+export default ({ result }: Props) => {
+  const { yourScore, opponentScore } = result;
+  const yourScoreToCompare = yourScore ?? Infinity;
+  const opponentScoreToCompare = opponentScore ?? Infinity;
+  const resultText = yourScoreToCompare === opponentScoreToCompare ? '引き分け' : (yourScoreToCompare < opponentScoreToCompare ? 'あなたの勝ち' : 'あなたの負け');
+  return (
+    <>
+      <div>
+        対戦終了
+      </div>
+      <div>
+        <div>
+          {resultText}
+        </div>
+        <div>
+          あなたのスコア: {yourScore ?? 'なし'}
+        </div>
+        <div>
+          相手のスコア: {opponentScore ?? 'なし'}
+        </div>
+      </div>
+    </>
+  );
+}
-- 
cgit v1.3.1

