"use client"; import { TableCellBadge } from "@/components/data-table/table-cell-badge"; import { TableCellDate } from "@/components/data-table/table-cell-date"; import { TableCellNumber } from "@/components/data-table/table-cell-number"; import { Button } from "@/components/ui/button"; import { DataTableColumnHeader } from "@/components/ui/data-table/data-table-column-header"; import { colors } from "@/data/status-report-updates.client"; import { cn } from "@/lib/utils"; import type { RouterOutputs } from "@openstatus/api"; import type { ColumnDef } from "@tanstack/react-table"; import { ChevronDown, ChevronUp } from "lucide-react"; import Link from "next/link"; import { DataTableRowActions } from "./data-table-row-actions"; type StatusReport = RouterOutputs["statusReport"]["list"][number]; export const columns: ColumnDef[] = [ { id: "expander", header: () => null, cell: ({ row }) => { return row.getCanExpand() ? ( ) : undefined; }, meta: { headerClassName: "w-7", }, }, { accessorKey: "title", header: "Title", enableSorting: false, enableHiding: false, meta: { cellClassName: "max-w-[200px] truncate", }, }, { accessorKey: "status", header: "Current Status", cell: ({ row }) => { const value = String(row.getValue("status")); return (
{value}
); }, enableSorting: false, enableHiding: false, }, { id: "updates", accessorFn: (row) => row.updates.length, header: "Total Updates", cell: ({ row }) => { const value = row.getValue("updates"); return ; }, }, { id: "pageComponents", accessorFn: (row) => row?.pageComponents, header: "Affected", cell: ({ row }) => { const value = row.getValue("pageComponents"); if (Array.isArray(value) && value.length > 0 && "name" in value[0]) { return (
{value.map((m) => m.monitorId ? ( ) : ( ), )}
); } return
-
; }, }, { id: "startedAt", accessorFn: (row) => row.updates.sort((a, b) => a.date.getTime() - b.date.getTime())[0]?.date, header: ({ column }) => ( ), cell: ({ row }) => , enableHiding: false, meta: { cellClassName: "w-[170px]", }, }, { id: "actions", cell: ({ row }) => , meta: { cellClassName: "w-8", }, }, ];