import { useState } from 'react' import type { ParamField } from '../../../engine/module' import type { ModuleInstance } from '../../../engine/types' import { catColor } from '../catColor' import { Toggle } from '../primitives' import { ParamForm } from './ParamForm' /** The subset of a module definition the card needs — satisfied by both * CapModuleDef and ExpansionModuleDef, so one card serves both tabs. */ export interface CardDef { label: string blurb: string category: string paramSchema: ParamField[] } export interface CardActions { toggle: (instanceId: string) => void remove: (instanceId: string) => void move: (instanceId: string, dir: -1 | 1) => void updateParam: (instanceId: string, key: string, value: unknown) => void } export function ModuleCard({ def, instance, index, count, actions, }: { def: CardDef instance: ModuleInstance index: number count: number actions: CardActions }) { const [open, setOpen] = useState(false) return (