import Link from "next/link"; import { getTranslations } from "next-intl/server"; import { fetchAdminList } from "@/lib/admin-list"; import { PERMS } from "@/lib/permissions"; import { EventsTable } from "./events-table"; export default async function EventsPage({ params: paramsPromise, searchParams, }: { params: Promise<{ locale: string }>; searchParams: Promise>; }) { const t = await getTranslations("pages.admin.events"); const result = await fetchAdminList( { permission: PERMS.EVENTS_VIEW, model: "websiteEvent", searchFields: ["title"], defaultSort: { startsAt: "desc" }, include: { type: { select: { name: true, color: true } } }, mapRow: (e: { id: number; title: string; type: { name: string; color: string }; startsAt: Date; endsAt: Date | null; status: string; hostUserId: number; _count?: { registrations: number }; }) => ({ id: e.id, title: e.title, typeName: e.type.name, typeColor: e.type.color, startsAt: e.startsAt, endsAt: e.endsAt, status: e.status, hostUserId: e.hostUserId, }), }, paramsPromise, searchParams, ); return (
{t("newEvent")}
); }