import Link from "next/link"; import { getTranslations } from "next-intl/server"; import { StatusCard } from "@/components/admin/dashboard"; import { prisma } from "@/lib/prisma"; import { redirect } from "next/navigation"; import { canAccess, getAdminContext, PERMS } from "@/lib/permissions"; export const dynamic = "force-dynamic"; export default async function AdminHelpQuestions() { const { session, permissions } = await getAdminContext(); if (!canAccess(permissions, PERMS.PAGES_VIEW, session.user.rank)) { redirect("/admin"); } const t = await getTranslations("pages.admin.helpCenter"); let entries: Awaited< ReturnType > = []; try { entries = await prisma.websiteHelpCenterCategories.findMany({ orderBy: [{ position: "asc" }, { id: "asc" }], take: 500, }); } catch { entries = []; } const smallBoxes = entries.filter((e) => e.smallBox).length; const withButton = entries.filter((e) => e.buttonText).length; return (
+ {t("newEntry")}

{t("entries")}

{entries.length === 0 ? (
{t("noEntries")}
) : ( {entries.map((e) => ( ))}
Pos. {t("colTitle")} Button Small box
{e.position} {e.name} {e.buttonText || "—"} {e.smallBox ? "Yes" : "No"} {t("edit")}
)}
); }