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,11 +1,14 @@
|
||||
import { notFound } from "next/navigation"
|
||||
import type { Metadata } from "next"
|
||||
import type { JSX } from "react"
|
||||
import { Suspense } from "react"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
import { SectionErrorBoundary } from "@/shared/components/section-error-boundary"
|
||||
import { getMessageDetailPageData } from "@/modules/messaging/data-access"
|
||||
import { MessageDetail } from "@/modules/messaging/components/message-detail"
|
||||
import { Skeleton } from "@/shared/components/ui/skeleton"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
@@ -14,6 +17,24 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
return { title: t("title.detail") }
|
||||
}
|
||||
|
||||
/**
|
||||
* P2-9: 消息详情骨架屏。
|
||||
*/
|
||||
function MessageDetailSkeleton(): JSX.Element {
|
||||
return (
|
||||
<div className="space-y-6" role="status" aria-label="Loading message">
|
||||
<Skeleton className="h-8 w-3/4" />
|
||||
<Skeleton className="h-4 w-1/2" />
|
||||
<Skeleton className="h-32 w-full" />
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-4 w-full" />
|
||||
<Skeleton className="h-4 w-5/6" />
|
||||
<Skeleton className="h-4 w-4/5" />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default async function MessageDetailPage({
|
||||
params,
|
||||
}: {
|
||||
@@ -27,7 +48,12 @@ export default async function MessageDetailPage({
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col p-8">
|
||||
<MessageDetail message={message} currentUserId={ctx.userId} />
|
||||
{/* P2-8 + P2-9: 详情区块 ErrorBoundary 包裹 */}
|
||||
<SectionErrorBoundary namespace="messages">
|
||||
<Suspense fallback={<MessageDetailSkeleton />}>
|
||||
<MessageDetail message={message} currentUserId={ctx.userId} />
|
||||
</Suspense>
|
||||
</SectionErrorBoundary>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user