diff --git a/src/tictactoe/Board.tsx b/src/tictactoe/Board.tsx
index b9632f0..246d0af 100644
--- a/src/tictactoe/Board.tsx
+++ b/src/tictactoe/Board.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { motion, AnimatePresence } from "framer-motion";
+import { useNakama } from "./providers/NakamaProvider";
interface BoardProps {
board: string[][];
@@ -20,6 +21,9 @@ export default function Board({
}: BoardProps) {
const myIndex = players.indexOf(myUserId ?? "");
const gameReady = players.length === 2;
+ const {
+ matchId
+ } = useNakama();
const mySymbol =
myIndex === 0 ? "X" : myIndex === 1 ? "O" : null;
@@ -44,134 +48,138 @@ export default function Board({
}
return (
-
-
- {status}
-
-
- {gameReady && mySymbol && (
+ <>
+ {matchId && (
- You: {mySymbol} — Opponent:{" "}
- {opponentSymbol}
+
+ {status}
+
+
+ {gameReady && mySymbol && (
+
+ You: {mySymbol} — Opponent:{" "}
+ {opponentSymbol}
+
+ )}
+
+ {/* -------------------------
+ BOARD
+ -------------------------- */}
+
+ {board.map((row, rIdx) =>
+ row.map((cell, cIdx) => {
+ const disabled =
+ !!cell ||
+ !!winner ||
+ !gameReady ||
+ myIndex === -1 ||
+ !isMyTurn;
+
+ return (
+ !disabled && onCellClick(rIdx, cIdx)}
+ style={{
+ width: "80px",
+ height: "80px",
+ fontSize: "2rem",
+ borderRadius: "10px",
+ border: "2px solid #333",
+ background: "#111",
+ color: "white",
+ cursor: disabled ? "not-allowed" : "pointer",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+
+ {cell && (
+
+ {cell}
+
+ )}
+
+
+ );
+ })
+ )}
+
+
+ {/* Winner pulse animation */}
+ {winner && (
+
+ 🎉 {winner} Wins! 🎉
+
+ )}
)}
-
- {/* -------------------------
- BOARD
- -------------------------- */}
-
- {board.map((row, rIdx) =>
- row.map((cell, cIdx) => {
- const disabled =
- !!cell ||
- !!winner ||
- !gameReady ||
- myIndex === -1 ||
- !isMyTurn;
-
- return (
- !disabled && onCellClick(rIdx, cIdx)}
- style={{
- width: "80px",
- height: "80px",
- fontSize: "2rem",
- borderRadius: "10px",
- border: "2px solid #333",
- background: "#111",
- color: "white",
- cursor: disabled ? "not-allowed" : "pointer",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- }}
- >
-
- {cell && (
-
- {cell}
-
- )}
-
-
- );
- })
- )}
-
-
- {/* Winner pulse animation */}
- {winner && (
-
- 🎉 {winner} Wins! 🎉
-
- )}
-
- );
+ >
+ )
}
diff --git a/src/tictactoe/TicTacToe.tsx b/src/tictactoe/TicTacToe.tsx
index 3ebd3e9..74751e5 100644
--- a/src/tictactoe/TicTacToe.tsx
+++ b/src/tictactoe/TicTacToe.tsx
@@ -80,16 +80,14 @@ export default function TicTacToe() {
onMatchDataCallback={onMatchDataCallback}
/>
- {matchId && (
-
- )}
+
);
}