import type { JSX } from "react" import { Suspense } from "react" import type { ReactNode } from "react" import Link from "next/link" import { notFound } from "next/navigation" import { getHomeworkAssignmentAnalytics } from "@/modules/homework/stats-service" import { HomeworkAssignmentExamContentCard } from "@/modules/homework/components/homework-assignment-exam-content-card" import { HomeworkAssignmentQuestionErrorOverviewCard } from "@/modules/homework/components/homework-assignment-question-error-overview-card" import { Badge } from "@/shared/components/ui/badge" import { Button } from "@/shared/components/ui/button" import { Skeleton } from "@/shared/components/ui/skeleton" import { SectionErrorBoundary } from "@/shared/components/section-error-boundary" import { formatDate } from "@/shared/lib/utils" import { ArrowLeft, Users, Calendar, BarChart3, CheckCircle2 } from "lucide-react" import { requirePermission } from "@/shared/lib/auth-guard" import { getTranslations } from "next-intl/server" import { Permissions } from "@/shared/types/permissions" export const dynamic = "force-dynamic" export default async function HomeworkAssignmentDetailPage({ params }: { params: Promise<{ id: string }> }): Promise { const { id } = await params await requirePermission(Permissions.HOMEWORK_CREATE) const t = await getTranslations("examHomework") const analytics = await getHomeworkAssignmentAnalytics(id) if (!analytics) return notFound() const { assignment, questions, gradedSampleCount } = analytics return (
{/* Header */}

{assignment.title}

{assignment.status}

{assignment.description || t("homework.take.noDescription")}

{/* Quick Stats Row */}
{/* Analytics Section - wrapped with SectionErrorBoundary + Suspense for graceful degradation */}

{t("homework.detail.performanceAnalytics")}

}>
{/* Content Section */}

{t("homework.detail.assignmentContent")}

) } /** * Analytics 区块加载骨架屏。 */ function AnalyticsSkeleton(): ReactNode { return (
{Array.from({ length: 4 }).map((_, i) => ( ))}
) }