import type { JSX, ReactNode } from "react" import { notFound } from "next/navigation" import { ArrowLeft } from "lucide-react" import Link from "next/link" import { getTranslations } from "next-intl/server" import { Button } from "@/shared/components/ui/button" import { Badge } from "@/shared/components/ui/badge" import { getTextbookById, getChaptersByTextbookId, getKnowledgePointsByTextbookId } from "@/modules/textbooks/data-access" import { TextbookReader, type TextbookReaderProps } from "@/modules/textbooks/components/textbook-reader" import { TextbookSettingsDialog } from "@/modules/textbooks/components/textbook-settings-dialog" import { CreateQuestionDialog } from "@/modules/questions/components/create-question-dialog" import type { KnowledgePoint } from "@/modules/textbooks/types" export const dynamic = "force-dynamic" export default async function TextbookDetailPage({ params, }: { params: Promise<{ id: string }> }): Promise { const { id } = await params const t = await getTranslations("textbooks") const [textbook, chapters, knowledgePoints] = await Promise.all([ getTextbookById(id), getChaptersByTextbookId(id), getKnowledgePointsByTextbookId(id), ]) if (!textbook) { notFound() } // P0-1 在页面层注入 questions 模块的 CreateQuestionDialog 实现 const renderQuestionCreator: TextbookReaderProps["renderQuestionCreator"] = ({ open, onOpenChange, targetKp, }: { open: boolean onOpenChange: (open: boolean) => void targetKp: KnowledgePoint | null }): ReactNode => ( ) return (
{/* Header / Nav (Fixed height) */}
{textbook.subject} {textbook.grade}

{textbook.title}

{/* Main Content Layout (Flex grow) */}
) }