From 256c48e6b7affa23a9378e4c3547777f6000c21d Mon Sep 17 00:00:00 2001 From: Pavlos Smith Date: Sat, 30 Mar 2024 03:27:36 +0200 Subject: [PATCH] Fixed bug breaking offline play --- package.json | 2 +- src/app.js | 1 + src/board/board.js | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bfd1a91..a619e8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tic-tac-toes", - "version": "1.1.0", + "version": "1.1.1", "main": "/src/index.js", "scripts": { "start": "react-scripts start", diff --git a/src/app.js b/src/app.js index 13da5ec..249b10a 100644 --- a/src/app.js +++ b/src/app.js @@ -278,6 +278,7 @@ export default function Game() { onScoreChange={handleScoreChange} soundEnabled={shouldPlaySound()} isItMyTurn={isItMyTurn(playerSymbol)} + onlineMode={online} receivedOnlineMove={receivedOnlineMove} /> , diff --git a/src/board/board.js b/src/board/board.js index 06bd524..807dcb4 100644 --- a/src/board/board.js +++ b/src/board/board.js @@ -13,6 +13,7 @@ export default function Board({ onScoreChange, soundEnabled, isItMyTurn, + onlineMode, receivedOnlineMove, }) { const [winner, setWinner] = useState(null); @@ -43,7 +44,7 @@ export default function Board({ function handleClick(i) { // If not player's turn and online opponent hasn't played, ignore move - if (!isItMyTurn && !receivedOnlineMove) { + if (onlineMode && (!isItMyTurn && !receivedOnlineMove)) { return; }