'use client'; import { useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { ECAZ_START_FORCES, ECAZ_START_LOCATIONS, quoteEcazStartingForces, } from '@/game/ecaz-setup'; import { splitLocation } from '@/game/board'; import { Button } from './ui/button'; import { Input } from './ui/input'; export function EcazSetup({ game, act, busy, }: { game: GameView; act: (action: Action) => void; busy: boolean; }) { const [placements, setPlacements] = useState>({ [ECAZ_START_LOCATIONS[0]]: ECAZ_START_FORCES, }); const me = game.players.find((player) => player.id === game.me); if ( game.status !== 'setup' || game.setupStage !== 'forces' || me?.faction !== 'ecaz' || me.reserves !== 20 || !game.setupPending.includes(game.me) ) return null; let quoted: Record | null = null; try { quoted = quoteEcazStartingForces(placements); } catch { /* Show the allocation until its total is legal. */ } const total = Object.values(placements).reduce( (sum, count) => sum + count, 0, ); return (

Place six forces in Imperial Basin. Choose how many go in each sector; fourteen forces remain in reserves.

{ECAZ_START_LOCATIONS.map((location) => ( ))}

{total} / {ECAZ_START_FORCES} forces assigned

); }