export const dynamic = "force-dynamic"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getVaContent, getVaSidebarItems, type VaChapter, type VaSidebarItem, } from "@/lib/va"; 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 VaChapterPage({ params, }: { params: Promise<{ chapter: string }>; }) { const { chapter: slug } = await params; const content = await getVaContent(slug); if (!content) notFound(); const sidebarItems = await getVaSidebarItems(); const currentIdx = sidebarItems.findIndex((item) => item.slug === slug); const prev = currentIdx > 0 ? sidebarItems[currentIdx - 1] : null; const next = currentIdx < sidebarItems.length - 1 ? sidebarItems[currentIdx + 1] : null; const chapterNum = (content as VaChapter).chapter; return (
← Vaiśiṣṭyāṣṭakam

{content.title}

{content.paragraphs.map((paragraph, i) => (
))}
); } function VaSidebar({ items, currentSlug, }: { items: VaSidebarItem[]; currentSlug: string; }) { return ( ); } function VaNav({ prev, next, sidebarItems, currentSlug, }: { prev: VaSidebarItem | null; next: VaSidebarItem | null; sidebarItems: VaSidebarItem[]; currentSlug: string; }) { const mobileNavGroups: MobileNavGroup[] = []; if (sidebarItems.length > 0) { mobileNavGroups.push({ title: "Chapters", items: sidebarItems.map((i) => ({ slug: i.slug, label: i.label, href: `/books/va/${i.slug}`, type: i.type, })), }); } return (
{prev ? ( {prev.label} Previous ) : (
)}
{next ? ( {next.label} Next ) : (
)}
); }