"use client"; import { Badge } from "@/components/ui/badge"; import { DataTableColumnHeader } from "@/components/ui/data-table/data-table-column-header"; import { type NotifierProvider, config } from "@/data/notifications.client"; import type { RouterOutputs } from "@openstatus/api"; import type { ColumnDef } from "@tanstack/react-table"; import Link from "next/link"; import { TableCellBadge } from "../table-cell-badge"; import { DataTableRowActions } from "./data-table-row-actions"; type Notifier = RouterOutputs["notification"]["list"][number]; export const columns: ColumnDef[] = [ { accessorKey: "name", header: ({ column }) => ( ), enableHiding: false, }, { accessorKey: "provider", header: "Provider", enableSorting: false, enableHiding: false, cell: ({ row }) => { const provider = row.getValue("provider") as NotifierProvider; const Icon = config[provider].icon; return ( {config[provider].label} ); }, }, { accessorKey: "monitors", header: "Monitors", enableSorting: false, enableHiding: false, cell: ({ row }) => { const value = row.getValue("monitors"); if (Array.isArray(value) && value.length > 0 && "name" in value[0]) { return (
{value.map((m) => ( ))}
); } return -; }, meta: { cellClassName: "tabular-nums font-mono", }, }, { id: "actions", cell: ({ row }) => , meta: { cellClassName: "w-8", }, }, ];