Files
NextEdu/src/app/(dashboard)/teacher/homework/assignments/create/page.tsx
SpecialX 21142f9b99 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
2026-07-03 10:26:25 +08:00

40 lines
1.6 KiB
TypeScript

import type { JSX } from "react"
import { HomeworkAssignmentForm } from "@/modules/homework/components/homework-assignment-form"
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 }))
return (
<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">{t("homework.form.createTitle")}</h1>
<p className="text-muted-foreground">{t("homework.form.createDescription")}</p>
</div>
</div>
{classes.length === 0 ? (
<EmptyState
title={t("homework.form.noClassesAvailable")}
description={t("homework.form.noClassesDescription")}
icon={FileQuestion}
action={{ label: t("homework.form.goToClasses"), href: "/teacher/classes/my" }}
/>
) : (
<HomeworkAssignmentForm exams={options} classes={classes} />
)}
</div>
)
}