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:
@@ -3,8 +3,10 @@ import type { JSX } from "react"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
import { requirePermission } from "@/shared/lib/auth-guard"
|
||||
import { Permissions } from "@/shared/types/permissions"
|
||||
import { getRecipients } from "@/modules/messaging/data-access"
|
||||
import { SectionErrorBoundary } from "@/shared/components/section-error-boundary"
|
||||
import { getRecipients, getMessageDrafts } from "@/modules/messaging/data-access"
|
||||
import { MessageCompose } from "@/modules/messaging/components/message-compose"
|
||||
import { MessageDraftList } from "@/modules/messaging/components/message-draft-list"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
@@ -25,7 +27,11 @@ export default async function ComposeMessagePage({
|
||||
const sp = await searchParams
|
||||
const t = await getTranslations("messages")
|
||||
|
||||
const recipients = await getRecipients(ctx.userId, ctx.dataScope)
|
||||
const [recipients, drafts] = await Promise.all([
|
||||
getRecipients(ctx.userId, ctx.dataScope),
|
||||
// P1-1: 获取草稿列表用于展示与恢复编辑
|
||||
getMessageDrafts(ctx.userId),
|
||||
])
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col p-8">
|
||||
@@ -34,12 +40,20 @@ export default async function ComposeMessagePage({
|
||||
<h2 className="text-2xl font-bold tracking-tight">{t("title.compose")}</h2>
|
||||
<p className="text-muted-foreground">{t("description.compose")}</p>
|
||||
</div>
|
||||
<MessageCompose
|
||||
recipients={recipients}
|
||||
parentMessageId={sp.parentId}
|
||||
defaultReceiverId={sp.receiverId}
|
||||
defaultSubject={sp.subject}
|
||||
/>
|
||||
{/* P2-8: 撰写表单区块独立 ErrorBoundary,失败不影响草稿列表 */}
|
||||
<SectionErrorBoundary namespace="messages">
|
||||
<MessageCompose
|
||||
recipients={recipients}
|
||||
parentMessageId={sp.parentId}
|
||||
defaultReceiverId={sp.receiverId}
|
||||
defaultSubject={sp.subject}
|
||||
/>
|
||||
</SectionErrorBoundary>
|
||||
{/* P2-8: 草稿列表区块独立 ErrorBoundary */}
|
||||
<SectionErrorBoundary namespace="messages">
|
||||
{/* P1-1: 草稿列表 - 允许用户查看、继续编辑、删除未发送的草稿 */}
|
||||
<MessageDraftList drafts={drafts} />
|
||||
</SectionErrorBoundary>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user