From 7ae1976e74ebc65bedbdd4d95099e3338824eb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D1=80=D0=B0=D0=BC=D1=8B=D1=86=D0=BA=D0=B8=D1=85=20?= =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD?= Date: Thu, 10 Aug 2023 13:39:52 +0500 Subject: [PATCH] feat: add GameResult to page GameField #190 --- components/GameField/GameField.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/GameField/GameField.tsx b/components/GameField/GameField.tsx index f5226f1..bdd470f 100644 --- a/components/GameField/GameField.tsx +++ b/components/GameField/GameField.tsx @@ -9,6 +9,7 @@ import { useEffect, useState } from 'react'; import Link from 'next/link'; import cn from 'classnames'; import { FinishedGameState } from 'gameApi'; +import { GameResult } from 'components/GameResult'; export const GameField: React.FC = ({ children, rivalPlayerAddress, @@ -29,6 +30,14 @@ export const GameField: React.FC = ({ const [isConnecting, setIsConnecting] = useState(false); const [isShowReport, setShowReport] = useState(false); const [isShowDispute, setShowDispute] = useState(false); + const [showGameResult, setShowGameResult] = useState(false); + + useEffect(() => { + if (!!finishedGameState) { + setShowGameResult(true); + } + }, [finishedGameState]); + // TODO: delete badge @habdevs #190 // type TMedal = 'bronze' | 'silver' | 'gold'; // type TBelt = 'white' | 'green' | 'black'; @@ -204,9 +213,12 @@ export const GameField: React.FC = ({ // } // return
{badges}
; // }; - +// TODO: add GameResult @habdevs #190 + // return
{showGameResult && }
; + // TODO: delete badge @habdevs #190 return (
+ {showGameResult && } {version &&
{`Ver.${version}`}
} {isShowShade && (
@@ -329,7 +341,7 @@ export const GameField: React.FC = ({
{makeFinishedGameReasonDescription(finishedGameState)}
)} -// TODO: delete badge @habdevs #190 + // TODO: delete badge @habdevs #190 {/* {!!finishedGameState && (