Add confirmation choice for passing

This commit is contained in:
Joel Therrien 2023-09-21 18:40:41 -07:00
parent e0fe22e9ce
commit 6c7a90c421

View file

@ -389,6 +389,7 @@ export function Game(props: {
trayDispatch({action: TileDispatchActionType.RETURN}); trayDispatch({action: TileDispatchActionType.RETURN});
}}>Return Tiles</button> }}>Return Tiles</button>
<button className="pass" onClick={() => { <button className="pass" onClick={() => {
if (window.confirm("Are you sure you want to pass?")) {
const result = props.wasm.skip_turn() as MyResult<string>; const result = props.wasm.skip_turn() as MyResult<string>;
handlePlayerAction({type: "Pass"}, props.settings.playerName); handlePlayerAction({type: "Pass"}, props.settings.playerName);
setTurnCount(turnCount + 1); setTurnCount(turnCount + 1);
@ -396,6 +397,7 @@ export function Game(props: {
if (result.game_state.type === "Ended") { if (result.game_state.type === "Ended") {
endGame(result.game_state); endGame(result.game_state);
} }
}
}}>Pass</button> }}>Pass</button>
</div> </div>
</div> </div>