import fs from "fs";
import path from "path";
import Link from "next/link";
import { ExtractedVerseCount } from "../extracted-verse-count";
type ChapterInfo = {
number: number;
title: string;
totalVerses: number;
};
type CantoInfo = {
number: number;
title: string;
totalChapters: number;
chapters: ChapterInfo[];
};
type Intro = {
book: string;
title: string;
author: string;
totalCantos: number;
cantos: CantoInfo[];
};
export default function SbPage() {
const introPath = path.join(process.cwd(), "app/lib/books/sb/intro.json");
const intro: Intro = JSON.parse(fs.readFileSync(introPath, "utf-8"));
return (
← Books
{intro.title}
{intro.author}
{intro.cantos.map((canto) => {
const totalVerses = canto.chapters.reduce(
(sum, ch) => sum + ch.totalVerses,
0,
);
return (
-
Canto {canto.number}
{canto.title}
{canto.totalChapters} chapters ยท{" "}
);
})}
);
}