feat(app): add error/loading boundaries across all dashboard routes and new routes
- 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
This commit is contained in:
@@ -4,12 +4,14 @@ import { getExams } from "@/modules/exams/data-access"
|
||||
import { getTeacherClasses } from "@/modules/classes/data-access"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { getAuthContext } from "@/shared/lib/auth-guard"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
import { FileQuestion } from "lucide-react"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function CreateHomeworkAssignmentPage(): Promise<JSX.Element> {
|
||||
const { dataScope } = await getAuthContext()
|
||||
const t = await getTranslations("examHomework")
|
||||
const [exams, classes] = await Promise.all([getExams({ scope: dataScope }), getTeacherClasses()])
|
||||
const options = exams.map((e) => ({ id: e.id, title: e.title }))
|
||||
|
||||
@@ -17,17 +19,17 @@ export default async function CreateHomeworkAssignmentPage(): Promise<JSX.Elemen
|
||||
<div className="flex h-full flex-col space-y-8 p-8">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold tracking-tight">Create Assignment</h1>
|
||||
<p className="text-muted-foreground">快速发布文本作业或从考试派生。</p>
|
||||
<h1 className="text-2xl font-bold tracking-tight">{t("homework.form.createTitle")}</h1>
|
||||
<p className="text-muted-foreground">{t("homework.form.createDescription")}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{classes.length === 0 ? (
|
||||
<EmptyState
|
||||
title="No classes available"
|
||||
description="Create a class first, then publish homework to that class."
|
||||
title={t("homework.form.noClassesAvailable")}
|
||||
description={t("homework.form.noClassesDescription")}
|
||||
icon={FileQuestion}
|
||||
action={{ label: "Go to Classes", href: "/teacher/classes/my" }}
|
||||
action={{ label: t("homework.form.goToClasses"), href: "/teacher/classes/my" }}
|
||||
/>
|
||||
) : (
|
||||
<HomeworkAssignmentForm exams={options} classes={classes} />
|
||||
|
||||
Reference in New Issue
Block a user