import fs from "fs";
import path from "path";
import Link from "next/link";
import { PageHeader } from "@/components/page-header";
import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
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[];
};
export default function CcPage() {
const introPath = path.join(process.cwd(), "app/lib/books/cc/intro.json");
const intro: Intro = JSON.parse(fs.readFileSync(introPath, "utf-8"));
return (
← Books
{intro.title}
{intro.author}
{intro.lilas.map((lila) => {
const totalVerses = lila.chapters.reduce(
(sum, ch) => sum + ch.totalVerses,
0,
);
return (
-
{lila.name}
{lila.totalChapters} chapters
);
})}
);
}