Files
NextEdu/src/app/(dashboard)/teacher/diagnostic/class/[classId]/page.tsx
SpecialX 1a9377222c feat(app): add error/loading boundaries and update dashboard routes
- Add error.tsx and loading.tsx boundaries for admin, parent, student, teacher routes

- Add dashboard-error-fallback and dashboard-loading-skeleton components

- Add student/learning page, parent/leave routes, teacher textbook components

- Update existing app routes across auth, dashboard, and API endpoints

- Update proxy middleware and next-auth type declarations
2026-06-23 17:38:28 +08:00

51 lines
1.7 KiB
TypeScript

import type { JSX } from "react"
import { notFound } from "next/navigation"
import { Stethoscope } from "lucide-react"
import { requirePermission } from "@/shared/lib/auth-guard"
import { Permissions } from "@/shared/types/permissions"
import { getClassMasterySummary } from "@/modules/diagnostic/data-access"
import { ClassDiagnosticView } from "@/modules/diagnostic/components/class-diagnostic-view"
import { WidgetBoundary } from "@/modules/grades/components/widget-boundary"
export const dynamic = "force-dynamic"
export default async function ClassDiagnosticPage({
params,
}: {
params: Promise<{ classId: string }>
}): Promise<JSX.Element> {
const { classId } = await params
const ctx = await requirePermission(Permissions.DIAGNOSTIC_READ)
// DataScope 校验:教师只能查看所教班级,学生/家长不可访问
if (ctx.dataScope.type === "class_taught" && !ctx.dataScope.classIds.includes(classId)) {
notFound()
}
if (ctx.dataScope.type === "class_members" || ctx.dataScope.type === "children") {
notFound()
}
const summary = await getClassMasterySummary(classId)
if (!summary) {
notFound()
}
return (
<div className="h-full flex-1 flex-col space-y-8 p-8 md:flex">
<div>
<h1 className="flex items-center gap-2 text-2xl font-bold tracking-tight">
<Stethoscope className="h-6 w-6" aria-hidden="true" />
Class Diagnostic
</h1>
<p className="text-muted-foreground">
Class-level knowledge point mastery overview and student attention list.
</p>
</div>
<WidgetBoundary title="班级学情诊断" skeletonHeight={400}>
<ClassDiagnosticView summary={summary} />
</WidgetBoundary>
</div>
)
}