diff --git a/src/tictactoe/Board.tsx b/src/tictactoe/Board.tsx index 04b4b42..8b184b5 100644 --- a/src/tictactoe/Board.tsx +++ b/src/tictactoe/Board.tsx @@ -14,6 +14,7 @@ interface BoardProps { board: string[][]; turn: number; winner: string | null; + gameOver: boolean | null; players: PlayerModel[]; myUserId: string | null; onCellClick: (row: number, col: number) => void; @@ -23,6 +24,7 @@ export default function Board({ board, turn, winner, + gameOver, players, myUserId, onCellClick, @@ -53,6 +55,8 @@ export default function Board({ status = "Waiting for opponent..."; } else if (winner) { status = `Winner: ${winner}`; + } else if (gameOver) { + status = `Draw!!!`; } else if (myIndex === -1) { status = "Spectating"; } else { diff --git a/src/tictactoe/TicTacToe.tsx b/src/tictactoe/TicTacToe.tsx index 19453f0..ddae137 100644 --- a/src/tictactoe/TicTacToe.tsx +++ b/src/tictactoe/TicTacToe.tsx @@ -13,6 +13,7 @@ export default function TicTacToe() { ]); const [turn, setTurn] = useState(0); const [winner, setWinner] = useState(null); + const [gameOver, setGameOver] = useState(null); const [players, setPlayers] = useState([]); const { sendMatchData, onMatchData, matchId, session } = useNakama(); @@ -29,6 +30,7 @@ export default function TicTacToe() { setBoard(state.board.grid); setTurn(state.turn); + setGameOver(state.game_over); if (state.winner >= 0) { // Somebody actually won (0 or 1) setWinner(state.winner); @@ -118,6 +120,7 @@ export default function TicTacToe() { board={board} turn={turn} winner={winner} + gameOver={gameOver} players={players} myUserId={session?.user_id ?? null} onCellClick={handleCellClick}