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:
@@ -2,24 +2,38 @@
|
||||
|
||||
import { useEffect } from "react"
|
||||
import { BarChart3 } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
|
||||
export default function Error() {
|
||||
export default function TeacherPracticeError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
reset: () => void
|
||||
}): React.ReactNode {
|
||||
const t = useTranslations("practice")
|
||||
useEffect(() => {
|
||||
console.error("Practice analytics page error")
|
||||
}, [])
|
||||
console.error("Practice analytics page error:", error)
|
||||
}, [error])
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col space-y-8 p-8">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold tracking-tight">专项练习分析</h1>
|
||||
<p className="text-muted-foreground">加载练习分析数据时发生错误</p>
|
||||
<h1 className="text-2xl font-bold tracking-tight">
|
||||
{t("errors.pageErrorTitlePractice")}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">{t("errors.pageErrorPractice")}</p>
|
||||
</div>
|
||||
<EmptyState
|
||||
icon={BarChart3}
|
||||
title="加载失败"
|
||||
description="请刷新页面重试,或联系管理员检查数据访问权限。"
|
||||
title={t("errors.loadFailed")}
|
||||
description={t("errors.loadFailedDescription")}
|
||||
action={{
|
||||
label: t("errors.retry"),
|
||||
onClick: () => reset(),
|
||||
}}
|
||||
className="h-[360px] bg-card"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user