- 新增审计报告 docs/architecture/audit/announcements-messages-audit-report.md - 新增中英双语 i18n 字典 announcements.json / messages.json(11/13 个命名空间) - 重构所有 announcements 和 messaging 组件接入 next-intl(useTranslations) - 所有页面 page.tsx 使用 generateMetadata + getTranslations 替代硬编码 metadata - 新增 7 个 error.tsx 错误边界(4 公告 + 3 消息),统一 EmptyState + i18n + 重试 - a11y 改进:announcement-card / message-list / notification-dropdown 添加 aria-label - 同步架构图 004 和 005:i18n.messages 清单 + 已知问题修复记录
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { getTranslations } from "next-intl/server"
|
|
|
|
import { requirePermission } from "@/shared/lib/auth-guard"
|
|
import { Permissions } from "@/shared/types/permissions"
|
|
import { getMessages } from "@/modules/messaging/data-access"
|
|
import { getNotifications } from "@/modules/notifications/data-access"
|
|
import { MessageList } from "@/modules/messaging/components/message-list"
|
|
import { NotificationList } from "@/modules/messaging/components/notification-list"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export async function generateMetadata() {
|
|
const t = await getTranslations("messages")
|
|
return { title: t("title.list") }
|
|
}
|
|
|
|
export default async function MessagesPage() {
|
|
const t = await getTranslations("messages")
|
|
const ctx = await requirePermission(Permissions.MESSAGE_READ)
|
|
|
|
const [messagesResult, notificationsResult] = await Promise.all([
|
|
getMessages({ userId: ctx.userId, type: "all", page: 1, pageSize: 50 }),
|
|
getNotifications(ctx.userId, { page: 1, pageSize: 20 }),
|
|
])
|
|
|
|
return (
|
|
<div className="flex h-full flex-col space-y-8 p-8">
|
|
<div>
|
|
<h2 className="text-2xl font-bold tracking-tight">{t("title.list")}</h2>
|
|
<p className="text-muted-foreground">
|
|
{t("description.list")}
|
|
</p>
|
|
</div>
|
|
|
|
<MessageList messages={messagesResult.items} currentUserId={ctx.userId} />
|
|
|
|
<NotificationList notifications={notificationsResult.items} />
|
|
</div>
|
|
)
|
|
}
|