Some checks failed
Security / deep-security-scan (push) Failing after 20m5s
DR Drill / dr-drill (push) Failing after 1m31s
CI / scheduled-backup (push) Failing after 1m31s
CI / backup-verify (push) Has been skipped
CI / weekly-dr-drill (push) Failing after 0s
CI / build-deploy (push) Has been cancelled
CI / security-scan (push) Has been cancelled
主要变更: - 新增 lesson-preparation 模块: 备课编辑器、节点编辑、AI 建议、知识点选择、版本历史、作业发布 - 新增 shared 通用组件: charts/question-bank-filters/schedule-list/ui (chip-nav/filter-bar/page-header/stat-card/stat-item) - 新增 student/admin 端 loading.tsx 与 error.tsx, 优化加载与错误态体验 - 新增 teacher/lesson-plans 页面 (列表/新建/编辑) - 新增 drizzle 迁移 0002_tiny_lionheart 及 snapshot - 新增 textbooks/schema.ts 与 exams/utils/normalize-structure.ts - 修复 Tiptap v3 SSR hydration 崩溃 (rich-text-block immediatelyRender: false) - 重构多模块 data-access/actions/组件, 修复权限校验与类型规范 - 同步架构文档 004/005 反映新增模块、导出、依赖关系 - 归档 bugs/* 测试报告与 e2e 测试脚本 (admin/parent/student/teacher web_test)
65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
import { notFound } from "next/navigation"
|
|
|
|
import { BookOpen } from "lucide-react"
|
|
|
|
import { getTextbookById, getChaptersByTextbookId, getKnowledgePointsByTextbookId } from "@/modules/textbooks/data-access"
|
|
import { TextbookReader } from "@/modules/textbooks/components/textbook-reader"
|
|
import { Badge } from "@/shared/components/ui/badge"
|
|
import { EmptyState } from "@/shared/components/ui/empty-state"
|
|
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function StudentTextbookDetailPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>
|
|
}) {
|
|
const student = await getCurrentStudentUser()
|
|
if (!student) return notFound()
|
|
|
|
const { id } = await params
|
|
|
|
const [textbook, chapters, knowledgePoints] = await Promise.all([
|
|
getTextbookById(id),
|
|
getChaptersByTextbookId(id),
|
|
getKnowledgePointsByTextbookId(id)
|
|
])
|
|
|
|
if (!textbook) notFound()
|
|
|
|
return (
|
|
<div className="flex h-[calc(100vh-4rem)] flex-col overflow-hidden bg-muted/5">
|
|
<div className="flex items-center justify-between border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 py-3 px-6 shrink-0 z-10">
|
|
<div className="flex items-center gap-3 min-w-0">
|
|
<h1 className="text-lg font-bold tracking-tight truncate">{textbook.title}</h1>
|
|
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
<span className="hidden sm:inline-block w-px h-4 bg-border" aria-hidden="true" />
|
|
<Badge variant="outline" className="font-normal text-xs">{textbook.subject}</Badge>
|
|
{textbook.grade && (
|
|
<Badge variant="secondary" className="font-normal text-xs">{textbook.grade}</Badge>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex-1 overflow-hidden p-6">
|
|
{chapters.length === 0 ? (
|
|
<div className="h-full flex items-center justify-center rounded-lg border border-dashed bg-card">
|
|
<EmptyState
|
|
icon={BookOpen}
|
|
title="No chapters"
|
|
description="This textbook has no chapters yet."
|
|
className="border-none shadow-none"
|
|
/>
|
|
</div>
|
|
) : (
|
|
<div className="h-full min-h-0 max-w-[1600px] mx-auto w-full">
|
|
<TextbookReader chapters={chapters} knowledgePoints={knowledgePoints} />
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|