Files
Dune/components/sapho-station-priority.tsx
T
Quintine a6be17fc5d
Verify and publish checkpoint container / container (push) Successful in 11m16s
Protect Sapho priority at the Testing Station
2026-10-30 17:35:55 +11:00

39 lines
1.7 KiB
TypeScript

'use client';
import type { Action } from '@/game/engine';
import { Button } from './ui/button';
/** This is the public opportunity projected for this viewer, independent of
* whether any player holds a particular card. */
export type SaphoStationPriorityView = {
event: string;
canPass: boolean;
waiting: boolean;
};
export type SaphoStationPriorityProps = {
game: { saphoStationPriority: SaphoStationPriorityView | null };
act: (action: Action) => void;
busy: boolean;
};
/** Keep the opportunity visible until the server advances the Station order.
* Actual order-changing choices remain in the player's own card controls. */
export function SaphoStationPriority({ game, act, busy }: SaphoStationPriorityProps) {
const view = game.saphoStationPriority;
if (!view) return null;
const event = view.event;
const canAct = () => !busy && game.saphoStationPriority === view &&
view.event === event && typeof event === 'string' && event.length > 0 && view.canPass;
return <section className="notice space-y-3" aria-label="Testing Station priority" aria-live="polite">
<h3>Testing Station priority</h3>
<p>Before the next Testing Station choice, players may use an available order change from their own hand. Already completed choices stay finished.</p>
{view.canPass ? <Button className="game-action min-h-11 whitespace-normal"
data-testid="sapho-station-priority-pass" disabled={!canAct()}
onClick={() => { if (canAct()) act({ type: 'saphoStationPass', event }); }}>
Continue without changing the order
</Button> : <p>{view.waiting ? 'Waiting for the other players to continue.' : 'Your response has been recorded.'}</p>}
</section>;
}