import { getTranslations } from "next-intl/server"; import Link from "next/link"; import { ContentCard, EmptyState } from "@/components/public/ui"; import { excerpt } from "@/lib/format"; import { prisma } from "@/lib/prisma"; export const dynamic = "force-dynamic"; export const metadata = { title: "News" }; function formatDate(d: Date | null): string { return d ? d.toISOString().slice(0, 10) : ""; } export default async function NewsPage() { const t = await getTranslations("pages.news"); let articles: Awaited> = []; try { articles = await prisma.websiteArticles.findMany({ orderBy: { createdAt: "desc" }, take: 30, }); } catch { // DB unavailable — render the empty state rather than a 500. articles = []; } return (
{articles.length === 0 ? ( {t("noArticles")} ) : (
{articles.map((a) => (

{a.title}

{formatDate(a.createdAt)}

{excerpt(a.shortStory, 200)}

))}
)}
); }