diff --git a/webapp/src/container/games/GameBoard.jsx b/webapp/src/container/games/GameBoard.jsx index 31e8eaa..e60ba7a 100644 --- a/webapp/src/container/games/GameBoard.jsx +++ b/webapp/src/container/games/GameBoard.jsx @@ -13,10 +13,18 @@ export default function GameBoard({ dispatchGuide, username, getGame, onStoneCli const optionalOnStoneClick = (typeof onStoneClick !== 'function') ? null : (cellId) => onStoneClick(game.uuid, cellId); - const optionalOnStoneMove = (typeof onStoneMove !== 'function' || isPushing || game.status === 'DRAW_REQUEST_WAIT_FOR_YOU' || game.status === 'DRAW_REQUEST_WAIT_FOR_OPPONENT') ? null : + const optionalOnStoneMove = (typeof onStoneMove !== 'function' || isPushing) ? null : (move) => { - if (move[0] !== move[1] && game.board[move[1]] === undefined) - onStoneMove(game.uuid, move) + if (move[0] === move[1] || game.board[move[1]] !== undefined) + return; // ignore obviosly wrong move + + if (game.status === 'DRAW_REQUEST_WAIT_FOR_YOU') + return alert("You have to descide on Draw request from " + game.opponentName); + + if (game.status === 'DRAW_REQUEST_WAIT_FOR_OPPONENT') + return alert("Awating for " + game.opponentName + "'s decision on the Draw request"); + + onStoneMove(game.uuid, move) }; const currMove = (() => { diff --git a/webapp/src/container/games/GameSelector.jsx b/webapp/src/container/games/GameSelector.jsx index 723a18a..b6752ff 100644 --- a/webapp/src/container/games/GameSelector.jsx +++ b/webapp/src/container/games/GameSelector.jsx @@ -133,12 +133,6 @@ function Selectable({ game, selected, onClick }) { const opponentName = game.opponentName; const flipBoard = (game?.myColor === Color.black) ? true : null; - const color = 'red';//game.status === 'DRAW_REQUEST_WAIT_FOR_YOU' || game.status === 'DRAW_REQUEST_WAIT_FOR_OPPONENT'; - - // const style = { - // border: 1px 'red' - // }; - return (