import type { Metadata } from "next"; import Link from "next/link"; import { PageHeader } from "@/components/page-header"; import { notFound } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../../extracted-verse-count"; import { getBookMeta } from "@/lib/api"; import { buildOgMeta } from "@/lib/og"; import { BOOK_NAMES, CC_LILAS } from "@/lib/constants"; export async function generateMetadata({ params, }: { params: Promise<{ lila: string }>; }): Promise { const { lila } = await params; const lilaName = CC_LILAS[lila] || lila; const bookTitle = BOOK_NAMES["cc"] || "Śrī Caitanya-caritāmṛta"; return buildOgMeta({ title: bookTitle, detail: lilaName, }); } type ChapterInfo = { number: number; title: string; totalVerses: number; }; type LilaInfo = { key: string; name: string; totalChapters: number; totalVerses: number; chapters: ChapterInfo[]; }; export default async function LilaPage({ params, }: { params: Promise<{ lila: string }>; }) { const { lila } = await params; const meta = await getBookMeta("cc"); if (!meta) notFound(); const lilas = meta.lilas as LilaInfo[]; const lilaInfo = lilas.find((l) => l.key === lila); if (!lilaInfo) notFound(); const totalVerses = lilaInfo.chapters.reduce( (sum, ch) => sum + ch.totalVerses, 0, ); return (
← Śrī Caitanya-caritāmṛta

{lilaInfo.name}

{lilaInfo.totalChapters} chapters ·{" "}

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

    {ch.title}

  • ))}
); }