export const dynamic = "force-dynamic"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getJournalContent, getJournalMeta, getJournalSidebarItems, slugToBookCode, type JournalSidebarItem, } from "@/lib/journals"; 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"; export default async function JournalChapterPage({ params, }: { params: Promise<{ slug: string; chapter: string }>; }) { const { slug, chapter: chapterSlug } = await params; const bookCode = slugToBookCode(slug); const [meta, content, sidebarItems] = await Promise.all([ getJournalMeta(bookCode), getJournalContent(bookCode, chapterSlug), getJournalSidebarItems(bookCode), ]); if (!meta || !content) notFound(); // Filter out heading items for prev/next navigation const navItems = sidebarItems.filter((item) => item.type !== "heading"); const currentIdx = navItems.findIndex((item) => item.slug === chapterSlug); const prev = currentIdx > 0 ? navItems[currentIdx - 1] : null; const next = currentIdx < navItems.length - 1 ? navItems[currentIdx + 1] : null; return (