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

@@ -82,6 +82,10 @@
"deleteTitle": "Delete announcement",
"deleteDesc": "This will permanently delete \"{title}\"."
},
"notification": {
"publishedTitle": "New announcement: {title}",
"publishedContent": "You have a new announcement. Please review it."
},
"error": {
"loadFailed": "Failed to load announcements",
"loadFailedDesc": "Sorry, an unexpected error occurred while loading announcements. Please try again later.",

View File

@@ -4,13 +4,11 @@
"detail": "Message",
"compose": "Compose Message",
"reply": "Reply",
"newMessage": "New Message",
"notifications": "Notifications"
"newMessage": "New Message"
},
"description": {
"list": "Manage your inbox and stay updated with notifications.",
"compose": "Send a message to another user.",
"notifications": "Stay updated on your latest activities."
"compose": "Send a message to another user."
},
"tabs": {
"inbox": "Inbox",
@@ -20,14 +18,10 @@
"compose": "Compose",
"reply": "Reply",
"delete": "Delete",
"markRead": "Mark as read",
"markAllRead": "Mark all as read",
"send": "Send",
"sending": "Sending...",
"cancel": "Cancel",
"back": "Back",
"viewAll": "View all notifications",
"view": "View"
"back": "Back"
},
"form": {
"to": "To",
@@ -51,12 +45,6 @@
"noSubject": "(no subject)",
"readAt": "Read {date}"
},
"notificationType": {
"message": "Message",
"announcement": "Announcement",
"homework": "Homework",
"grade": "Grade"
},
"search": {
"placeholder": "Search messages by subject or content...",
"noResults": "No matching messages found"
@@ -66,9 +54,6 @@
"inboxEmptyDesc": "You have no incoming messages yet.",
"sentEmpty": "No sent messages",
"sentEmptyDesc": "You have not sent any messages yet.",
"noNotifications": "No notifications",
"noNotificationsDesc": "You have no notifications yet.",
"noNotificationsDropdown": "No notifications",
"deleteTitle": "Delete message",
"deleteDesc": "This will permanently delete the message \"{subject}\"."
},
@@ -76,16 +61,17 @@
"sent": "Message sent",
"deleted": "Message deleted",
"markedRead": "Marked as read",
"allMarkedRead": "All notifications marked as read",
"notificationMarkedRead": "Notification marked as read",
"sendSelf": "Cannot send a message to yourself",
"sendFailed": "Failed to send message",
"deleteFailed": "Failed to delete",
"markReadFailed": "Failed to mark as read",
"notFound": "Message not found",
"invalidId": "Invalid message id",
"selectRecipient": "Please select a recipient"
},
"notification": {
"messageTitle": "New message: {subject}",
"messageTitleNoSubject": "New message"
},
"error": {
"loadFailed": "Failed to load messages",
"loadFailedDesc": "Sorry, an unexpected error occurred while loading messages. Please try again later.",

View File

@@ -0,0 +1,39 @@
{
"title": {
"list": "Notifications",
"dropdown": "Notifications"
},
"description": {
"list": "Stay updated on your latest activities."
},
"actions": {
"markRead": "Mark as read",
"markAllRead": "Mark all as read",
"viewAll": "View all notifications",
"view": "View"
},
"type": {
"message": "Message",
"announcement": "Announcement",
"homework": "Homework",
"grade": "Grade"
},
"status": {
"new": "New"
},
"empty": {
"noNotifications": "No notifications",
"noNotificationsDesc": "You have no notifications yet.",
"noNotificationsDropdown": "No notifications"
},
"messages": {
"allMarkedRead": "All notifications marked as read",
"notificationMarkedRead": "Notification marked as read",
"markReadFailed": "Failed to mark as read"
},
"error": {
"loadFailed": "Failed to load notifications",
"loadFailedDesc": "Sorry, an unexpected error occurred while loading notifications. Please try again later.",
"retry": "Retry"
}
}

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": "重试"
}
}