Files
Dune/components/sapho-great-maker-priority.tsx
T
Quintine 77d02b3231
Verify and publish checkpoint container / container (push) Successful in 11m14s
Support Sapho ordering for Great Maker votes
2026-11-16 21:32:53 +11:00

36 lines
1.5 KiB
TypeScript

'use client';
import type { Action } from '@/game/engine';
import { Button } from './ui/button';
/** The opportunity is public; card custody is projected separately to its owner. */
export type SaphoGreatMakerPriorityView = {
event: string;
canPass: boolean;
waiting: boolean;
};
export type SaphoGreatMakerPriorityProps = {
game: { saphoGreatMakerPriority?: SaphoGreatMakerPriorityView | null };
act: (action: Action) => void;
busy: boolean;
};
export function SaphoGreatMakerPriority({ game, act, busy }: SaphoGreatMakerPriorityProps) {
const view = game.saphoGreatMakerPriority;
if (!view) return null;
const event = view.event;
const canAct = () => !busy && game.saphoGreatMakerPriority === view &&
view.event === event && typeof event === 'string' && event.length > 0 && view.canPass;
return <section className="notice space-y-3" aria-label="Great Maker vote order" aria-live="polite">
<h3>Great Maker vote order</h3>
<p>Before the next vote, players may use an available order change from their own hand. Votes already cast stay finished.</p>
{view.canPass ? <Button className="game-action min-h-11 whitespace-normal"
data-testid="sapho-great-maker-priority-pass" disabled={!canAct()}
onClick={() => { if (canAct()) act({ type: 'saphoGreatMakerPass', event }); }}>
Continue without changing vote order
</Button> : <p>{view.waiting ? 'Waiting for the other players to continue.' : 'Your response has been recorded.'}</p>}
</section>;
}