import type { ColumnDef } from "@tanstack/react-table"; import { Cog } from "lucide-react"; import Link from "next/link"; 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 { StatusBadge } from "~/pages/area-riservata/admin/edit-annuncio/[id]"; import type { Annunci } from "~/schemas/public/Annunci"; export const AnnunciTable = ({ data, }: { data: Pick< Annunci, "id" | "codice" | "titolo_it" | "comune" | "tipo" | "locatore" | "stato" >[]; }) => { const tabledata = data.map((row) => { return { id: row.id, codice: row.codice, titolo_it: row.titolo_it, comune: row.comune, tipo: row.tipo, locatore: row.locatore, stato: row.stato, actions: "Azioni", }; }); const columns_titles = { codice: "Codice", titolo_it: "Titolo", comune: "Comune", tipo: "Tipo", locatore: "Locatore", stato: "Stato", actions: "Azioni", }; type Column = (typeof tabledata)[number]; const columns: ColumnDef[] = [ { header: ({ column }) => ( ), accessorKey: "codice", }, { header: ({ column }) => ( ), accessorKey: "titolo_it", }, { header: ({ column }) => ( ), accessorKey: "comune", }, { header: ({ column }) => ( ), accessorKey: "tipo", }, { header: ({ column }) => ( ), accessorKey: "locatore", }, { header: ({ column }) => ( ), cell: ({ row }) => { return ; }, accessorKey: "stato", }, { header: ({ column }) => ( ), cell: ({ row }) => { return ( ); }, accessorKey: "actions", enableHiding: false, enableSorting: false, }, ]; const searchFiltro: SearchFiltro = { columnName: "codice", placeholder: "Filtra codice...", }; return (
); };