import { redirect } from "next/navigation"; import { notFound } from "next/navigation"; import { getChapterVerseIndex } from "@/lib/api"; import { Card, CardContent } from "@/components/ui/card"; import { PageHeader } from "@/components/page-header"; import Link from "next/link"; import fs from "fs"; import path from "path"; const NBS_JSON_DIR = path.join(process.cwd(), "lib", "jsons", "books", "nbs"); type IntroSegment = { slug: string; title: string; paragraphs: string[]; }; export default async function NbsChapterPage({ params, }: { params: Promise<{ chapter: string }>; }) { const { chapter } = await params; // Handle intro segments (intro-introduction) if (chapter.startsWith("intro-")) { const rawSlug = chapter.replace(/^intro-/, ""); const filePath = path.join(NBS_JSON_DIR, "intro", `${rawSlug}.json`); if (!fs.existsSync(filePath)) notFound(); let segment: IntroSegment; try { segment = JSON.parse(fs.readFileSync(filePath, "utf-8")); } catch { notFound(); } return (