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:
@@ -1,7 +1,7 @@
|
||||
import { notFound } from "next/navigation"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
|
||||
import { getStudentHomeworkTakeData } from "@/modules/homework/data-access"
|
||||
import { getStudentHomeworkTakeData } from "@/modules/homework/data-access-student"
|
||||
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { HomeworkTakeView } from "@/modules/homework/components/homework-take-view"
|
||||
import { HomeworkReviewView } from "@/modules/homework/components/student-homework-review-view"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
"use client"
|
||||
|
||||
import { AlertCircle } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
|
||||
/**
|
||||
* student/learning/assignments/[assignmentId]/result/error.tsx
|
||||
* 学生作业结果页错误边界。
|
||||
*/
|
||||
export default function StudentResultError({ reset }: { error: Error & { digest?: string }; reset: () => void }) {
|
||||
const t = useTranslations("examHomework")
|
||||
return (
|
||||
<div className="flex h-full flex-col items-center justify-center space-y-4 p-8">
|
||||
<EmptyState
|
||||
icon={AlertCircle}
|
||||
title={t("homework.error.submissionNotFound")}
|
||||
description={t("homework.error.loadFailed")}
|
||||
action={{
|
||||
label: t("common.retry"),
|
||||
onClick: () => reset(),
|
||||
}}
|
||||
className="border-none shadow-none h-auto"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Skeleton } from "@/shared/components/ui/skeleton"
|
||||
|
||||
/**
|
||||
* student/learning/assignments/[assignmentId]/result/loading.tsx
|
||||
* 学生作业结果页骨架屏:标题 + 分数汇总卡片 + 错题预览骨架。
|
||||
*/
|
||||
export default function Loading() {
|
||||
return (
|
||||
<div className="flex h-full flex-col space-y-6 p-8">
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-48" />
|
||||
<Skeleton className="h-4 w-64" />
|
||||
</div>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
<Skeleton className="h-32 w-full" />
|
||||
<Skeleton className="h-32 w-full" />
|
||||
<Skeleton className="h-32 w-full" />
|
||||
</div>
|
||||
<Skeleton className="h-64 w-full" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { JSX } from "react"
|
||||
import { notFound } from "next/navigation"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
import { getHomeworkAssignmentById, getStudentSubmissionResult } from "@/modules/homework/data-access"
|
||||
import { getHomeworkAssignmentById } from "@/modules/homework/data-access"
|
||||
import { getStudentSubmissionResult } from "@/modules/homework/data-access-student"
|
||||
import { HomeworkSubmissionResult } from "@/modules/homework/components/homework-submission-result"
|
||||
import { getSession } from "@/shared/lib/session"
|
||||
|
||||
|
||||
28
src/app/(dashboard)/student/learning/assignments/error.tsx
Normal file
28
src/app/(dashboard)/student/learning/assignments/error.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client"
|
||||
|
||||
import { AlertCircle } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
|
||||
/**
|
||||
* student/learning/assignments/error.tsx
|
||||
* 学生作业列表错误边界。
|
||||
*/
|
||||
export default function StudentAssignmentsListError({ reset }: { error: Error & { digest?: string }; reset: () => void }) {
|
||||
const t = useTranslations("examHomework")
|
||||
return (
|
||||
<div className="flex h-full flex-col items-center justify-center space-y-4 p-8">
|
||||
<EmptyState
|
||||
icon={AlertCircle}
|
||||
title={t("homework.error.notFound")}
|
||||
description={t("homework.error.loadFailed")}
|
||||
action={{
|
||||
label: t("common.retry"),
|
||||
onClick: () => reset(),
|
||||
}}
|
||||
className="border-none shadow-none h-auto"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/shared/components/ui
|
||||
import { StatusBadge } from "@/shared/components/ui/status-badge"
|
||||
import { formatDate, cn } from "@/shared/lib/utils"
|
||||
import { getParam, type SearchParams } from "@/shared/lib/search-params"
|
||||
import { getStudentHomeworkAssignments } from "@/modules/homework/data-access"
|
||||
import { getStudentHomeworkAssignments } from "@/modules/homework/data-access-student"
|
||||
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { AssignmentFilters } from "@/modules/homework/components/assignment-filters"
|
||||
import { Inbox, UserX, TriangleAlert } from "lucide-react"
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { ErrorState } from "@/shared/components/error-state"
|
||||
|
||||
export default function StudentClassDetailError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
reset: () => void
|
||||
}) {
|
||||
return <ErrorState error={error} reset={reset} namespace="student" />
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Metadata } from "next"
|
||||
import Link from "next/link"
|
||||
import { notFound } from "next/navigation"
|
||||
import {
|
||||
@@ -14,6 +15,8 @@ import { getTranslations } from "next-intl/server"
|
||||
|
||||
import { getStudentClassById, getStudentSchedule } from "@/modules/classes/data-access"
|
||||
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
import { Badge } from "@/shared/components/ui/badge"
|
||||
import { Button } from "@/shared/components/ui/button"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/shared/components/ui/card"
|
||||
@@ -21,6 +24,14 @@ import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("classes")
|
||||
return {
|
||||
title: `${t("metadata.studentClassDetail")} - Next_Edu`,
|
||||
description: t("metadata.studentClassDetail"),
|
||||
}
|
||||
}
|
||||
|
||||
const WEEKDAY_KEYS: Record<number, string> = {
|
||||
1: "mon",
|
||||
2: "tue",
|
||||
@@ -37,6 +48,7 @@ export default async function StudentClassDetailPage({
|
||||
params: Promise<{ classId: string }>
|
||||
}) {
|
||||
const { classId } = await params
|
||||
await requirePermission(Permissions.CLASS_READ)
|
||||
const student = await getCurrentStudentUser()
|
||||
if (!student) return notFound()
|
||||
|
||||
|
||||
13
src/app/(dashboard)/student/learning/courses/error.tsx
Normal file
13
src/app/(dashboard)/student/learning/courses/error.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { ErrorState } from "@/shared/components/error-state"
|
||||
|
||||
export default function StudentCoursesError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
reset: () => void
|
||||
}) {
|
||||
return <ErrorState error={error} reset={reset} namespace="student" />
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Metadata } from "next"
|
||||
import { UserX } from "lucide-react"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
|
||||
@@ -5,17 +6,28 @@ import { getStudentClasses } from "@/modules/classes/data-access"
|
||||
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { StudentCoursesView } from "@/modules/student/components/student-courses-view"
|
||||
import { CourseFilters } from "@/modules/student/components/course-filters"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { getParam, type SearchParams } from "@/shared/lib/search-params"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("classes")
|
||||
return {
|
||||
title: `${t("metadata.studentCourses")} - Next_Edu`,
|
||||
description: t("metadata.studentCourses"),
|
||||
}
|
||||
}
|
||||
|
||||
export default async function StudentCoursesPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<SearchParams>
|
||||
}) {
|
||||
const t = await getTranslations("student")
|
||||
await requirePermission(Permissions.CLASS_READ)
|
||||
const student = await getCurrentStudentUser()
|
||||
if (!student) {
|
||||
return (
|
||||
|
||||
13
src/app/(dashboard)/student/learning/error.tsx
Normal file
13
src/app/(dashboard)/student/learning/error.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { ErrorState } from "@/shared/components/error-state"
|
||||
|
||||
export default function StudentLearningError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
reset: () => void
|
||||
}) {
|
||||
return <ErrorState error={error} reset={reset} namespace="student" />
|
||||
}
|
||||
34
src/app/(dashboard)/student/learning/loading.tsx
Normal file
34
src/app/(dashboard)/student/learning/loading.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Skeleton } from "@/shared/components/ui/skeleton"
|
||||
|
||||
export default function Loading() {
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-7 w-40" />
|
||||
<Skeleton className="h-4 w-64" />
|
||||
</div>
|
||||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
{Array.from({ length: 4 }).map((_, i) => (
|
||||
<div key={i} className="rounded-lg border bg-card p-6 space-y-3">
|
||||
<Skeleton className="h-5 w-24" />
|
||||
<Skeleton className="h-8 w-16" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="grid gap-6 lg:grid-cols-2">
|
||||
<div className="rounded-lg border bg-card p-6 space-y-3">
|
||||
<Skeleton className="h-5 w-28" />
|
||||
{Array.from({ length: 3 }).map((_, i) => (
|
||||
<Skeleton key={i} className="h-12 w-full" />
|
||||
))}
|
||||
</div>
|
||||
<div className="rounded-lg border bg-card p-6 space-y-3">
|
||||
<Skeleton className="h-5 w-32" />
|
||||
{Array.from({ length: 3 }).map((_, i) => (
|
||||
<Skeleton key={i} className="h-12 w-full" />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,18 +1,30 @@
|
||||
import type { Metadata } from "next"
|
||||
import Link from "next/link"
|
||||
import { BookOpen, PenTool, Library, ArrowRight, UserX } from "lucide-react"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
|
||||
import { getStudentClasses } from "@/modules/classes/data-access"
|
||||
import { getStudentHomeworkAssignments } from "@/modules/homework/data-access"
|
||||
import { getStudentHomeworkAssignments } from "@/modules/homework/data-access-student"
|
||||
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { getTextbooks } from "@/modules/textbooks/data-access"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/shared/components/ui/card"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("classes")
|
||||
return {
|
||||
title: `${t("metadata.studentLearning")} - Next_Edu`,
|
||||
description: t("metadata.studentLearning"),
|
||||
}
|
||||
}
|
||||
|
||||
export default async function StudentLearningPage() {
|
||||
const t = await getTranslations("student")
|
||||
await requirePermission(Permissions.CLASS_READ)
|
||||
const student = await getCurrentStudentUser()
|
||||
if (!student) {
|
||||
return (
|
||||
|
||||
13
src/app/(dashboard)/student/learning/study-path/error.tsx
Normal file
13
src/app/(dashboard)/student/learning/study-path/error.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { RouteError } from "@/shared/components/route-error"
|
||||
|
||||
export default function StudentStudyPathError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
reset: () => void
|
||||
}) {
|
||||
return <RouteError error={error} reset={reset} namespace="student" />
|
||||
}
|
||||
30
src/app/(dashboard)/student/learning/study-path/loading.tsx
Normal file
30
src/app/(dashboard)/student/learning/study-path/loading.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Skeleton } from "@/shared/components/ui/skeleton"
|
||||
import { Card, CardContent, CardHeader } from "@/shared/components/ui/card"
|
||||
|
||||
export default function Loading() {
|
||||
return (
|
||||
<div
|
||||
role="status"
|
||||
aria-busy="true"
|
||||
aria-label="加载中"
|
||||
className="space-y-8"
|
||||
>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-48" />
|
||||
<Skeleton className="h-4 w-72" />
|
||||
</div>
|
||||
<Card>
|
||||
<CardHeader className="space-y-2">
|
||||
<Skeleton className="h-5 w-40" />
|
||||
<Skeleton className="h-4 w-56" />
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<Skeleton className="h-10 w-full rounded-md" />
|
||||
<Skeleton className="h-20 w-full rounded-md" />
|
||||
<Skeleton className="h-20 w-full rounded-md" />
|
||||
<Skeleton className="h-10 w-32 rounded-md" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
50
src/app/(dashboard)/student/learning/study-path/page.tsx
Normal file
50
src/app/(dashboard)/student/learning/study-path/page.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { Metadata } from "next"
|
||||
import type { JSX } from "react"
|
||||
import { UserX } from "lucide-react"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
|
||||
import { AiStudyPath } from "@/modules/ai/components/ai-study-path"
|
||||
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("student.studyPath")
|
||||
return {
|
||||
title: t("title"),
|
||||
description: t("description"),
|
||||
}
|
||||
}
|
||||
|
||||
export default async function StudentStudyPathPage(): Promise<JSX.Element> {
|
||||
const t = await getTranslations("student.studyPath")
|
||||
// P0 显式权限校验:与 AI_CHAT 一致,防止 student 角色被关闭后页面仍可访问
|
||||
await requirePermission(Permissions.AI_CHAT)
|
||||
const student = await getCurrentStudentUser()
|
||||
|
||||
if (!student) {
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<EmptyState
|
||||
title={t("noUser")}
|
||||
description={t("noUserDesc")}
|
||||
icon={UserX}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold tracking-tight">{t("title")}</h2>
|
||||
<p className="text-muted-foreground">{t("description")}</p>
|
||||
</div>
|
||||
{/* AiStudyPath 是客户端组件,AiClientProvider 由 dashboard layout 注入 */}
|
||||
<AiStudyPath studentId={student.id} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,29 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { AlertCircle } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { RouteError } from "@/shared/components/route-error"
|
||||
|
||||
export default function StudentTextbookDetailError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
reset: () => void
|
||||
}) {
|
||||
const t = useTranslations("textbooks")
|
||||
return (
|
||||
<div className="flex h-full flex-col items-center justify-center space-y-4 p-8">
|
||||
<EmptyState
|
||||
icon={AlertCircle}
|
||||
title={t("error.loadFailed")}
|
||||
description={t("error.loadFailedDesc")}
|
||||
action={{
|
||||
label: t("error.retry"),
|
||||
onClick: () => reset(),
|
||||
}}
|
||||
className="border-none shadow-none h-auto"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
return <RouteError error={error} reset={reset} namespace="textbooks" />
|
||||
}
|
||||
|
||||
@@ -2,7 +2,12 @@ import { Skeleton } from "@/shared/components/ui/skeleton"
|
||||
|
||||
export default function Loading() {
|
||||
return (
|
||||
<div className="flex h-[calc(100vh-4rem-3rem)] flex-col overflow-hidden">
|
||||
<div
|
||||
role="status"
|
||||
aria-busy="true"
|
||||
aria-label="加载中"
|
||||
className="flex h-[calc(100vh-4rem-3rem)] flex-col overflow-hidden"
|
||||
>
|
||||
<div className="flex items-center justify-between border-b py-3 px-6 shrink-0">
|
||||
<div className="flex items-center gap-3">
|
||||
<Skeleton className="h-6 w-48" />
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { JSX } from "react"
|
||||
import { notFound } from "next/navigation"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
|
||||
@@ -10,6 +11,8 @@ import { Badge } from "@/shared/components/ui/badge"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { getGradeNameById } from "@/modules/school/data-access"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
@@ -17,8 +20,10 @@ export default async function StudentTextbookDetailPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>
|
||||
}) {
|
||||
}): Promise<JSX.Element> {
|
||||
const t = await getTranslations("textbooks")
|
||||
// P0 显式权限校验:与教师端一致,校验 TEXTBOOK_READ 权限点
|
||||
await requirePermission(Permissions.TEXTBOOK_READ)
|
||||
const student = await getCurrentStudentUser()
|
||||
if (!student) return notFound()
|
||||
|
||||
|
||||
@@ -1,29 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { AlertCircle } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { RouteError } from "@/shared/components/route-error"
|
||||
|
||||
export default function StudentTextbooksError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
reset: () => void
|
||||
}) {
|
||||
const t = useTranslations("textbooks")
|
||||
return (
|
||||
<div className="flex h-full flex-col items-center justify-center space-y-4 p-8">
|
||||
<EmptyState
|
||||
icon={AlertCircle}
|
||||
title={t("error.loadFailed")}
|
||||
description={t("error.loadFailedDesc")}
|
||||
action={{
|
||||
label: t("error.retry"),
|
||||
onClick: () => reset(),
|
||||
}}
|
||||
className="border-none shadow-none h-auto"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
return <RouteError error={error} reset={reset} namespace="textbooks" />
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { Skeleton } from "@/shared/components/ui/skeleton"
|
||||
import { Card, CardContent, CardFooter, CardHeader } from "@/shared/components/ui/card"
|
||||
|
||||
export default function Loading() {
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div
|
||||
role="status"
|
||||
aria-busy="true"
|
||||
aria-label="加载中"
|
||||
className="space-y-8"
|
||||
>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-40" />
|
||||
<Skeleton className="h-4 w-56" />
|
||||
@@ -10,7 +16,22 @@ export default function Loading() {
|
||||
<Skeleton className="h-10 w-full max-w-md" />
|
||||
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
||||
{Array.from({ length: 8 }).map((_, i) => (
|
||||
<Skeleton key={i} className="h-48 w-full" />
|
||||
<Card key={i} className="h-full overflow-hidden">
|
||||
<div className="aspect-[4/3] w-full bg-muted/30 p-6 flex items-center justify-center">
|
||||
<Skeleton className="h-24 w-20 rounded-sm" />
|
||||
</div>
|
||||
<CardHeader className="p-4 pb-2 space-y-2">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-6 w-full" />
|
||||
</CardHeader>
|
||||
<CardContent className="p-4 pt-0 space-y-2">
|
||||
<Skeleton className="h-4 w-24" />
|
||||
<Skeleton className="h-4 w-32" />
|
||||
</CardContent>
|
||||
<CardFooter className="p-4 pt-0 mt-auto">
|
||||
<Skeleton className="h-6 w-full rounded-md" />
|
||||
</CardFooter>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { JSX } from "react"
|
||||
import { BookOpen, UserX } from "lucide-react"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
|
||||
@@ -8,6 +9,8 @@ import { getCurrentStudentUser } from "@/modules/users/data-access"
|
||||
import { getGradeNameById } from "@/modules/school/data-access"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { getParam, type SearchParams } from "@/shared/lib/search-params"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
@@ -15,8 +18,10 @@ export default async function StudentTextbooksPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<SearchParams>
|
||||
}) {
|
||||
}): Promise<JSX.Element> {
|
||||
const t = await getTranslations("textbooks")
|
||||
// P0 显式权限校验:与教师端一致,校验 TEXTBOOK_READ 权限点
|
||||
await requirePermission(Permissions.TEXTBOOK_READ)
|
||||
const [student, sp] = await Promise.all([getCurrentStudentUser(), searchParams])
|
||||
|
||||
if (!student) {
|
||||
|
||||
Reference in New Issue
Block a user