export const dynamic = "force-dynamic"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getOtherDocumentContent, getOtherDocumentMeta, getOtherDocumentSidebarItems, slugToBookCode, type OtherDocumentSidebarItem, } from "@/lib/other-documents"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { buttonVariants } from "@/components/ui/button"; import { ChevronLeft, ChevronRight } from "lucide-react"; import { cn } from "@/lib/utils"; import { MobileNav, type MobileNavGroup } from "@/components/mobile-nav"; // --------------------------------------------------------------------------- // Page // --------------------------------------------------------------------------- export default async function OtherDocumentChapterPage({ params, }: { params: Promise<{ slug: string; chapter: string }>; }) { const { slug, chapter: chapterSlug } = await params; const bookCode = slugToBookCode(slug); const [meta, content, sidebarItems] = await Promise.all([ getOtherDocumentMeta(bookCode), getOtherDocumentContent(bookCode, chapterSlug), getOtherDocumentSidebarItems(bookCode), ]); if (!meta || !content) notFound(); const currentIdx = sidebarItems.findIndex( (item) => item.slug === chapterSlug, ); const prev = currentIdx > 0 ? sidebarItems[currentIdx - 1] : null; const next = currentIdx < sidebarItems.length - 1 ? sidebarItems[currentIdx + 1] : null; return (