'use client'; import { Bookmark, Check, Trash2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { useSavedViews } from '@/hooks/use-saved-views'; interface SavedViewsDropdownProps { entityType: string; onApplyView: ( filters: Record, sort?: { field: string; direction: string }, ) => void; } /** * Read-only browser for saved views. The "Save current view" affordance * has moved into the ColumnPicker menu (see SaveViewDialog). This * component renders nothing when the user has no saved views — the * Bookmark button on its own is just visual noise until something has * been saved. */ export function SavedViewsDropdown({ entityType, onApplyView }: SavedViewsDropdownProps) { const { views, activeViewId, deleteView, applyView } = useSavedViews(entityType); if (views.length === 0) return null; return ( {views.map((view) => ( { applyView(view.id); onApplyView( view.filters as Record, view.sortConfig as { field: string; direction: string } | undefined, ); }} > {view.name}
{activeViewId === view.id && ( )}
))}
); }