32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { notFound } from "next/navigation";
|
|
import { LegacyPage } from "@/components/LegacyPage";
|
|
import { legacyPages, type LegacyPageKey } from "@/lib/legacy-pages";
|
|
|
|
const routablePages = new Set(Object.keys(legacyPages));
|
|
const replacedPages = new Set(["home", "start", "ask", "thanks"]);
|
|
|
|
export function generateStaticParams() {
|
|
return Object.keys(legacyPages)
|
|
.filter((page) => !replacedPages.has(page))
|
|
.map((page) => ({ page }));
|
|
}
|
|
|
|
export async function generateMetadata({ params }: { params: Promise<{ page: string }> }) {
|
|
const { page: pageParam } = await params;
|
|
if (!routablePages.has(pageParam)) return {};
|
|
const page = legacyPages[pageParam as LegacyPageKey];
|
|
return {
|
|
title: page.title.replace("Paprika - ", "")
|
|
};
|
|
}
|
|
|
|
export default async function StaticPage({ params }: { params: Promise<{ page: string }> }) {
|
|
const { page } = await params;
|
|
|
|
if (!routablePages.has(page) || replacedPages.has(page)) {
|
|
notFound();
|
|
}
|
|
|
|
return <LegacyPage pageKey={page as LegacyPageKey} />;
|
|
}
|