Files
Dune/components/roster-alliance.tsx
T
Quintine f667383565
Verify and publish checkpoint container / container (push) Successful in 12m6s
Connect Kull bid answers and group transport
2026-10-29 00:17:48 +11:00

24 lines
932 B
TypeScript

'use client';
import { faction } from '@/game/catalog';
import { coalitionAllies } from '@/game/coalition-alliance';
import type { GameView } from '@/game/engine';
/** Alliance membership is public; a staged larger alliance has no scalar
* player.ally value, so use its authoritative public membership ledger. */
export function RosterAlliance({game, playerId}: {
game: Pick<GameView, 'players' | 'coalitionState'>;
playerId: string;
}) {
const player = game.players.find(seat => seat.id === playerId);
if (!player) return null;
const ids = game.coalitionState
? coalitionAllies(game.players, game.coalitionState, playerId)
: player.ally ? [player.ally] : [];
const names = ids.flatMap(id => {
const ally = game.players.find(seat => seat.id === id);
return ally ? [faction(ally.faction).name] : [];
});
return names.length ? <div className="fine">Allied with {names.join(' and ')}</div> : null;
}