import type { ReactNode } from "react"; import { Card, CardContent, CardHeader, CardTitle } from "@/app/components/ui/card"; import { EmptyState } from "@/app/components/ui/states"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table"; import { cn } from "@/app/lib/utils"; export interface DashColumn { label: string; numeric?: boolean; cell: (row: R) => ReactNode; } /** A titled table that stacks into label/value cards below md (one DOM, CSS only). */ export function DashTable({ title, empty, columns, rows, rowKey }: { title: string; empty: string; columns: DashColumn[]; rows: R[]; rowKey: (row: R) => string; }) { return ( {title} {rows.length === 0 ? ( ) : ( {columns.map((c) => ( {c.label} ))} {rows.map((row) => ( {columns.map((c) => ( {c.cell(row)} ))} ))}
)}
); }