import type { ColumnDef } from "@tanstack/react-table"; import { Cog } from "lucide-react"; import { DataTable } from "~/components/custom_ui/data-table"; import { DataTableColumnHeader } from "~/components/custom_ui/dataTable-header"; import type { SearchFiltro } from "~/components/custom_ui/dataTable-toolbar"; import { Etichetta } from "~/components/etichette"; import { Button } from "~/components/ui/button"; import type { Etichette } from "~/schemas/public/Etichette"; export const EtichetteTable = (props: { data: Etichette[]; setOpenEdit: (status: boolean) => void; setEditData: (data: Etichette | null) => void; }) => { const { data, setOpenEdit, setEditData } = props; const tabledata = data.map((row) => { return { actions: "Azioni", colore: row.color_hex, id: row.id_etichetta, title: row.title, }; }); const columns_titles = { actions: "Azioni", etichetta: "Etichetta", id: "Id", }; type Column = (typeof tabledata)[number]; const columns: ColumnDef[] = [ { accessorKey: "id", enableHiding: false, header: ({ column }) => ( ), }, { accessorKey: "title", cell: ({ row }) => { const data = row.original; return ( ); }, enableHiding: false, header: ({ column }) => ( ), }, { accessorKey: "actions", cell: ({ row }) => { const data = row.original; return ( ); }, enableHiding: false, enableSorting: false, header: ({ column }) => ( ), }, ]; const searchFiltro: SearchFiltro = { columnName: "title", placeholder: "Filtra codice...", }; return (
); };