import Link from 'next/link'; import { prisma } from '@/lib/prisma'; import { deleteShout } from '@/actions/admin-radio-moderation'; import { StatusCard } from '@/components/admin/dashboard'; import { Shield } from 'lucide-react'; import { getTranslations } from "next-intl/server"; export const dynamic = 'force-dynamic'; type Shout = { id: bigint; userId: bigint; message: string; createdAt: Date | null; updatedAt: Date | null; }; function formatDate(d: Date | null): string { return d ? d.toISOString().slice(0, 16).replace('T', ' ') : '\u2014'; } export default async function AdminRadioModerationPage() { const t = await getTranslations("pages.admin.radio"); let shouts: Shout[] = []; try { shouts = await prisma.radioShouts.findMany({ select: { id: true, userId: true, message: true, createdAt: true, updatedAt: true, }, orderBy: { id: 'desc' }, take: 50, }); } catch { shouts = []; } return (

{t("moderationPage.title")}

{t("moderationPage.subtitle")}

{t("moderationPage.recentShouts", { count: shouts.length })}

{shouts.length === 0 ? (
{t("noShouts")}
) : ( {shouts.map((s) => ( ))}
ID {t("user")} {t("message")} {t("posted")}
{String(s.id)} {String(s.userId)} {s.message} {formatDate(s.createdAt)}
)}
); }