aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/routes/golf/play/apps/Finished.tsx
blob: bad7526ac10cc558170179f1d1a77bce550d5c8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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>
    </>
  );
};