import type { ComponentSummary, HealthStatus } from "@/types" import { ComponentCard } from "./ComponentCard" const ROLE_ORDER = ["service", "tool", "worker", "job", "frontend", "remote", "containerized"] const ROLE_LABELS: Record = { service: "Services", tool: "Tools", worker: "Workers", job: "Jobs", frontend: "Frontends", remote: "Remote", containerized: "Containers", } interface ComponentGridProps { components: ComponentSummary[] statuses: HealthStatus[] } export function ComponentGrid({ components, statuses }: ComponentGridProps) { const statusMap = new Map(statuses.map((s) => [s.id, s])) // Group by primary role const groups = new Map() for (const comp of components) { const primary = comp.roles[0] ?? "tool" const list = groups.get(primary) ?? [] list.push(comp) groups.set(primary, list) } return (
{ROLE_ORDER.map((role) => { const items = groups.get(role) if (!items?.length) return null return (

{ROLE_LABELS[role] ?? role}

{items.map((comp) => ( ))}
) })}
) }