- Add error.tsx and loading.tsx boundaries for admin, parent, student, teacher routes - Add admin announcements edit, audit-logs overview, curriculum-map, invitation-codes, permissions, questions, roles routes - Add admin elective detail and components, files, course-plans, users, scheduling boundaries - Add messages group-compose route - Add parent course-plans, elective, grades report-card, practice routes - Add student course-plans, elective detail, error-book dialogs, grades report-card, learning study-path, leave, schedule boundaries - Add teacher attendance report, classes boundaries, course-plans boundaries, elective, exams analytics/edit-rich/all/create/new, grades report-card, homework boundaries, leave, lesson-plans calendar - Add auth loading, onboarding loading, api cron
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import type { JSX } from "react"
|
|
import { notFound } from "next/navigation"
|
|
import { getTranslations } from "next-intl/server"
|
|
import { requirePermission, PermissionDeniedError } from "@/shared/lib/auth-guard"
|
|
import { Permissions } from "@/shared/types/permissions"
|
|
import { ProctoringDashboard } from "@/modules/proctoring/components/proctoring-dashboard"
|
|
import {
|
|
getExamForProctoring,
|
|
getExamProctoringSummary,
|
|
getStudentProctoringStatuses,
|
|
getRecentProctoringEvents,
|
|
} from "@/modules/proctoring/data-access"
|
|
import type { ProctoringDashboardData } from "@/modules/proctoring/types"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function ExamProctoringPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>
|
|
}): Promise<JSX.Element> {
|
|
const t = await getTranslations("examHomework.proctoring.page")
|
|
try {
|
|
await requirePermission(Permissions.EXAM_PROCTOR)
|
|
} catch (error) {
|
|
if (error instanceof PermissionDeniedError) {
|
|
return (
|
|
<div className="p-10 text-center text-muted-foreground">
|
|
{t("noPermission")}
|
|
</div>
|
|
)
|
|
}
|
|
throw error
|
|
}
|
|
|
|
const { id } = await params
|
|
const exam = await getExamForProctoring(id)
|
|
if (!exam) return notFound()
|
|
|
|
// 并行拉取面板初始数据
|
|
const [summary, students, recentEvents] = await Promise.all([
|
|
getExamProctoringSummary(id),
|
|
getStudentProctoringStatuses(id),
|
|
getRecentProctoringEvents(id, 20),
|
|
])
|
|
|
|
const initialData: ProctoringDashboardData = {
|
|
summary,
|
|
students,
|
|
recentEvents,
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-full flex-col space-y-4 p-4">
|
|
<div>
|
|
<h1 className="text-2xl font-bold tracking-tight">{t("title")}</h1>
|
|
<p className="text-muted-foreground">{t("description")}</p>
|
|
</div>
|
|
<ProctoringDashboard examId={id} initialData={initialData} />
|
|
</div>
|
|
)
|
|
}
|