From 8009491245871b3d910c74b44a3adaf2e3c2327b Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sat, 18 Jul 2026 21:43:27 +0200 Subject: [PATCH] i18n events and polls admin DataTable columns. Wire column headers, search placeholders, and status/type labels through pages.admin.events/polls (en/nl/it), matching tickets-table. Co-authored-by: Cursor --- src/app/admin/events/events-table.tsx | 53 +++++++++++++++----------- src/app/admin/polls/polls-table.tsx | 54 ++++++++++++++++----------- src/messages/en.json | 27 +++++++++++++- src/messages/it.json | 27 +++++++++++++- src/messages/nl.json | 27 +++++++++++++- 5 files changed, 139 insertions(+), 49 deletions(-) diff --git a/src/app/admin/events/events-table.tsx b/src/app/admin/events/events-table.tsx index c76b050f..787f9dce 100644 --- a/src/app/admin/events/events-table.tsx +++ b/src/app/admin/events/events-table.tsx @@ -2,6 +2,7 @@ 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"; @@ -28,18 +29,31 @@ const statusVariants: Record< completed: "outline", }; -function getColumns(): DataTableColumn[] { - return [ - { key: "id", label: "ID", sortable: true }, +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: "Title", + label: t("colTitle"), sortable: true, render: (value) => {String(value)}, }, { key: "typeName", - label: "Type", + label: t("colType"), sortable: false, render: (_, row) => ( @@ -49,7 +63,7 @@ function getColumns(): DataTableColumn[] { }, { key: "startsAt", - label: "Starts", + label: t("colStarts"), sortable: true, render: (value) => ( @@ -59,17 +73,20 @@ function getColumns(): DataTableColumn[] { }, { key: "status", - label: "Status", + label: t("colStatus"), sortable: true, - render: (value) => ( - - {String(value)} - - ), + render: (value) => { + const key = String(value); + return ( + + {statusLabel[key] ?? key} + + ); + }, }, { key: "actions", - label: "Actions", + label: t("colActions"), render: (_, row) => (