The table becomes a full oval racetrack with a center deck and pot plaque, perimeter seats as compact pills with stack-first readouts that flash on change, betting actions mounted on the felt near the viewer, your own cards dealt onto the bottom rail at community-card size, directional popups, and gated start and waiting-room polish. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import type { PokerSnapshot } from "@/app/(frontend)/minigames/poker/actions";
|
|
import { BettingControls } from "./BettingControls";
|
|
|
|
type SeatedSnapshot = PokerSnapshot & {
|
|
readonly you: NonNullable<PokerSnapshot["you"]>;
|
|
};
|
|
|
|
interface PokerActionToolbarProps {
|
|
readonly snapshot: SeatedSnapshot;
|
|
readonly onSnapshot: (snapshot: PokerSnapshot) => void;
|
|
readonly onActionFeedback: () => void;
|
|
}
|
|
|
|
export function PokerActionToolbar({
|
|
snapshot,
|
|
onSnapshot,
|
|
onActionFeedback,
|
|
}: PokerActionToolbarProps) {
|
|
const view = snapshot.you;
|
|
|
|
if (view.phase !== "betting") return null;
|
|
|
|
if (!view.yourTurn) {
|
|
const actingPlayer = view.players.find((player) => player.seatId === view.toActSeat);
|
|
return (
|
|
<div className="poker-action-toolbar poker-action-toolbar-waiting" role="status">
|
|
{actingPlayer ? `Waiting for ${actingPlayer.name}` : "Waiting for the table"}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="poker-action-toolbar" aria-label="Poker actions">
|
|
<BettingControls
|
|
tableId={snapshot.tableId}
|
|
snapshotVersion={snapshot.version}
|
|
legalActions={view.legalActions}
|
|
potTotal={view.potTotal}
|
|
yourTurn={view.yourTurn}
|
|
onSnapshot={onSnapshot}
|
|
onActionFeedback={onActionFeedback}
|
|
compact
|
|
/>
|
|
</div>
|
|
);
|
|
}
|