diff --git a/src/game/DeckBuilder.tsx b/src/game/DeckBuilder.tsx index fb170c4..07aedc6 100644 --- a/src/game/DeckBuilder.tsx +++ b/src/game/DeckBuilder.tsx @@ -2,15 +2,12 @@ import { useMemo, useState } from 'react'; import { Check, RotateCcw, Trash2 } from 'lucide-react'; import { GameCard } from './GameCard.tsx'; import { starterDeck } from './cards.ts'; -import type { Ruleset, UICard } from './types.ts'; +import { validateDeck, type Ruleset } from '../../shared/game/index.ts'; +import type { UICard } from './types.ts'; export function deckProblem(deck: UICard[], ruleset: Ruleset): string { if (deck.length !== ruleset.deckSize) return `A deck needs exactly ${ruleset.deckSize} cards (${deck.length} now).`; - const counts = new Map(); - for (const c of deck) counts.set(c.pageId, (counts.get(c.pageId) ?? 0) + 1); - const over = [...counts].find(([, n]) => n > ruleset.maxCopies); - if (over) return `At most ${ruleset.maxCopies} copies of the same article.`; - return ''; + return validateDeck(ruleset, deck.map(c => c.game))[0] ?? ''; } /** Soft advice (DESIGN.md s8): warn, never block, when the early curve is thin. */ @@ -19,8 +16,8 @@ export function deckWarning(deck: UICard[]): string { return cheap < 4 ? `Only ${cheap} card${cheap === 1 ? '' : 's'} cost 2 or less. Aim for at least 4 so you have early plays.` : ''; } -export function DeckBuilder({ pool, deck, ruleset, onSave, onCancel }: { - pool: UICard[]; deck: UICard[]; ruleset: Ruleset; onSave: (deck: UICard[]) => void; onCancel: () => void; +export function DeckBuilder({ pool, deck, ruleset, modeName, onSave, onCancel }: { + modeName: string; pool: UICard[]; deck: UICard[]; ruleset: Ruleset; onSave: (deck: UICard[]) => void; onCancel: () => void; }) { const [draft, setDraft] = useState(deck); const [filter, setFilter] = useState<'all' | 'starter' | 'nft'>('all'); @@ -37,7 +34,7 @@ export function DeckBuilder({ pool, deck, ruleset, onSave, onCancel }: { const full = draft.length >= ruleset.deckSize; return
-
DECK BUILDER · {ruleset.name.toUpperCase()}
+
DECK BUILDER · {modeName.toUpperCase()}

Your deck {draft.length} / {ruleset.deckSize}

Tap a card to add it or take it out. Loaner cards are free previews, not NFTs; nothing you do here moves a card on-chain.

{curve.map((n, i) =>
{i + 1}{i === 5 ? '+' : ''}{n}
)}
@@ -58,7 +55,7 @@ export function DeckBuilder({ pool, deck, ruleset, onSave, onCancel }: { {problem ?

{problem}

: warning &&

{warning}

}
- + diff --git a/src/game/GameCard.tsx b/src/game/GameCard.tsx index 03410b8..961a116 100644 --- a/src/game/GameCard.tsx +++ b/src/game/GameCard.tsx @@ -1,13 +1,23 @@ -import { BookOpen, Landmark, Leaf, Orbit, Palette, Users, Zap } from 'lucide-react'; -import type { UICard } from './types.ts'; +import { BookOpen, ChevronDown, ChevronUp, Eye, Globe2, Landmark, Leaf, Library, Orbit, Palette, Users, Zap } from 'lucide-react'; +import type { Stat, UICard } from './types.ts'; +import { STAT_LABEL } from './rulesText.ts'; const ICONS: Record = { Space: Orbit, Nature: Leaf, People: Users, Science: BookOpen, History: Landmark, Culture: Palette }; export const CategoryIcon = ({ category, size = 14 }: { category: string; size?: number }) => { const Icon = ICONS[category] ?? Palette; return