- 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
66 lines
2.5 KiB
TypeScript
66 lines
2.5 KiB
TypeScript
import type { JSX } from "react"
|
|
import { Suspense } from "react"
|
|
import Link from "next/link"
|
|
import { Plus } from "lucide-react"
|
|
import { getTranslations } from "next-intl/server"
|
|
import { Button } from "@/shared/components/ui/button"
|
|
import { Skeleton } from "@/shared/components/ui/skeleton"
|
|
import { requirePermission } from "@/shared/lib/auth-guard"
|
|
import { Permissions } from "@/shared/types/permissions"
|
|
import { getLessonPlans } from "@/modules/lesson-preparation/data-access"
|
|
import { getSubjectOptions } from "@/modules/school/data-access"
|
|
import { LessonPlanList } from "@/modules/lesson-preparation/components/lesson-plan-list"
|
|
import { LessonPlanProviderSetup } from "@/modules/lesson-preparation/providers/lesson-plan-provider-setup"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function LessonPlansPage(): Promise<JSX.Element> {
|
|
const t = await getTranslations("lessonPreparation")
|
|
// V4 P0-2 修复:页面层补齐 requirePermission 权限校验
|
|
const ctx = await requirePermission(Permissions.LESSON_PLAN_READ)
|
|
|
|
const [items, subjects] = await Promise.all([
|
|
getLessonPlans({}, ctx.dataScope, ctx.userId),
|
|
getSubjectOptions(),
|
|
])
|
|
|
|
return (
|
|
<div className="p-6 space-y-4">
|
|
<div className="flex justify-between items-center">
|
|
<div>
|
|
<h1 className="text-2xl font-bold tracking-tight">{t("title.list")}</h1>
|
|
<p className="text-muted-foreground">
|
|
{t("description.list")}
|
|
</p>
|
|
</div>
|
|
<Button asChild>
|
|
<Link href="/teacher/lesson-plans/new">
|
|
<Plus className="h-4 w-4 mr-2" aria-hidden="true" />
|
|
{t("action.new")}
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
<LessonPlanProviderSetup>
|
|
<Suspense
|
|
fallback={
|
|
<div className="space-y-4">
|
|
<div className="flex gap-2 flex-wrap items-center">
|
|
<Skeleton className="h-9 w-[240px]" />
|
|
<Skeleton className="h-9 w-[160px]" />
|
|
<Skeleton className="h-9 w-[160px]" />
|
|
</div>
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
{Array.from({ length: 6 }).map((_, i) => (
|
|
<Skeleton key={i} className="h-[180px] w-full" />
|
|
))}
|
|
</div>
|
|
</div>
|
|
}
|
|
>
|
|
<LessonPlanList initialItems={items} subjects={subjects} />
|
|
</Suspense>
|
|
</LessonPlanProviderSetup>
|
|
</div>
|
|
)
|
|
}
|