mongo fix
This commit is contained in:
@@ -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;
|
||||
@@ -20,28 +19,17 @@ type LilaInfo = {
|
||||
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 meta = await getBookMeta("cc");
|
||||
if (!meta) notFound();
|
||||
|
||||
const lilaInfo = intro.lilas.find((l) => l.key === lila);
|
||||
const lilas = meta.lilas as LilaInfo[];
|
||||
const lilaInfo = lilas.find((l) => l.key === lila);
|
||||
if (!lilaInfo) notFound();
|
||||
|
||||
const totalVerses = lilaInfo.chapters.reduce(
|
||||
|
||||
Reference in New Issue
Block a user