import { For, Show } from "solid-js"; import type { ModuleCatalog } from "@/api/client"; import { Badge } from "@/components/ui/badge"; import { moduleLabel, packageLabel } from "@/lib/module-labels"; import { useT } from "@/stores/preferences-context"; /** * The deployment catalog grouped by package, each module marked on/off for one * school. Read-only without `onToggle` (a school admin's view); with it, every * module row becomes a switch (the builder's switchboard). */ export function ModuleCatalogGrid(props: { catalog: ModuleCatalog; enabled: readonly string[]; onToggle?: (module: string, next: boolean) => void; onTogglePackage?: (pkg: string, next: boolean) => void; disabled?: boolean; /** One column regardless of viewport — for narrow hosts like a SidePanel. */ stacked?: boolean; }) { const t = useT(); const isOn = (module: string) => props.enabled.includes(module); const requiresOf = (module: string) => props.catalog.modules.find((entry) => entry.module === module)?.requires ?? []; return (
{t("modules.enabledCount", { on: String(onCount()), total: String(pkg.modules.length) })}
{moduleLabel(module, t)}
{t("modules.requires")}: {requiresOf(module).map((name) => moduleLabel(name, t)).join(", ")}