Skip to content

Commit d99583d

Browse files
committed
fix: Camera menu not checking for duplicate cards in poker
1 parent 7db4f38 commit d99583d

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/pages/Poker/routes/Round.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ export default function Round() {
133133
if (typeof msg == "string") {
134134
if (betUIOpen) return;
135135

136+
if (usedCards.includes(msg as Card)) {
137+
notifications.show({
138+
message: "Card is already in use",
139+
color: "red",
140+
});
141+
142+
return;
143+
}
144+
136145
if (pokerGame.capturingCommunityCards) {
137146
let cards = [...pokerGame.communityCards];
138147
if (cards.includes(EMPTY_CARD)) {
@@ -354,12 +363,14 @@ export default function Round() {
354363
});
355364

356365
if (new Set(usedCards).size !== usedCards.length) {
357-
notifications.show({
358-
message: "Duplicate cards are not allowed, removing duplicates",
359-
color: "red",
366+
modals.open({
367+
title: "Duplicate cards",
368+
children: (
369+
<>
370+
<Text>There are duplicate cards in play. Remove them to continue.</Text>
371+
</>
372+
),
360373
});
361-
362-
usedCards = [...new Set(usedCards)];
363374
}
364375

365376
setUsedCards(usedCards);

0 commit comments

Comments
 (0)