"use client" import { z } from "zod" import { Button } from "@/components/ui/button" import { useSortable } from "@dnd-kit/sortable" import { ColumnDef, flexRender, Row } from "@tanstack/react-table" import { TableCell, TableRow } from "@/components/ui/table" import { CSS } from "@dnd-kit/utilities" import { schema, schemaType } from "./schema" import { dateToLocaleString } from "@/lib/utils" import { Pencil, Trash } from "lucide-react" export function DraggableRow({ row }: { row: Row> }) { const { transform, transition, setNodeRef, isDragging } = useSortable({ id: row.original._id }) return ( {row.getVisibleCells().map((cell) => ( {flexRender(cell.column.columnDef.cell, cell.getContext())} ))} ) } function getColumns(router: any, deleteHandler: (id: string) => void, buildId: string): ColumnDef[] { return [ { accessorKey: "addressGovCode", header: "Address Gov Code", }, { accessorKey: "no", header: "No", }, { accessorKey: "level", header: "Level", }, { accessorKey: "code", header: "Code", }, { accessorKey: "grossSize", header: "Gross Size", }, { accessorKey: "netSize", header: "Net Size", }, { accessorKey: "defaultAccessory", header: "Default Accessory", }, { accessorKey: "humanLivability", header: "Human Livability", }, { accessorKey: "key", header: "Key", }, { accessorKey: "directionId", header: "Direction ID", }, { accessorKey: "typeId", header: "Type ID", }, { accessorKey: "createdAt", header: "Created", cell: ({ getValue }) => dateToLocaleString(getValue() as string), }, { accessorKey: "updatedAt", header: "Updated", cell: ({ getValue }) => dateToLocaleString(getValue() as string), }, { accessorKey: "expiryStarts", header: "Expiry Starts", cell: ({ getValue }) => getValue() ? dateToLocaleString(getValue() as string) : "-", }, { accessorKey: "expiryEnds", header: "Expiry Ends", cell: ({ getValue }) => getValue() ? dateToLocaleString(getValue() as string) : "-", }, { id: "actions", header: "Actions", cell: ({ row }) => { return (
); }, } ] } export { getColumns };