feat: allow path params for verse navigation

This commit is contained in:
gosangam
2026-04-15 13:41:34 +05:30
parent c0a00d4c04
commit abb7cc49d0
19 changed files with 1462 additions and 261 deletions
+16 -2
View File
@@ -16,7 +16,7 @@ type ChapterEntry = { totalVerses: number };
type CantoEntry = { totalChapters: number; chapters: ChapterEntry[] };
type LilaEntry = { totalChapters: number; chapters: ChapterEntry[] };
interface BgMeta extends BookMeta {
interface ChapterBookMeta extends BookMeta {
totalChapters: number;
chapters: ChapterEntry[];
}
@@ -49,7 +49,7 @@ function buildBookList(allBooks: BookMeta[]): BookInfo[] {
const author = data.author as string;
if (slug === "bg") {
const bg = data as BgMeta;
const bg = data as ChapterBookMeta;
const totalVerses = bg.chapters.reduce(
(sum, ch) => sum + ch.totalVerses,
0,
@@ -62,6 +62,20 @@ function buildBookList(allBooks: BookMeta[]): BookInfo[] {
totalVerses,
href: "/books/bg",
});
} else if (slug === "sb1962") {
const sb62 = data as ChapterBookMeta;
const totalVerses = sb62.chapters.reduce(
(sum, ch) => sum + ch.totalVerses,
0,
);
books.push({
slug,
title,
author,
description: `${sb62.totalChapters} chapters · First Canto`,
totalVerses,
href: "/books/sb1962",
});
} else if (slug === "sb") {
const sb = data as SbMeta;
const totalChapters = sb.cantos.reduce(