import type { JSX } 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 } from "@/modules/textbooks/data-access" import { TeacherTextbookReader } from "./_components/teacher-textbook-reader" import { TextbookSettingsDialog } from "@/modules/textbooks/components/textbook-settings-dialog" import { getSubjectLabelKey, getGradeLabelKey } from "@/modules/textbooks/constants" import { requirePermission } from "@/shared/lib/auth-guard" import { Permissions } from "@/shared/types/permissions" export const dynamic = "force-dynamic" export default async function TextbookDetailPage({ params, }: { params: Promise<{ id: string }> }): Promise { await requirePermission(Permissions.TEXTBOOK_READ) const { id } = await params const t = await getTranslations("textbooks") const [textbook, chapters] = await Promise.all([ getTextbookById(id), getChaptersByTextbookId(id), ]) if (!textbook) { notFound() } return (
{/* Header / Nav (Fixed height) */}
{t(`subject.${getSubjectLabelKey(textbook.subject)}`)} {textbook.grade ? t(`grade.${getGradeLabelKey(textbook.grade)}`) : ""}

{textbook.title}

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