refactor(announcements,messaging,notifications): V1+V2 审计重构 — i18n 命名空间独立 + 通知标题 i18n 化 + 服务端过滤 + 编排下沉 + 表单错误展示 + 架构图同步

V1 改进(已完成):
- P0-4/P1-4/P1-5: 通知组件和 CRUD Action 从 messaging 迁移至 notifications 模块
- P1-5: 新增 getMessagesPageData / getAdminAnnouncementsPageData 编排函数
- P1-6: announcements schema 添加 superRefine 条件校验
- P1-7: 新增 useMessageSearch hook(防抖 + 请求竞态取消)+ 客户端分页 UI
- P1-9: deleteMessage 事务化
- P2-11: 全模块 trackEvent 埋点
- 全模块 i18n 接入 + Error Boundary + a11y 改进

V2 改进(本次完成):
- V2-P0-1: 通知 i18n 命名空间独立(notifications.json),useTranslations 从 "messages" 切换到 "notifications"
- V2-P0-2: 公告/消息通知标题 i18n 化,Server Action 中使用 getTranslations 生成通知标题
- V2-P1-1: AnnouncementList 纯服务端过滤,移除客户端 useState/useMemo
- V2-P1-2: MessageList 客户端过滤仅在初始数据时执行,搜索结果由服务端按 tab 过滤
- V2-P1-3: 消息详情页编排下沉,新增 getMessageDetailPageData 编排函数
- V2-P1-4: 表单服务端校验错误展示(fieldErrors + aria-invalid)
- V2-P2-1: 轮询间隔常量化(POLL_INTERVAL_MS)
- V2-P2-2: 架构图同步(004 + 005)
This commit is contained in:
SpecialX
2026-06-22 18:43:12 +08:00
parent 6d7838a210
commit 1fe30984b6
29 changed files with 1252 additions and 351 deletions

View File

@@ -80,7 +80,11 @@
"noAnnouncementsDesc": "目前还没有任何公告。",
"noMatch": "当前筛选条件下暂无公告。",
"deleteTitle": "删除公告",
"deleteDesc": "此操作将永久删除"{title}"。"
"deleteDesc": "此操作将永久删除公告{title}。"
},
"notification": {
"publishedTitle": "新公告:{title}",
"publishedContent": "您有一条新公告,请及时查看。"
},
"error": {
"loadFailed": "公告加载失败",

View File

@@ -4,13 +4,11 @@
"detail": "消息详情",
"compose": "撰写消息",
"reply": "回复",
"newMessage": "新消息",
"notifications": "通知"
"newMessage": "新消息"
},
"description": {
"list": "管理收件箱并随时掌握通知动态。",
"compose": "向其他用户发送消息。",
"notifications": "随时了解最新动态。"
"compose": "向其他用户发送消息。"
},
"tabs": {
"inbox": "收件箱",
@@ -20,14 +18,10 @@
"compose": "撰写",
"reply": "回复",
"delete": "删除",
"markRead": "标记已读",
"markAllRead": "全部标记已读",
"send": "发送",
"sending": "发送中...",
"cancel": "取消",
"back": "返回",
"viewAll": "查看全部通知",
"view": "查看"
"back": "返回"
},
"form": {
"to": "收件人",
@@ -51,12 +45,6 @@
"noSubject": "(无主题)",
"readAt": "阅读于 {date}"
},
"notificationType": {
"message": "消息",
"announcement": "公告",
"homework": "作业",
"grade": "成绩"
},
"search": {
"placeholder": "按主题或内容搜索消息...",
"noResults": "未找到匹配的消息"
@@ -66,26 +54,24 @@
"inboxEmptyDesc": "您还没有收到任何消息。",
"sentEmpty": "无已发送消息",
"sentEmptyDesc": "您还没有发送任何消息。",
"noNotifications": "暂无通知",
"noNotificationsDesc": "您还没有任何通知。",
"noNotificationsDropdown": "暂无通知",
"deleteTitle": "删除消息",
"deleteDesc": "此操作将永久删除消息"{subject}"。"
"deleteDesc": "此操作将永久删除消息{subject}。"
},
"messages": {
"sent": "消息已发送",
"deleted": "消息已删除",
"markedRead": "已标记为已读",
"allMarkedRead": "全部已标记为已读",
"notificationMarkedRead": "通知已标记为已读",
"sendSelf": "不能给自己发送消息",
"sendFailed": "发送消息失败",
"deleteFailed": "删除失败",
"markReadFailed": "标记已读失败",
"notFound": "消息不存在",
"invalidId": "消息 ID 无效",
"selectRecipient": "请选择收件人"
},
"notification": {
"messageTitle": "新消息:{subject}",
"messageTitleNoSubject": "新消息"
},
"error": {
"loadFailed": "消息加载失败",
"loadFailedDesc": "抱歉,加载消息时发生了意外错误。请稍后重试。",

View File

@@ -0,0 +1,39 @@
{
"title": {
"list": "通知",
"dropdown": "通知"
},
"description": {
"list": "随时了解最新动态。"
},
"actions": {
"markRead": "标记已读",
"markAllRead": "全部标记已读",
"viewAll": "查看全部通知",
"view": "查看"
},
"type": {
"message": "消息",
"announcement": "公告",
"homework": "作业",
"grade": "成绩"
},
"status": {
"new": "新"
},
"empty": {
"noNotifications": "暂无通知",
"noNotificationsDesc": "您还没有任何通知。",
"noNotificationsDropdown": "暂无通知"
},
"messages": {
"allMarkedRead": "全部已标记为已读",
"notificationMarkedRead": "通知已标记为已读",
"markReadFailed": "标记已读失败"
},
"error": {
"loadFailed": "通知加载失败",
"loadFailedDesc": "抱歉,加载通知时发生了意外错误。请稍后重试。",
"retry": "重试"
}
}