Skip to content

Commit

Permalink
Fix seat players ref issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mhzrerfani committed Oct 15, 2024
1 parent 653f2b5 commit 567dbb7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions apps/web/src/app/games/[id]/components/PlayerActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export default function PlayerActions() {
if (isPlayerTurn && queuedAction) {
console.log(`Player turn, executing queued action: ${queuedAction}`);
handlePlayerAction(queuedAction);
setQueuedAction(null);
setIsActionQueued(false);
clearQueue();
}
}, [isPlayerTurn, queuedAction]);

Expand All @@ -70,7 +69,6 @@ export default function PlayerActions() {
console.log(`Action taken: ${action}`);
if (!game) throw new Error("Must exist by now");
game.placeBet(action);
clearQueue();
};

return (
Expand All @@ -80,7 +78,7 @@ export default function PlayerActions() {
actions.map((action) => (
<button
key={action}
className={`capitalize focus:outline-[#b87d5b] z-20 relative nes-btn is-warning disabled:hover:cursor-not-allowed w-full py-2 sm:py-4 text-[10px] sm:text-lg text-white hover:brightness-90 ${
className={`capitalize focus:outline-[#b87d5b] z-20 relative nes-btn is-warning disabled:hover:cursor-not-allowed w-full py-2 sm:py-4 text-[10px] sm:text-base text-white flex hover:brightness-90 ${
isActionQueued && queuedAction === action ? "cursor-pointer" : ""
}`}
onClick={() => handlePlayerAction(action)}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/games/[id]/components/Seat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function Seat({
}) {
const mounted = useRef(false);

const players = useSelector(selectGamePlayers$);
const players = useSelector(selectGamePlayers$());
const shufflingPlayer = useSelector(selectShufflingPlayer$());
const awaitingBetFrom = useSelector(selectAwaitingBetFrom$());
const isPlayerTurn = awaitingBetFrom?.id === player.id;
Expand Down

0 comments on commit 567dbb7

Please sign in to comment.