'use client'; import { useId } from 'react'; import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'; import { Eye, X } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Dialog, DialogClose, DialogDescription, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import type { SpiceCard } from '@/game/cards'; import { territory } from '@/game/board'; import { PHASE_HELP } from '@/game/reference'; /** Only the supplied visible face is read. No deck, discard pile or game is accepted. */ export type SpiceCardInspectorProps = { card: Readonly; context?: string; }; export function spiceCardTitle(card: Readonly): string { if ('territory' in card) return `${territory(card.territory).name} · ${card.amount} spice · sector ${card.sector}`; if ('sandtrout' in card) return 'Sandtrout'; return `Shai-Hulud${card.thumper ? ' · Thumper encounter' : ''}${card.suppressed ? ' · suppressed' : ''}`; } /** Original vector illustration, with no claim to reproduce a printed card face. */ function SpiceIllustration({ kind, }: { kind: 'territory' | 'worm' | 'sandtrout'; }) { const paint = `${useId()}-dune`; return ( ); } export function SpiceCardInspector({ card, context }: SpiceCardInspectorProps) { const kind = 'territory' in card ? 'territory' : 'sandtrout' in card ? 'sandtrout' : 'worm'; const title = spiceCardTitle(card); const faceName = 'territory' in card ? territory(card.territory).name : kind === 'worm' ? 'Shai-Hulud' : 'Sandtrout'; const description = kind === 'territory' ? 'This spice blow names the territory, sector and base spice amount. The storm and card effects can change how much spice actually appears.' : kind === 'worm' ? 'A Shai-Hulud encounter can consume forces and spice in the territory identified by the preceding card in its spice discard pile. Resolve protection, Nexus and riding decisions through the table.' : 'Sandtrout breaks existing alliances and waits for the next active drawn Shai-Hulud. It suppresses that encounter, then the immediate replacement determines whether a spice blow is doubled.'; return ( } aria-label={`Inspect spice card: ${title}${context ? ` · ${context}` : ''}`} >
Spice card inspection } >

{kind === 'territory' ? 'Spice blow' : kind === 'worm' ? 'Worm encounter' : 'Sandtrout'}

{faceName} {'territory' in card && (
Card amount
{card.amount} spice
Sector
{card.sector}
)} {'worm' in card && card.thumper && (

Thumper-created encounter

)} {'worm' in card && card.suppressed && (

Suppressed by Sandtrout

)}

Spice · gameplay guide

{context && (

{context}

)} {description}

Inspection does not draw a card or resolve an effect. Close this view to use the table’s phase controls.

{kind === 'territory' ? (

Spice cannot appear in the storm’s sector. A fresh blow remains open for Harvester before acceptance. The amount on this face is the card’s base value, not the total spice currently on the board.

) : kind === 'worm' ? (

First-turn drawn worms are ignored and later shuffled back. A worm suppressed by Sandtrout does not devour the preceding territory or create its own Nexus or Fremen ride. A normal encounter follows the table’s worm and alliance decisions.

) : ( <>

Territories drawn before the next active Shai-Hulud receive their usual spice. Sandtrout remains pending until that worm is suppressed, even across spice blows or turns.

If the immediate replacement is a territory, double its spice; Harvester may enhance that fresh blow again. If the replacement is another Shai-Hulud, resolve it normally and do not double a later territory. Spice still cannot appear in the storm.

)}

{PHASE_HELP[1]}

); }