"use client" import { type ColumnDef } from "@tanstack/react-table" import { Badge } from "@/registry/new-york-v4/ui/badge" import { Checkbox } from "@/registry/new-york-v4/ui/checkbox" import { labels, priorities, statuses } from "../data/data" import { type Task } from "../data/schema" import { DataTableColumnHeader } from "./data-table-column-header" import { DataTableRowActions } from "./data-table-row-actions" export const columns: ColumnDef[] = [ { id: "select", header: ({ table }) => ( table.toggleAllPageRowsSelected(!!value)} aria-label="Select all" className="translate-y-[2px]" /> ), cell: ({ row }) => ( row.toggleSelected(!!value)} aria-label="Select row" className="translate-y-[2px]" /> ), enableSorting: false, enableHiding: false, }, { accessorKey: "id", header: ({ column }) => ( ), cell: ({ row }) =>
{row.getValue("id")}
, enableSorting: false, enableHiding: false, }, { accessorKey: "title", header: ({ column }) => ( ), cell: ({ row }) => { const label = labels.find((label) => label.value === row.original.label) return (
{label && {label.label}} {row.getValue("title")}
) }, }, { accessorKey: "status", header: ({ column }) => ( ), cell: ({ row }) => { const status = statuses.find( (status) => status.value === row.getValue("status") ) if (!status) { return null } return (
{status.icon && ( )} {status.label}
) }, filterFn: (row, id, value) => { return value.includes(row.getValue(id)) }, }, { accessorKey: "priority", header: ({ column }) => ( ), cell: ({ row }) => { const priority = priorities.find( (priority) => priority.value === row.getValue("priority") ) if (!priority) { return null } return (
{priority.icon && ( )} {priority.label}
) }, filterFn: (row, id, value) => { return value.includes(row.getValue(id)) }, }, { id: "actions", cell: ({ row }) => , }, ]