import Link from "next/link"; import { StatusCard } from "@/components/admin/dashboard"; import { deleteArticle } from "@/actions/admin-articles"; import { prisma } from "@/lib/prisma"; export const dynamic = "force-dynamic"; export default async function AdminArticles({ searchParams, }: { searchParams: Promise<{ error?: string }>; }) { const { error } = await searchParams; const articles = await prisma.websiteArticles .findMany({ orderBy: { createdAt: "desc" }, select: { id: true, title: true, slug: true, createdAt: true }, take: 50, }) .catch(() => []); const latest = articles[0]?.createdAt ? articles[0].createdAt.toISOString().slice(0, 10) : "—"; return (

Articles

+ New article

News articles (website_articles) shown on the public site. 50 most recent.

{error ? (

Error: {error}

) : null}

Recent articles

{articles.length === 0 ? (

No articles yet.

) : ( {articles.map((a) => ( ))}
Title Slug Created Actions
{a.title} {a.slug} {a.createdAt ? a.createdAt.toISOString().slice(0, 10) : "—"}
Edit
)}
); }