import { notFound } from "next/navigation" import { ChapterContent } from "@/components/chapter-content" import { getSectionBySlug, getChapterBySectionSlug, getSectionContent } from "@/lib/book-file-system" import { specialSections } from "@/lib/book-data" interface ReadPageProps { params: Promise<{ id: string }> } export const dynamic = 'force-dynamic'; export default async function ReadPage({ params }: ReadPageProps) { const { id } = await params // Check special sections first // Note: Special sections might not have file paths in the dynamic system yet unless mapped // For now, we keep the hardcoded specialSections check but maybe we should map them to files too if (id === "preface") { return } if (id === "epilogue") { return } // Find regular section from dynamic file system const section = getSectionBySlug(id) if (!section) { notFound() } const context = getChapterBySectionSlug(id) if (!context) { notFound() } // Read content from file const content = getSectionContent(section.filePath) const sectionWithContent = { ...section, content } return }