'use client';
import { useState } from 'react';
import Image from 'next/image';
import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
import { Eye, X } from 'lucide-react';
import { FACTIONS, faction, type FactionId } from '@/game/catalog';
import { FACTION_RULES } from '@/game/faction-reference';
import { HOMEWORLD_CARDS } from '@/game/homeworld-cards';
import { Button } from './ui/button';
import { Dialog, DialogClose, DialogDescription, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './ui/dialog';
/** Static public reference only: no player, holdings, hidden choices or action callback. */
export function FactionSheet({ factionId, advanced }: { factionId: FactionId; advanced: boolean }) {
const house = faction(factionId);
const rules = FACTION_RULES[factionId];
const world = HOMEWORLD_CARDS.find(card => card.faction === factionId)!;
return
Basic powers and alliances
{rules.basic.map(text => {text} )}
{advanced &&
Advanced powers
Use these with the Basic powers above and the Advanced game rules.
{rules.advanced.map(text => {text} )}
}
;
}
function FactionSheetReader({ factionId, tableAdvanced }: { factionId: FactionId; tableAdvanced?: boolean }) {
const [advanced, setAdvanced] = useState(tableAdvanced ?? false);
return
{tableAdvanced !== undefined &&
This table uses {tableAdvanced ? 'Advanced' : 'Basic'} rules .{advanced !== tableAdvanced && ' You are previewing the other rules mode; the table has not changed.'}
}
setAdvanced(event.target.checked)} /> Include Advanced powers
;
}
export function FactionInspector({ factionId, advanced }: { factionId: FactionId; advanced: boolean }) {
const house = faction(factionId);
return
} aria-label={`Inspect faction: ${house.name}`}>
Inspect faction
Public faction sheet }> Close
{/* oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- The long faction sheet scrolls independently and needs keyboard access. */}
{house.name} faction sheet
Read public faction powers and alliance guidance without changing the game.
Faction sheet help
;
}
export function FactionSheetGallery() {
const [selected, setSelected] = useState('atreides');
return
Faction sheet setSelected(event.target.value as FactionId)}>{FACTIONS.map(house => {house.name} )}
;
}