Files
NextEdu/src/app/(dashboard)/teacher/textbooks/[id]/page.tsx
SpecialX 5ff7ab9e72 fix(teacher): 统一详情页返回路径与中英文文案 (P1-3+P2-1)
P1-3: empty-state 默认按钮 variant 改为 outline 并新增 variant prop;button.tsx 导出 ButtonProps;统一 5 个详情页返回路径为 ghost+ArrowLeft+文字标签;course-plan-detail raw a 改为 Link。P2-1: formatLongDate 默认 locale 改为 zh-CN,weekday 改为 short;返回按钮文案中文化;course-plan-detail 全量中文化;grades/analytics 标题中文化。验证:tsc 0 错误,lint 0 错误,架构图 004/005 已同步。
2026-06-22 13:52:26 +08:00

66 lines
2.2 KiB
TypeScript

import type { JSX } from "react"
import { notFound } from "next/navigation"
import { ArrowLeft } from "lucide-react"
import Link from "next/link"
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 } from "@/modules/textbooks/components/textbook-reader"
import { TextbookSettingsDialog } from "@/modules/textbooks/components/textbook-settings-dialog"
export const dynamic = "force-dynamic"
export default async function TextbookDetailPage({
params,
}: {
params: Promise<{ id: string }>
}): Promise<JSX.Element> {
const { id } = await params
const [textbook, chapters, knowledgePoints] = await Promise.all([
getTextbookById(id),
getChaptersByTextbookId(id),
getKnowledgePointsByTextbookId(id),
])
if (!textbook) {
notFound()
}
return (
<div className="flex flex-col h-[calc(100vh-4rem)] overflow-hidden">
{/* Header / Nav (Fixed height) */}
<div className="flex items-center gap-4 py-4 border-b shrink-0 bg-background z-10">
<Button asChild variant="ghost" size="sm">
<Link href="/teacher/textbooks">
<ArrowLeft className="mr-2 h-4 w-4" aria-hidden="true" />
</Link>
</Button>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2 mb-1">
<Badge variant="outline">{textbook.subject}</Badge>
<span className="text-xs text-muted-foreground uppercase tracking-wider font-medium">
{textbook.grade}
</span>
</div>
<h1 className="text-xl font-bold tracking-tight line-clamp-1">{textbook.title}</h1>
</div>
<div className="flex gap-2">
<TextbookSettingsDialog textbook={textbook} />
</div>
</div>
{/* Main Content Layout (Flex grow) */}
<div className="flex-1 overflow-hidden pt-6">
<TextbookReader
chapters={chapters}
knowledgePoints={knowledgePoints}
textbookId={id}
canEdit={true}
/>
</div>
</div>
)
}