DRAW req alerts

This commit is contained in:
djmil 2023-12-01 10:01:27 +01:00
parent 16bccde6e1
commit dc3fd61bd3
2 changed files with 11 additions and 9 deletions

View File

@ -13,9 +13,17 @@ export default function GameBoard({ dispatchGuide, username, getGame, onStoneCli
const optionalOnStoneClick = (typeof onStoneClick !== 'function') ? null : const optionalOnStoneClick = (typeof onStoneClick !== 'function') ? null :
(cellId) => onStoneClick(game.uuid, cellId); (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) => { (move) => {
if (move[0] !== move[1] && game.board[move[1]] === undefined) 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) onStoneMove(game.uuid, move)
}; };

View File

@ -133,12 +133,6 @@ function Selectable({ game, selected, onClick }) {
const opponentName = game.opponentName; const opponentName = game.opponentName;
const flipBoard = (game?.myColor === Color.black) ? true : null; 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 ( return (
<div className={'Selectable' + (selected ? ' selected' : '')} <div className={'Selectable' + (selected ? ' selected' : '')}
onClick={() => onClick(game.uuid)} onClick={() => onClick(game.uuid)}