import fs from "fs"; import path from "path"; 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"; type ChapterInfo = { number: number; title: string; totalVerses: number; }; type LilaInfo = { key: string; name: string; totalChapters: number; totalVerses: number; chapters: ChapterInfo[]; }; type Intro = { book: string; title: string; author: string; totalLilas: number; lilas: LilaInfo[]; }; function getIntro(): Intro { const introPath = path.join(process.cwd(), "app/lib/books/cc/intro.json"); return JSON.parse(fs.readFileSync(introPath, "utf-8")); } export default async function LilaPage({ params, }: { params: Promise<{ lila: string }>; }) { const { lila } = await params; const intro = getIntro(); const lilaInfo = intro.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}

  • ))}
); }