blob: e04c7a085cbede54fea441481a623cfeb822f4fe (
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 function Finished({ 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>
</>
);
}
|