Skip to content

Commit

Permalink
feat: add GameResult to page GameField #190
Browse files Browse the repository at this point in the history
  • Loading branch information
Храмыцких Антон committed Aug 10, 2023
1 parent 446053a commit 7ae1976
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions components/GameField/GameField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<GameFieldPropsI> = ({
children,
rivalPlayerAddress,
Expand All @@ -29,6 +30,14 @@ export const GameField: React.FC<GameFieldPropsI> = ({
const [isConnecting, setIsConnecting] = useState<boolean>(false);
const [isShowReport, setShowReport] = useState<boolean>(false);
const [isShowDispute, setShowDispute] = useState<boolean>(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';
Expand Down Expand Up @@ -204,9 +213,12 @@ export const GameField: React.FC<GameFieldPropsI> = ({
// }
// return <div className={styles.row}>{badges}</div>;
// };

// TODO: add GameResult @habdevs #190
// return <div>{showGameResult && <GameResult result={'win'} gameType={'checkers'} />}</div>;
// TODO: delete badge @habdevs #190
return (
<div className={styles.container}>
{showGameResult && <GameResult result={'win'} gameType={'checkers'} />}
{version && <div className={styles.version}>{`Ver.${version}`}</div>}
{isShowShade && (
<div className={styles.shade}>
Expand Down Expand Up @@ -329,7 +341,7 @@ export const GameField: React.FC<GameFieldPropsI> = ({
<div className={styles.small}>{makeFinishedGameReasonDescription(finishedGameState)}</div>
</div>
)}
// TODO: delete badge @habdevs #190
// TODO: delete badge @habdevs #190
{/* {!!finishedGameState && (
<div className={styles.link}>
<div className={styles.badges}>
Expand Down

0 comments on commit 7ae1976

Please sign in to comment.