Files
NextEdu/src/app/(dashboard)/student/elective/loading.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

75 lines
2.1 KiB
TypeScript

import { Card, CardContent, CardHeader } from "@/shared/components/ui/card"
import { Skeleton } from "@/shared/components/ui/skeleton"
/**
* 全页骨架屏 - 路由级 loading.tsx 默认导出
*/
export default function Loading() {
return (
<div className="space-y-8">
<div className="space-y-2">
<Skeleton className="h-8 w-48" />
<Skeleton className="h-4 w-64" />
</div>
<MySelectionsSkeleton />
<AvailableCoursesSkeleton />
</div>
)
}
/**
* 我的选课区块骨架屏
* 用于独立 Suspense 边界 fallback
*/
export function MySelectionsSkeleton() {
return (
<section className="space-y-4" aria-busy="true" aria-label="Loading my selections">
<div className="flex items-center justify-between">
<Skeleton className="h-6 w-32" />
<Skeleton className="h-4 w-8" />
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{Array.from({ length: 3 }).map((_, i) => (
<Card key={i}>
<CardHeader className="pb-2">
<Skeleton className="h-5 w-32" />
<Skeleton className="mt-2 h-4 w-24" />
</CardHeader>
<CardContent>
<Skeleton className="h-9 w-28" />
</CardContent>
</Card>
))}
</div>
</section>
)
}
/**
* 可选课程区块骨架屏
* 用于独立 Suspense 边界 fallback
*/
export function AvailableCoursesSkeleton() {
return (
<section className="space-y-4" aria-busy="true" aria-label="Loading available courses">
<div className="flex items-center justify-between">
<Skeleton className="h-6 w-32" />
<Skeleton className="h-4 w-8" />
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{Array.from({ length: 6 }).map((_, i) => (
<Card key={i}>
<CardHeader className="pb-2">
<Skeleton className="h-5 w-32" />
<Skeleton className="mt-2 h-4 w-24" />
</CardHeader>
<CardContent>
<Skeleton className="h-9 w-28" />
</CardContent>
</Card>
))}
</div>
</section>
)
}