feat(lesson-preparation): 备课模块审计重构 — 跨模块解耦 + i18n + 纯函数抽取 + 错误边界

P0-1 跨模块直查修复:publish-service 不再直查 examQuestions 表,新增 exams/data-access.addExamQuestions 接口,复用 classes/data-access.getStudentIdsByClassIds

P0-2 i18n 接入:新增 zh-CN/en 翻译文件,注册 lessonPreparation 命名空间,17 个组件改造为 useTranslations/getTranslations

P1 纯函数抽取:lib/document-migration.ts(类型守卫替代 as 断言)、lib/node-summary.ts(翻译函数注入)、lib/rf-mappers.ts

P1 错误边界+骨架屏:新增 LessonPlanErrorBoundary 和 4 个 Skeleton 组件

P1 Block 注册表:新增 config/block-registry.tsx(BlockRenderer 组件),node-edit-panel 重构为配置驱动渲染

P1 其他修复:exercise-block 改用 router.refresh(),node-editor/lesson-node 复用 lib/ 纯函数

架构图同步:更新 004 和 005 文档

Refs: docs/architecture/audit/lesson-preparation-audit-report.md
This commit is contained in:
SpecialX
2026-06-22 16:17:58 +08:00
parent 4833930834
commit 20691f53ce
32 changed files with 1456 additions and 360 deletions

View File

@@ -0,0 +1,198 @@
{
"title": {
"list": "My Lesson Plans",
"new": "New Lesson Plan",
"edit": "Edit Lesson Plan"
},
"description": {
"list": "Manage your lesson preparation and teaching plans."
},
"action": {
"new": "New Lesson Plan",
"back": "Back to Lesson Plans",
"addNode": "Add Node",
"saveVersion": "Save Version",
"versions": "Versions",
"duplicate": "Duplicate",
"archive": "Archive",
"delete": "Delete Node",
"close": "Close",
"cancel": "Cancel",
"confirm": "Confirm",
"create": "Create Lesson Plan",
"publish": "Publish as Homework",
"viewHomework": "View"
},
"status": {
"saving": "Saving...",
"unsaved": "Unsaved",
"saved": "Saved",
"draft": "Draft",
"published": "Published",
"archived": "Archived",
"publishedAsHomework": "Published as Homework"
},
"blockType": {
"objective": "Objective",
"key_point": "Key Points",
"import": "Introduction",
"new_teaching": "New Teaching",
"consolidation": "Consolidation",
"summary": "Summary",
"homework": "Homework",
"blackboard": "Blackboard Design",
"text_study": "Text Study",
"exercise": "Exercise",
"rich_text": "Custom Section",
"reflection": "Reflection"
},
"template": {
"regular": "Regular Lesson",
"review": "Review Lesson",
"experiment": "Experiment Lesson",
"inquiry": "Inquiry Lesson",
"blank": "Blank Template",
"selectLabel": "Select Template",
"titleLabel": "Lesson Plan Title",
"titlePlaceholder": "e.g., Autumn - Lesson 1",
"blockCount": "{count} sections",
"blankHint": "Start from scratch"
},
"editor": {
"canvasEmpty": "Canvas is empty",
"canvasEmptyHint": "Click \"Add Node\" at the bottom left to start",
"selectNodeHint": "Click a node to edit content, or drag to connect",
"unknownBlockType": "Unknown node type",
"nodeSummaryEmpty": "Empty",
"questionCount": "{count} questions",
"charCount": "{count} chars"
},
"filters": {
"searchPlaceholder": "Search title...",
"allSubjects": "All Subjects",
"allStatus": "All Status"
},
"list": {
"empty": "No lesson plans. Click \"New Lesson Plan\" to start",
"noTextbook": "No textbook",
"noChapter": "No chapter",
"noTemplate": "No template",
"lastSaved": "Last saved: ",
"neverSaved": "Never saved"
},
"version": {
"title": "Version History",
"empty": "No versions",
"loading": "Loading...",
"auto": "Auto",
"manual": "Manual save",
"revert": "Revert to this version",
"revertConfirm": "Revert to v{versionNo}? A new version will be created.",
"autoLabel": "Auto version"
},
"knowledgePoint": {
"title": "Select Knowledge Points",
"empty": "No knowledge points found. Please create them in the textbook module first.",
"linked": "Linked to {count} knowledge points",
"annotate": "Annotate Knowledge Points",
"select": "Select Knowledge Points",
"selected": "{count} selected"
},
"questionBank": {
"title": "Select Questions from Bank",
"add": "Add",
"insert": "Insert",
"selected": "{count} questions selected",
"source": {
"bank": "Bank",
"inline": "New"
},
"inlineTitle": "New Question (in lesson plan)",
"inlineNew": "New Question",
"fromBank": "Add from Bank",
"score": "{score} pts",
"difficulty": "{level} star",
"empty": "No questions. Click the button below to add",
"inlineQuestion": "New question in lesson plan",
"questionId": "Question {id}",
"type": {
"single_choice": "Single Choice",
"text": "Fill in Blank",
"judgment": "True/False"
},
"typeLabel": "Question Type",
"stemLabel": "Question Stem",
"optionsLabel": "Options (check correct answer)",
"addOption": "+ Add Option",
"correctAnswer": "Correct Answer",
"correct": "True",
"incorrect": "False",
"difficultyLabel": "Difficulty",
"knowledgePointLabel": "Knowledge Points",
"stemRequired": "Please enter the question stem",
"addBtn": "Add"
},
"exercise": {
"purpose": {
"class_practice": "Class Practice",
"after_class_homework": "After-class Homework"
}
},
"publish": {
"title": "Publish as Homework",
"classLabel": "Target Classes",
"availableAtLabel": "Available At (optional)",
"dueAtLabel": "Due At (optional)",
"publishing": "Publishing...",
"publish": "Publish",
"selectClass": "Please select at least one class",
"noStudents": "No students in selected classes",
"noSubjectOrGrade": "Lesson plan missing subject or grade info",
"alreadyPublished": "This exercise block is already published. Use 'Republish'",
"noExerciseBlock": "Exercise block not found",
"noQuestions": "No questions in exercise block",
"planNotFound": "Lesson plan not found",
"noPermission": "No permission to publish"
},
"textStudy": {
"sourceTextLabel": "Source Text",
"sourceTextPlaceholder": "Paste source text, select text to add annotations",
"addAnnotation": "Add Annotation for Selection",
"selectFirst": "Please select text first",
"annotationTitle": "Teaching Node",
"annotationNotePlaceholder": "Teaching notes..."
},
"reflection": {
"hint": "Write teaching reflection after class..."
},
"richText": {
"placeholder": "Enter content..."
},
"error": {
"getList": "Failed to get lesson plan list",
"getOne": "Failed to get lesson plan",
"create": "Failed to create lesson plan",
"save": "Failed to save",
"saveVersion": "Failed to save version",
"getVersions": "Failed to get versions",
"revert": "Failed to revert",
"delete": "Failed to delete",
"duplicate": "Failed to duplicate",
"getTemplates": "Failed to get templates",
"saveTemplate": "Failed to save template",
"deleteTemplate": "Failed to delete template",
"publish": "Failed to publish",
"aiSuggest": "AI suggestion failed. Please check AI Provider config",
"loadKnowledgePoints": "Failed to load knowledge points",
"notFound": "Lesson plan not found or no access",
"versionNotFound": "Version not found or no permission",
"templateNotFound": "Template not found",
"createFailed": "Creation failed",
"loadFailed": "Page load failed",
"loadFailedDesc": "Sorry, an unexpected error occurred. Please try again later.",
"retry": "Retry"
},
"confirm": {
"archive": "Archive this lesson plan?"
}
}