"use client"; import type { Table } from "@tanstack/react-table"; import { Settings2 } from "lucide-react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; export interface DataTableViewOptionsLabels { view: string; toggleColumns: string; } const DEFAULT_LABELS: DataTableViewOptionsLabels = { view: "View", toggleColumns: "Toggle columns", }; interface DataTableViewOptionsProps { table: Table; labels?: Partial; } export function DataTableViewOptions({ table, labels, }: DataTableViewOptionsProps) { const t = { ...DEFAULT_LABELS, ...labels }; return ( {t.toggleColumns} {table .getAllColumns() .filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide()) .map((column) => ( column.toggleVisibility(Boolean(value))} > {column.id} ))} ); }