fix board pit select issue

This commit is contained in:
Halit Aksoy 2022-07-13 23:44:06 +03:00
parent 50b84dd115
commit 0d2b16c1fe

View File

@ -120,14 +120,14 @@ const BoardView: FunctionComponent<{
const player1Pits = game?.board.player1Pits.map((pit, index) => { const player1Pits = game?.board.player1Pits.map((pit, index) => {
const pitViewModel = boardViewModel.pits[pit.index]; const pitViewModel = boardViewModel.pits[pit.index];
return createPitView(index, pitViewModel, () => { return createPitView(index, pitViewModel, () => {
if (game.turnPlayerId === game.player1Id) if (game.turnPlayerId === game.player1Id && userKey === game.player1Id)
onPitSelect(game.board.player1Pits.indexOf(pit), pit); onPitSelect(game.board.player1Pits.indexOf(pit), pit);
}); });
}); });
const player2Pits = game!!.board.player2Pits.map((pit, index) => { const player2Pits = game?.board.player2Pits.map((pit, index) => {
const pitViewModel = boardViewModel.pits[pit.index]; const pitViewModel = boardViewModel.pits[pit.index];
return createPitView(index, pitViewModel, () => { return createPitView(index, pitViewModel, () => {
if (game.turnPlayerId === game.player2Id) if (game.turnPlayerId === game.player2Id && userKey === game.player2Id)
onPitSelect(game.board.player2Pits.indexOf(pit), pit); onPitSelect(game.board.player2Pits.indexOf(pit), pit);
}); });
}); });