mongo fix

This commit is contained in:
gosangam
2026-04-14 19:12:11 +05:30
parent e2f8063d90
commit beffb9fae1
172 changed files with 18029 additions and 1298 deletions
+5 -17
View File
@@ -1,10 +1,9 @@
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";
import { getBookMeta } from "@/lib/api";
type ChapterInfo = {
number: number;
@@ -19,19 +18,6 @@ type CantoInfo = {
chapters: ChapterInfo[];
};
type Intro = {
book: string;
title: string;
author: string;
totalCantos: number;
cantos: CantoInfo[];
};
function getIntro(): Intro {
const introPath = path.join(process.cwd(), "app/lib/books/sb/intro.json");
return JSON.parse(fs.readFileSync(introPath, "utf-8"));
}
export default async function CantoPage({
params,
}: {
@@ -39,9 +25,11 @@ export default async function CantoPage({
}) {
const { canto } = await params;
const cantoNum = parseInt(canto);
const intro = getIntro();
const meta = await getBookMeta("sb");
if (!meta) notFound();
const cantoInfo = intro.cantos.find((c) => c.number === cantoNum);
const cantos = (meta as unknown as { cantos: CantoInfo[] }).cantos;
const cantoInfo = cantos.find((c) => c.number === cantoNum);
if (!cantoInfo) notFound();
const totalVerses = cantoInfo.chapters.reduce(