Skip to content

Commit

Permalink
disable cards in per card popup
Browse files Browse the repository at this point in the history
  • Loading branch information
danbastin committed Mar 6, 2025
1 parent 71cc328 commit 781812d
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ export const SelectCardsPopupModal = ({ data }: ButtonProps) => {
const selectableCards = data.cards.filter((card) => card.selectionState !== 'invalid');
const invalidCards = data.cards.filter((card) => card.selectionState === 'invalid');

const clickDisabled = () => {
return data.perCardButtons.length > 0;
}

const handleCardClick = (cardUuid: string) => {
if (!clickDisabled()) {
sendGameMessage(['menuButton', cardUuid, data.uuid])
}
}

const renderPopupContent = () => {
if (isMinimized) return null;
return (
Expand All @@ -76,7 +86,8 @@ export const SelectCardsPopupModal = ({ data }: ButtonProps) => {
key={card.uuid}
cardStyle={CardStyle.Prompt}
card={{ ...card, selectable: card.selectionState === 'selectable', selected: card.selectionState === 'selected' }}
onClick={() => sendGameMessage(['menuButton', card.uuid, data.uuid])}
onClick={() => handleCardClick(card.uuid)}
disabled={clickDisabled()}
/>
{selectingCards && (
<Box
Expand Down

0 comments on commit 781812d

Please sign in to comment.