'use client'; import { parseAllianceClaim, type AllianceClaim } from '@/game/alliance-promises'; type Partner = { id: string; name: string }; export function allianceClaimInputError(value: unknown, partners?: readonly Partner[]): string | null { try { const claim = parseAllianceClaim(value); return partners && !partners.some(partner => partner.id === claim.partner) ? 'Choose one of the current alliance partners.' : null; } catch (error) { return error instanceof Error ? error.message : 'Choose the current turn and another player.'; } } /** The parent supplies this Nexus turn and its current named-other choices. */ export function AllianceClaimFields(props: { value: AllianceClaim; onChange: (claim: AllianceClaim) => void; partners: readonly Partner[]; disabled?: boolean; }) { const error = allianceClaimInputError(props.value, props.partners); return
; }