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 { Button } from "~/components/ui/button"; import type { Banlist } from "~/schemas/public/Banlist"; export const BanlistTable = (props: { data: Banlist[]; setOpenEdit: (status: boolean) => void; setEditData: (data: Banlist | null) => void; }) => { const { data, setOpenEdit, setEditData } = props; const tabledata = data.map((row) => { return { actions: "Azioni", id: row.id, type: row.type, value: row.value, }; }); const columns_titles = { actions: "Azioni", id: "Codice", type: "Tipo", value: "Valore", }; type Column = (typeof tabledata)[number]; const columns: ColumnDef[] = [ { accessorKey: "id", header: ({ column }) => ( ), }, { accessorKey: "type", header: ({ column }) => ( ), }, { accessorKey: "value", header: ({ column }) => ( ), }, { accessorKey: "actions", cell: ({ row }) => { const data = row.original; return ( ); }, enableHiding: false, enableSorting: false, header: ({ column }) => ( ), }, ]; const searchFiltro: SearchFiltro = { columnName: "value", placeholder: "Filtra ...", }; return (
); };