'use client'; import { parseGholaLeaderClaim, type GholaLeaderClaim } from '@/game/ghola-leader-promises'; type LeaderChoice = { id: string; name: string }; export function gholaLeaderClaimInputError(value: unknown, leaders?: readonly LeaderChoice[]): string | null { try { const claim = parseGholaLeaderClaim(value); return leaders && !leaders.some(leader => leader.id === claim.leader) ? 'Choose one of the current named leaders.' : null; } catch (error) { return error instanceof Error ? error.message : 'Choose the current turn and a named leader.'; } } /** The parent supplies the current turn and public leader names. Server rules * decide whether the named return is possible and whether a response is legal. */ export function GholaLeaderClaimFields(props: { value: GholaLeaderClaim; onChange: (claim: GholaLeaderClaim) => void; leaders: readonly LeaderChoice[]; disabled?: boolean; }) { const error = gholaLeaderClaimInputError(props.value, props.leaders); return
; }