diff --git a/src/components/frontend/minigames/poker/PokerDevPanel.tsx b/src/components/frontend/minigames/poker/PokerDevPanel.tsx index 2a8421a..be0beac 100644 --- a/src/components/frontend/minigames/poker/PokerDevPanel.tsx +++ b/src/components/frontend/minigames/poker/PokerDevPanel.tsx @@ -58,6 +58,24 @@ function cardLabel(card: Card): string { return `${rank} ${suit}`; } +/** + * Builds a complete card from one picker interaction: an empty selection + * starts from the 2-of-spades baseline for the not-yet-chosen half, and any + * already-chosen half is preserved. Returning a full card (never null) is + * what lets a single pick land; the previous null-propagating version made + * first picks no-ops and hole-card queuing impossible. + */ +export function applyCardPick( + value: Card | null, + part: "rank" | "suit", + next: string, +): Card { + if (part === "rank") { + return { rank: Number(next) as Rank, suit: value?.suit ?? "s" }; + } + return { rank: value?.rank ?? 2, suit: next as Suit }; +} + function CardPicker({ label, value, @@ -67,13 +85,13 @@ function CardPicker({ readonly value: Card | null; readonly onChange: (card: Card | null) => void; }) { + const setRank = (next: string) => onChange(applyCardPick(value, "rank", next)); + const setSuit = (next: string) => onChange(applyCardPick(value, "suit", next)); + return (
{label} - @@ -85,10 +103,7 @@ function CardPicker({ ))} - @@ -191,11 +206,7 @@ export function PokerDevPanel({

Board queue

- setBoardDraft(card ?? { rank: 2, suit: "s" })} - /> +