import { NewsCard } from "@/components/news-card"; import { getPages } from "@/lib/pages/repository"; import { PAGE_TYPES, PageType } from "@/lib/pages/types"; import { getCurrentUser } from "@/lib/user"; import { Metadata } from "next"; import { notFound, redirect } from "next/navigation"; export const metadata: Metadata = { title: "Pages" }; export default async function Pages({ params }: { params: Promise<{ type: string }> }) { const user = await getCurrentUser(); if (!user?.isAdmin) redirect("/"); const { type } = await params; if (!PAGE_TYPES.includes(type as PageType)) { notFound(); } const pages = await getPages(type as PageType, "PUBLISHED"); return (