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