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
+16 -17
View File
@@ -1,6 +1,5 @@
import fs from "fs";
import path from "path";
import Link from "next/link";
import { getBookMeta } from "@/lib/api";
import { PageHeader } from "@/components/page-header";
import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
@@ -20,17 +19,19 @@ type LilaInfo = {
chapters: ChapterInfo[];
};
type Intro = {
book: string;
title: string;
author: string;
totalLilas: number;
lilas: LilaInfo[];
};
export default async function CcPage() {
const meta = await getBookMeta("cc");
if (!meta) {
return (
<div className="p-8 text-center text-muted-foreground">
Book metadata not found.
</div>
);
}
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"));
const lilas = meta.lilas as LilaInfo[];
const title = meta.title as string;
const author = meta.author as string;
return (
<div className="min-h-screen bg-background">
@@ -41,16 +42,14 @@ export default function CcPage() {
>
&larr; Books
</Link>
<h1 className="mt-3 text-3xl font-bold text-foreground">
{intro.title}
</h1>
<p className="mt-1 text-muted-foreground">{intro.author}</p>
<h1 className="mt-3 text-3xl font-bold text-foreground">{title}</h1>
<p className="mt-1 text-muted-foreground">{author}</p>
</PageHeader>
<main className="max-w-3xl mx-auto px-6 py-8">
<Card className="divide-y divide-border">
<CardContent className="p-0">
<ul className="divide-y divide-border">
{intro.lilas.map((lila) => {
{lilas.map((lila) => {
const totalVerses = lila.chapters.reduce(
(sum, ch) => sum + ch.totalVerses,
0,