Files
Dune/components/phase-bid-claim-fields.tsx
T
Quintine 868713eeb9
Verify and publish checkpoint container / container (push) Successful in 11m19s
Support Truthtrance ordering in Black Market auctions
2026-11-16 18:49:05 +11:00

40 lines
1.9 KiB
TypeScript

'use client';
import { parsePhaseBidClaim, type PhaseBidClaim } from '@/game/turn-bid-promises';
import { Input } from './ui/input';
export function phaseBidClaimInputError(value: unknown): string | null {
try { parsePhaseBidClaim(value); return null; }
catch (error) { return error instanceof Error ? error.message : 'Choose a positive whole bid minimum.'; }
}
/** Turn is fixed by the authoritative question context; the asker chooses the threshold. */
export function PhaseBidClaimFields(props: {
value: PhaseBidClaim;
onChange: (claim: PhaseBidClaim) => void;
disabled?: boolean;
}) {
const error = phaseBidClaimInputError(props.value);
return <fieldset className="grid gap-2" disabled={props.disabled} aria-label="Bidding phase condition">
<legend>Ordinary auction bid during this turn</legend>
<p>Turn {props.value.turn} · Remaining ordinary Bidding phase</p>
<label htmlFor="truth-phase-bid-minimum">Minimum bid in spice</label>
<Input id="truth-phase-bid-minimum" type="number" min={1} max={Number.MAX_SAFE_INTEGER} step={1} required
disabled={props.disabled} value={Number.isFinite(props.value.minimum) ? props.value.minimum : ''}
aria-invalid={!!error} aria-describedby="truth-phase-bid-help"
onChange={event => {
if (props.disabled) return;
const next = { ...props.value, minimum: event.currentTarget.valueAsNumber };
if (phaseBidClaimInputError(next)) return;
props.onChange(parsePhaseBidClaim(next));
}} />
{error && <p role="alert">{error}</p>}
<p className="fine" id="truth-phase-bid-help">
This asks about one accepted ordinary auction bid of at least this size
after the answer, before Bidding ends this turn. Richese cache and Black
Market bids do not count. Earlier bids do not count; it does not promise
a win or change the winning payment.
</p>
</fieldset>;
}