'use client'; import { useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { homeworldRevivalDeploymentCanAct, homeworldRevivalDeploymentChoice, } from '@/game/homeworld-revival-deployment-options'; import { Button } from './ui/button'; type Props = { game: GameView; act: (action: Action) => void; busy: boolean; }; export function HomeworldRevivalDeployment({ game, act, busy }: Props) { if ( !game.homeworldRevivalDeployment || game.homeworldRevivalDeployment.player !== game.me || game.decision?.kind !== 'homeworldRevivalDeployment' || game.decision.player !== game.me ) return null; return ( ); } function DeploymentChoice({ game, act, busy }: Props) { const offer = game.homeworldRevivalDeployment!; const [destination, setDestination] = useState( offer.destinations.find((target) => !target.blocked)?.id ?? '', ); const canAct = homeworldRevivalDeploymentCanAct(game); const choice = homeworldRevivalDeploymentChoice(game, destination); const amount = offer.normal + offer.elite; return (

{offer.kind === 'fedaykin' ? 'Place revived Fedaykin' : 'Place revived forces'}

Place the entire eligible revived group in one destination, or leave it in reserves.

{offer.normal} ordinary · {offer.elite} starred · {amount} total

{choice.blocked && (

{choice.blocked}

)}
); }