import type { IssueRecord } from "@issue/shared"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { cn } from "@/lib/utils"; export function IssuesTable({ issues, columns = {}, issueSelectAction, className, }: { issues: IssueRecord[]; columns?: { id?: boolean; title?: boolean; description?: boolean; assignee?: boolean }; issueSelectAction?: (issue: IssueRecord) => void; className: string; }) { if (issues.length === 0) return; return ( {(columns.id == null || columns.id === true) && ( ID )} {(columns.title == null || columns.title === true) && Title} {(columns.description == null || columns.description === true) && ( Description )} {/* below is kept blank to fill the space, used as the "Assignee" column */} {(columns.assignee == null || columns.assignee === true) && } {issues.map((issue) => ( { issueSelectAction?.(issue); }} > {(columns.id == null || columns.id === true) && ( {String(issue.id).padStart(3, "0")} )} {(columns.title == null || columns.title === true) && ( {issue.title} )} {(columns.description == null || columns.description === true) && ( {issue.description} )} {(columns.assignee == null || columns.assignee === true) && ( ? )} ))}
); }