From 8d19c88c83c58fc2fbde2b85ce67beeb9deeb83a Mon Sep 17 00:00:00 2001 From: Nathaniel Tampus Date: Sat, 1 Apr 2023 20:58:29 +0800 Subject: [PATCH] rename reason to endReason --- client/src/components/game/GamePage.tsx | 22 +++++++++++----------- client/src/components/game/socketEvents.ts | 4 ++-- server/src/socket/game.socket.ts | 11 ++++++----- types/index.d.ts | 2 +- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/client/src/components/game/GamePage.tsx b/client/src/components/game/GamePage.tsx index 50c09ca..095ca72 100644 --- a/client/src/components/game/GamePage.tsx +++ b/client/src/components/game/GamePage.tsx @@ -69,7 +69,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) { useEffect(() => { if ( lobby.side === "s" || - lobby.reason || + lobby.endReason || lobby.winner || !lobby.pgn || !lobby.white || @@ -246,11 +246,11 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) { } function isDraggablePiece({ piece }: { piece: string }) { - return piece.startsWith(lobby.side) && !lobby.reason && !lobby.winner; + return piece.startsWith(lobby.side) && !lobby.endReason && !lobby.winner; } function onDrop(sourceSquare: Square, targetSquare: Square) { - if (lobby.side === "s" || navFen || lobby.reason || lobby.winner) return false; + if (lobby.side === "s" || navFen || lobby.endReason || lobby.winner) return false; // premove if (lobby.side !== lobby.actualGame.turn()) return true; @@ -297,7 +297,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) { } function onPieceDragBegin(_piece: string, sourceSquare: Square) { - if (lobby.side !== lobby.actualGame.turn() || navFen || lobby.reason || lobby.winner) return; + if (lobby.side !== lobby.actualGame.turn() || navFen || lobby.endReason || lobby.winner) return; getMoveOptions(sourceSquare); } @@ -308,7 +308,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) { function onSquareClick(square: Square) { updateCustomSquares({ rightClicked: {} }); - if (lobby.side !== lobby.actualGame.turn() || navFen || lobby.reason || lobby.winner) return; + if (lobby.side !== lobby.actualGame.turn() || navFen || lobby.endReason || lobby.winner) return; function resetFirstMove(square: Square) { setMoveFrom(square); @@ -494,7 +494,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) { function claimAbandoned(type: "win" | "draw") { if ( lobby.side === "s" || - lobby.reason || + lobby.endReason || lobby.winner || !lobby.pgn || abandonSeconds > 0 || @@ -510,8 +510,8 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
{/* overlay */} {(!lobby.white?.id || !lobby.black?.id) && ( -
-
+
+
Waiting for opponent. {session?.user?.id !== lobby.white?.id && session?.user?.id !== lobby.black?.id && (