import type { PartnerInfo } from "../api/client" type Props = { partners: PartnerInfo[] selected: string onSelect: (key: string) => void } const DIFFICULTY_PILLS: Record = { easy: "bg-ink-800 text-ink-400", medium: "bg-hanabi-blue/20 text-hanabi-blue", hard: "bg-hanabi-yellow/20 text-hanabi-yellow", "human-like": "bg-hanabi-green/20 text-hanabi-green", } // Card-grid picker. Clicking a card selects it and expands its // description. Groups partners by primary tag so the picker has structure. const GROUP_ORDER = ["heuristic", "learned", "human-proxy", "specialist", "sequential", "greedy", "entitled", "walton-rivers", "reference", "pretrained"] const GROUP_LABELS: Record = { "heuristic": "Heuristic baselines", "walton-rivers": "Walton-Rivers heuristics", "learned": "Learned (RL)", "human-proxy": "Human proxy (BC)", "specialist": "Specialist heuristics", "sequential": "Sequential heuristics", "greedy": "Greedy heuristics", "entitled": "Entitled (cooperative)", "reference": "Reference implementations", "pretrained": "Pretrained (published)", } function groupPartners(partners: PartnerInfo[]): Array<{label: string; items: PartnerInfo[]}> { const groups = new Map() for (const p of partners) { // pick the most specific (later-in-order) tag for grouping const primary = [...p.tags].reverse().find((t) => t in GROUP_LABELS) ?? p.tags[0] ?? "heuristic" if (!groups.has(primary)) groups.set(primary, []) groups.get(primary)!.push(p) } return GROUP_ORDER .filter((k) => groups.has(k)) .map((k) => ({ label: GROUP_LABELS[k] ?? k, items: groups.get(k)! })) } export function PartnerPicker({ partners, selected, onSelect }: Props) { const groups = groupPartners(partners) return (
{groups.map(({ label, items }) => (

{label}

{items.map((p) => renderCard(p, selected, onSelect))}
))}
) } function renderCard(p: PartnerInfo, selected: string, onSelect: (k: string) => void) { const active = p.key === selected return ( ) }