import type { ComponentType, SVGProps } from 'react' import { Clock, Database, Layers, Repeat, Table } from 'lucide-react' import { ApiIcon, ChartBarIcon, CodeIcon, ConditionalIcon, ConnectIcon, CredentialIcon, HumanInTheLoopIcon, ResponseIcon, RssIcon, ScheduleIcon, ShieldCheckIcon, VariableIcon, WebhookIcon, WorkflowIcon, } from '@/components/icons' import { blockTypeToIconMap } from '@/components/ui/icon-mapping' /** * The two Sim-specific block glyphs we need, ported verbatim from * `apps/sim/components/icons.tsx` so the preview matches the real builder. * Other block types fall back to lucide-react stand-ins for now. */ export function StartIcon(props: SVGProps) { return ( ) } export function AgentIcon(props: SVGProps) { return ( ) } /** Block type → glyph. Brand glyphs from the app for core blocks; lucide stand-ins for the rest. */ export const BLOCK_ICONS: Record> = { starter: StartIcon, start_trigger: StartIcon, agent: AgentIcon, api: ApiIcon, condition: ConditionalIcon, credential: CredentialIcon, evaluator: ChartBarIcon, function: CodeIcon, guardrails: ShieldCheckIcon, human_in_the_loop: HumanInTheLoopIcon, response: ResponseIcon, router: ConnectIcon, variables: VariableIcon, wait: Clock, webhook: WebhookIcon, workflow: WorkflowIcon, schedule: ScheduleIcon, rss: RssIcon, loop: Repeat, parallel: Layers, knowledge_base: Database, knowledge: Database, table: Table, } /** * Resolves a block (or tool) type to its glyph: the core-block map first, then * the integration icon map so diagrams can render tool chips too. Returns * `null` when no glyph is registered. */ export function resolveIcon(type: string): ComponentType<{ className?: string }> | null { return BLOCK_ICONS[type] ?? blockTypeToIconMap[type] ?? null }