"use client"; import { Pencil } from "lucide-react"; import Link from "next/link"; import { useTranslations } from "next-intl"; import { DataTable } from "@/components/admin/data-table"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import type { DataTableColumn, PaginatedResult } from "@/types"; interface EventRow { id: number; title: string; typeName: string; typeColor: string; startsAt: Date; endsAt: Date | null; status: string; hostUserId: number; } const statusVariants: Record< string, "default" | "secondary" | "outline" | "destructive" > = { published: "default", draft: "secondary", cancelled: "destructive", completed: "outline", }; interface EventsTableProps { data: PaginatedResult; } export function EventsTable({ data }: EventsTableProps) { const t = useTranslations("pages.admin.events"); const statusLabel: Record = { published: t("statusPublished"), draft: t("statusDraft"), cancelled: t("statusCancelled"), completed: t("statusCompleted"), }; const columns: DataTableColumn[] = [ { key: "id", label: t("colId"), sortable: true }, { key: "title", label: t("colTitle"), sortable: true, render: (value) => {String(value)}, }, { key: "typeName", label: t("colType"), sortable: false, render: (_, row) => ( {row.typeName} ), }, { key: "startsAt", label: t("colStarts"), sortable: true, render: (value) => ( {new Date(value as unknown as string).toLocaleString()} ), }, { key: "status", label: t("colStatus"), sortable: true, render: (value) => { const key = String(value); return ( {statusLabel[key] ?? key} ); }, }, { key: "actions", label: t("colActions"), render: (_, row) => ( ), }, ]; return ( ); }