feat(app): add error/loading boundaries and update dashboard routes

- Add error.tsx and loading.tsx boundaries for admin, parent, student, teacher routes

- Add dashboard-error-fallback and dashboard-loading-skeleton components

- Add student/learning page, parent/leave routes, teacher textbook components

- Update existing app routes across auth, dashboard, and API endpoints

- Update proxy middleware and next-auth type declarations
This commit is contained in:
SpecialX
2026-06-23 17:38:28 +08:00
parent c4d3433cc9
commit 1a9377222c
90 changed files with 1690 additions and 741 deletions

View File

@@ -3,8 +3,9 @@ import { getTranslations } from "next-intl/server"
import { BookOpen } from "lucide-react"
import { getTextbookById, getChaptersByTextbookId, getKnowledgePointsByTextbookId } from "@/modules/textbooks/data-access"
import { getTextbookById, getChaptersByTextbookId } from "@/modules/textbooks/data-access"
import { TextbookReader } from "@/modules/textbooks/components/textbook-reader"
import { getSubjectLabelKey, getGradeLabelKey } from "@/modules/textbooks/constants"
import { Badge } from "@/shared/components/ui/badge"
import { EmptyState } from "@/shared/components/ui/empty-state"
import { getCurrentStudentUser } from "@/modules/users/data-access"
@@ -23,10 +24,9 @@ export default async function StudentTextbookDetailPage({
const { id } = await params
const [textbook, chapters, knowledgePoints] = await Promise.all([
const [textbook, chapters] = await Promise.all([
getTextbookById(id),
getChaptersByTextbookId(id),
getKnowledgePointsByTextbookId(id)
])
if (!textbook) notFound()
@@ -45,9 +45,9 @@ export default async function StudentTextbookDetailPage({
<h1 className="text-lg font-bold tracking-tight truncate">{textbook.title}</h1>
<div className="flex items-center gap-2 text-sm text-muted-foreground">
<span className="hidden sm:inline-block w-px h-4 bg-border" aria-hidden="true" />
<Badge variant="outline" className="font-normal text-xs">{textbook.subject}</Badge>
<Badge variant="outline" className="font-normal text-xs">{t(`subject.${getSubjectLabelKey(textbook.subject)}`)}</Badge>
{textbook.grade && (
<Badge variant="secondary" className="font-normal text-xs">{textbook.grade}</Badge>
<Badge variant="secondary" className="font-normal text-xs">{t(`grade.${getGradeLabelKey(textbook.grade)}`)}</Badge>
)}
</div>
</div>
@@ -66,7 +66,7 @@ export default async function StudentTextbookDetailPage({
) : (
<div className="h-full min-h-0 max-w-[1600px] mx-auto w-full">
{/* 学生端不传 renderQuestionCreator无题目创建权限 */}
<TextbookReader chapters={chapters} knowledgePoints={knowledgePoints} />
<TextbookReader key={id} chapters={chapters} textbookId={id} />
</div>
)}
</div>