Openstatus www.openstatus.dev
at main 57 lines 1.5 kB view raw
1"use client"; 2 3import { DataTableColumnHeader } from "@/components/ui/data-table/data-table-column-header"; 4import type { RouterOutputs } from "@openstatus/api"; 5import type { ColumnDef } from "@tanstack/react-table"; 6import { DataTableRowActions } from "./data-table-row-actions"; 7 8type PageComponent = RouterOutputs["pageComponent"]["list"][number]; 9 10export const columns: ColumnDef<PageComponent>[] = [ 11 { 12 accessorKey: "name", 13 header: "Name", 14 enableSorting: false, 15 enableHiding: false, 16 }, 17 { 18 accessorKey: "description", 19 header: "Description", 20 enableSorting: false, 21 cell: ({ row }) => { 22 const value = row.getValue("description"); 23 return ( 24 <span className="max-w-[200px] truncate text-muted-foreground"> 25 {value ? String(value) : "-"} 26 </span> 27 ); 28 }, 29 }, 30 { 31 accessorKey: "type", 32 header: ({ column }) => ( 33 <DataTableColumnHeader column={column} title="Type" /> 34 ), 35 cell: ({ row }) => { 36 const value = row.getValue("type"); 37 return <span className="capitalize">{String(value)}</span>; 38 }, 39 }, 40 { 41 accessorKey: "order", 42 header: ({ column }) => ( 43 <DataTableColumnHeader column={column} title="Order" /> 44 ), 45 cell: ({ row }) => { 46 const value = row.getValue("order"); 47 return <span>{value != null ? String(value) : "-"}</span>; 48 }, 49 }, 50 { 51 id: "actions", 52 cell: ({ row }) => <DataTableRowActions row={row} />, 53 meta: { 54 cellClassName: "w-8", 55 }, 56 }, 57];