Files
CICD/src/app/(dashboard)/teacher/homework/assignments/create/page.tsx
SpecialX 57807def37
Some checks failed
CI / build-and-test (push) Failing after 3m50s
CI / deploy (push) Has been skipped
完整性更新
现在已经实现了大部分基础功能
2026-01-08 11:14:03 +08:00

42 lines
1.6 KiB
TypeScript

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 { FileQuestion } from "lucide-react"
export const dynamic = "force-dynamic"
export default async function CreateHomeworkAssignmentPage() {
const [exams, classes] = await Promise.all([getExams({}), 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>
<h2 className="text-2xl font-bold tracking-tight">Create Assignment</h2>
<p className="text-muted-foreground">Dispatch homework from an existing exam.</p>
</div>
</div>
{options.length === 0 ? (
<EmptyState
title="No exams available"
description="Create an exam first, then dispatch it as homework."
icon={FileQuestion}
action={{ label: "Create Exam", href: "/teacher/exams/create" }}
/>
) : classes.length === 0 ? (
<EmptyState
title="No classes available"
description="Create a class first, then publish homework to that class."
icon={FileQuestion}
action={{ label: "Go to Classes", href: "/teacher/classes/my" }}
/>
) : (
<HomeworkAssignmentForm exams={options} classes={classes} />
)}
</div>
)
}