import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta, getProseChapters } from "@/lib/api"; import { buildOgMeta } from "@/lib/og"; import { BOOK_NAMES } from "@/lib/constants"; import { PageHeader } from "@/components/layout/page-header"; import { Card, CardContent } from "@/components/ui/card"; export async function generateMetadata({ params, }: { params: Promise<{ volume: string }>; }): Promise { const { volume } = await params; const title = BOOK_NAMES["kb"] || "KB"; return buildOgMeta({ title, detail: `Volume ${volume}` }); } 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.title}

  • ))}
)} {/* Chapters */}

Chapters

    {chapters.map((ch) => (
  • Chapter {ch.chapter}

    {ch.title}

  • ))}
); }