"use client"; import { useTranslations } from "next-intl"; import { DataTable } from "@/components/admin/data-table"; import Link from "@/components/link"; import { Badge } from "@/components/ui/badge"; import type { TicketInboxRow } from "@/lib/admin/ticket-inbox"; import type { DataTableColumn, PaginatedResult } from "@/types/common"; export function UnifiedTicketsTable({ data, }: { data: PaginatedResult; }) { const t = useTranslations("pages.admin.ticketInbox"); const columns: DataTableColumn[] = [ { key: "title", label: t("colTicket"), sortable: false, render: (_value, row) => (
{row.kind === "cms" ? t("typeCms") : t("typeHelp")} #{row.id} {row.title}
{t("meta", { user: row.user })}
), }, { key: "status", label: t("colStatus"), sortable: false, filterKey: "filter_status", filterOptions: [ { label: t("statusOpen"), value: "open" }, { label: t("statusAll"), value: "all" }, ], render: (_value, row) => ( {row.kind === "cms" ? row.status.replace("_", " ") : row.open ? t("statusOpen") : t("statusClosed")} ), }, { key: "kind", label: t("colType"), sortable: false, filterKey: "filter_type", filterOptions: [ { label: t("typeAll"), value: "all" }, { label: t("typeCms"), value: "cms" }, { label: t("typeHelp"), value: "help" }, ], render: (value) => { const kind = String(value); return ( {kind === "cms" ? t("typeCms") : t("typeHelp")} ); }, }, { key: "date", label: t("colUpdated"), sortable: false }, ]; return ( ); }