"use client"; import type { RouterOutputs } from "@openstatus/api"; import type { ColumnDef } from "@tanstack/react-table"; import { formatDistanceStrict } from "date-fns"; import { ProcessMessage } from "@/components/content/process-message"; import { TableCellDate } from "@/components/data-table/table-cell-date"; import { TableCellNumber } from "@/components/data-table/table-cell-number"; import { DataTableColumnHeader } from "@/components/ui/data-table/data-table-column-header"; import { DataTableRowActions } from "./data-table-row-actions"; type Maintenance = RouterOutputs["maintenance"]["list"][number]; export const columns: ColumnDef[] = [ { accessorKey: "title", header: "Title", enableSorting: false, enableHiding: false, meta: { cellClassName: "max-w-[200px] truncate", }, }, { accessorKey: "message", header: "Message", enableSorting: false, enableHiding: false, cell: ({ row }) => { const value = String(row.getValue("message")); return (
); }, }, { accessorKey: "from", header: ({ column }) => ( ), cell: ({ row }) => , enableHiding: false, }, { id: "duration", accessorFn: (row) => formatDistanceStrict(row.from, row.to), header: "Duration", cell: ({ row }) => { const value = row.getValue("duration"); if (typeof value === "string") { const [amount, unit] = value.split(" "); return ; } return ; }, }, { id: "actions", cell: ({ row }) => , meta: { cellClassName: "w-8", }, }, ];