fix(dashboard): v3 审计修复 — 数据完整性、i18n、类型安全、死代码清理
P0 修复(严重):
- admin ContentRow 标签与值错配(stats.users→textbooks 等 6 处)
- admin/error.tsx 硬编码中文替换为 useTranslations
- UserGrowthChart 空数据时渲染 EmptyState(userGrowth/homeworkTrend 永远为空数组)
P1 修复(高):
- 新增 admin/dashboard 和 student/dashboard 的 loading.tsx + error.tsx
- 抽取 DashboardLoadingSkeleton 和 DashboardErrorFallback 共享组件,消除 5 套重复文件
- formatDate/formatLongDate 传入用户 locale(admin/teacher/student 共 6 个组件)
- 移除死代码:getCachedAdminDashboard、AvatarImage src={undefined}、TeacherStats isLoading prop
- filterTodaySchedule 改为泛型函数,消除 as 类型断言
- 辅助函数 getStatus/getDueUrgency 新增显式返回类型
- UserGrowthChart 新增 labelKey prop 区分用户增长/作业提交趋势标签
P2 修复(中):
- 4 个组件从客户端转为服务端组件(DashboardGreetingHeader、TeacherQuickActions、TeacherDashboardHeader、StudentDashboardHeader)
- Student dashboard 空状态新增 CTA(viewSchedule、viewAll)
- TeacherHomeworkCard 图标按钮新增 aria-label
- TeacherTodoCard 排序逻辑重写为可读的 if/return 模式
同步更新:
- docs/architecture/005_architecture_data.json 新增 DashboardLoadingSkeleton、DashboardErrorFallback 条目
- 新增 docs/architecture/audit/dashboard-audit-report-v3.md 审计报告
- dashboard.json 新增 6 个 i18n 键(textbooks/chapters/questions/exams/totalAssignments/totalSubmissions)
This commit is contained in:
@@ -44,7 +44,8 @@
|
||||
"2": "Easy-Med",
|
||||
"3": "Medium",
|
||||
"4": "Med-Hard",
|
||||
"5": "Hard"
|
||||
"5": "Hard",
|
||||
"ariaLabel": "Difficulty level {{level}}: {{label}}"
|
||||
},
|
||||
"actions": {
|
||||
"preview": "Preview Exam",
|
||||
@@ -191,6 +192,8 @@
|
||||
"noDescription": "No description provided.",
|
||||
"progress": "Progress",
|
||||
"jumpToQuestion": "Jump to question {{index}}",
|
||||
"answered": "Answered",
|
||||
"unanswered": "Not answered",
|
||||
"yourAnswer": "Your answer",
|
||||
"answerPlaceholder": "Type your answer here...",
|
||||
"true": "True",
|
||||
@@ -198,7 +201,13 @@
|
||||
"unsupportedType": "Unsupported question type",
|
||||
"teacherFeedback": "Teacher Feedback",
|
||||
"noFeedback": "No specific feedback provided.",
|
||||
"makeSureAnswered": "Make sure you have answered all questions."
|
||||
"makeSureAnswered": "Make sure you have answered all questions.",
|
||||
"autoSaveIdle": "Auto-save ready",
|
||||
"autoSaveSaving": "Auto-saving...",
|
||||
"autoSaveSaved": "Auto-saved",
|
||||
"autoSaveError": "Auto-save failed. Will retry when network recovers.",
|
||||
"autoSaveRestored": "Restored unsaved answers from offline cache",
|
||||
"autoSaveCacheError": "Failed to restore offline cache"
|
||||
},
|
||||
"grade": {
|
||||
"title": "Grade",
|
||||
@@ -248,7 +257,19 @@
|
||||
"correctAnswer": "Correct Answer",
|
||||
"teacherFeedback": "Teacher Feedback",
|
||||
"score": "Score",
|
||||
"maxScore": "Max Score"
|
||||
"maxScore": "Max Score",
|
||||
"correctMarker": "✓ Correct",
|
||||
"backToList": "Back to List",
|
||||
"gradedReport": "Graded Report",
|
||||
"submissionDetails": "Submission Details",
|
||||
"questionsUnit": "Questions",
|
||||
"noAnswer": "No answer provided",
|
||||
"noFeedback": "No specific feedback provided.",
|
||||
"questionBreakdown": "Question Breakdown",
|
||||
"responseSummary": "Response Summary",
|
||||
"description": "Description",
|
||||
"noDescription": "No description provided.",
|
||||
"totalScore": "Total Score"
|
||||
},
|
||||
"status": {
|
||||
"draft": "Draft",
|
||||
|
||||
Reference in New Issue
Block a user