import Link from "next/link";
import { notFound } from "next/navigation";
import { getBookMeta, getProseChapters } from "@/lib/api";
import { PageHeader } from "@/components/page-header";
import { Card, CardContent } from "@/components/ui/card";
export default async function KbVolumePage({
params,
}: {
params: Promise<{ volume: string }>;
}) {
const { volume } = await params;
const vol = parseInt(volume);
if (isNaN(vol) || vol < 1 || vol > 2) notFound();
const meta = await getBookMeta("kb");
if (!meta) notFound();
const title = meta.title as string;
const [introSegments, chapters] = await Promise.all([
getProseChapters("kb", vol, "intro-segment"),
getProseChapters("kb", vol, "chapter"),
]);
return (
← {title}
Volume {vol}
{chapters.length} chapters
{/* Front Matter */}
{introSegments.length > 0 && (
Front Matter
{introSegments.map((seg) => (
-
{seg.paragraphs.length} paragraphs
))}
)}
{/* Chapters */}
Chapters
{chapters.map((ch) => (
-
Chapter {ch.chapter}
{ch.title}
{ch.paragraphs.length} paragraphs
))}
);
}