'use client' import { getWidgetsForRole, type WidgetDefinition } from '@/lib/widgets/registry' import type { Role } from '@/contexts/auth-context' import type { WidgetLayoutItem } from '@/lib/api/dashboard' import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription, } from '@/components/ui/sheet' import { Button } from '@/components/ui/button' import { Separator } from '@/components/ui/separator' import { HugeiconsIcon } from '@hugeicons/react' import { Add01Icon } from '@hugeicons/core-free-icons' interface WidgetPickerProps { open: boolean onClose: () => void role: Role currentLayout: WidgetLayoutItem[] onAdd: (widgetType: string) => void } export function WidgetPicker({ open, onClose, role, currentLayout, onAdd }: WidgetPickerProps) { const available = getWidgetsForRole(role) const activeTypes = new Set(currentLayout.map(l => l.widgetType)) function handleAdd(def: WidgetDefinition) { onAdd(def.type) onClose() } return ( { if (!v) onClose() }}> Add Widget Choose a widget to add to your dashboard.
{available.map(def => { const alreadyAdded = activeTypes.has(def.type) return (

{def.label}

{def.description}

Default size: {def.defaultW}×{def.defaultH}

) })}
) }