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:
SpecialX
2026-07-03 10:26:25 +08:00
parent e9a5264fe7
commit 21142f9b99
280 changed files with 7137 additions and 1855 deletions

View File

@@ -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 TeacherTextbookDetailError({
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" />
}

View File

@@ -1,63 +1,46 @@
import { Skeleton } from "@/shared/components/ui/skeleton"
import { Separator } from "@/shared/components/ui/separator"
export default function Loading() {
return (
<div className="space-y-6 max-w-5xl mx-auto">
{/* Header Skeleton */}
<div className="flex items-center gap-4">
<Skeleton className="h-10 w-10 rounded-md" /> {/* Back Button */}
<div className="flex-1 space-y-2">
<div
role="status"
aria-busy="true"
aria-label="加载中"
className="flex h-[calc(100vh-4rem)] flex-col overflow-hidden bg-muted/5"
>
{/* Reader Header Skeleton */}
<div className="flex items-center justify-between border-b bg-background/95 backdrop-blur py-3 px-6 shrink-0">
<div className="flex items-center gap-3 min-w-0">
<Skeleton className="h-6 w-48" />
<div className="flex items-center gap-2">
<Skeleton className="h-5 w-16" />
<Skeleton className="h-4 w-24" />
<Skeleton className="h-5 w-16 rounded-full" />
<Skeleton className="h-5 w-16 rounded-full" />
</div>
<Skeleton className="h-8 w-64" />
</div>
<Skeleton className="h-10 w-32" /> {/* Edit Button */}
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
{/* Main Content Skeleton */}
<div className="md:col-span-2 space-y-6">
<div className="flex items-center justify-between">
<Skeleton className="h-6 w-40" />
<Skeleton className="h-8 w-24" />
</div>
<div className="rounded-lg border bg-card p-6 space-y-4">
{Array.from({ length: 5 }).map((_, i) => (
<div key={i} className="flex items-center gap-4">
<Skeleton className="h-6 w-6 rounded-md" />
<Skeleton className="h-6 w-full rounded-md" />
{/* Reader Body Skeleton: sidebar + content */}
<div className="flex-1 overflow-hidden">
<div className="h-full max-w-[1600px] mx-auto w-full grid grid-cols-1 md:grid-cols-[280px_1fr]">
{/* Chapter Sidebar Skeleton */}
<div className="hidden md:block border-r bg-card p-4 space-y-2 overflow-hidden">
{Array.from({ length: 8 }).map((_, i) => (
<div key={i} className="flex items-center gap-2">
<Skeleton className="h-4 w-4 rounded-sm" />
<Skeleton className="h-6 w-full" />
</div>
))}
</div>
</div>
{/* Sidebar Skeleton */}
<div className="space-y-6">
<div className="rounded-lg border bg-card p-6 space-y-4">
<Skeleton className="h-6 w-32 mb-4" />
<div className="space-y-2">
<Skeleton className="h-4 w-16" />
<Skeleton className="h-5 w-32" />
</div>
<div className="space-y-2">
<Skeleton className="h-4 w-20" />
<Skeleton className="h-20 w-full" />
</div>
<Separator />
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">
<Skeleton className="h-3 w-12" />
<Skeleton className="h-4 w-24" />
</div>
<div className="space-y-2">
<Skeleton className="h-3 w-12" />
<Skeleton className="h-4 w-24" />
</div>
{/* Content Area Skeleton */}
<div className="p-6 space-y-4 overflow-hidden">
<Skeleton className="h-8 w-1/3" />
<div className="space-y-3">
{Array.from({ length: 6 }).map((_, i) => (
<Skeleton key={i} className="h-4 w-full" />
))}
</div>
<Skeleton className="h-32 w-full" />
</div>
</div>
</div>