Files
NextEdu/src/modules/lesson-preparation/constants.ts

108 lines
4.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { BlockType, TemplateBlockSkeleton, TemplateScope } from "./types";
// block 类型 → i18n 键(实际文本由 useTranslations("lessonPreparation").blockType.${type} 翻译)
// 保留此映射用于1) 新节点默认标题的 i18n 键查找 2) 类型守卫
export const BLOCK_TYPE_KEYS: Record<BlockType, string> = {
objective: "objective",
key_point: "key_point",
import: "import",
new_teaching: "new_teaching",
consolidation: "consolidation",
summary: "summary",
homework: "homework",
blackboard: "blackboard",
text_study: "text_study",
exercise: "exercise",
rich_text: "rich_text",
reflection: "reflection",
interaction: "interaction",
};
// 向后兼容:保留 BLOCK_TYPE_LABELS 名称但值为 i18n 键(实际翻译由组件层完成)
// @deprecated 使用 BLOCK_TYPE_KEYS 或 useTranslations("lessonPreparation").blockType.${type} 替代
export const BLOCK_TYPE_LABELS: Record<BlockType, string> = BLOCK_TYPE_KEYS;
// P0-9 修复:富文本 block 类型判断统一由 block-registry.tsx 的 isRichTextBlock() 提供。
// 已删除 RICH_TEXT_BLOCK_TYPES原 10 项定义与 isRichTextBlock 的 2 项语义冲突)。
// 系统预设模板骨架seed 用)
// V2-2 修复title/hint 存储 i18n 键,由 createLessonPlan 调用 getTranslations 翻译
// 键格式:`template.blocks.${templateId}.${blockIndex}.title` 或 `blockType.${type}`(默认)
export interface SystemTemplateDef {
id: string; // 固定 ID便于幂等
name: string; // i18n 键template.names.${id}
scope: TemplateScope;
blocks: TemplateBlockSkeleton[];
}
export const SYSTEM_TEMPLATES: SystemTemplateDef[] = [
{
id: "tpl_regular",
name: "tpl_regular", // i18n 键
scope: "regular",
blocks: [
{ type: "objective", title: "blockType.objective" },
{ type: "key_point", title: "blockType.key_point" },
{ type: "import", title: "blockType.import" },
{ type: "new_teaching", title: "blockType.new_teaching" },
{ type: "consolidation", title: "blockType.consolidation" },
{ type: "summary", title: "blockType.summary" },
{ type: "homework", title: "blockType.homework" },
{ type: "blackboard", title: "blockType.blackboard" },
],
},
{
id: "tpl_review",
name: "tpl_review",
scope: "review",
blocks: [
{ type: "objective", title: "blockType.objective" },
{ type: "rich_text", title: "template.blocks.tpl_review.1" },
{ type: "rich_text", title: "template.blocks.tpl_review.2" },
{ type: "rich_text", title: "template.blocks.tpl_review.3" },
{ type: "exercise", title: "blockType.exercise" },
{ type: "summary", title: "blockType.summary" },
],
},
{
id: "tpl_experiment",
name: "tpl_experiment",
scope: "experiment",
blocks: [
{ type: "objective", title: "blockType.objective" },
{ type: "rich_text", title: "template.blocks.tpl_experiment.1" },
{ type: "rich_text", title: "template.blocks.tpl_experiment.2" },
{ type: "rich_text", title: "template.blocks.tpl_experiment.3" },
{ type: "rich_text", title: "template.blocks.tpl_experiment.4" },
{ type: "summary", title: "blockType.summary" },
],
},
{
id: "tpl_inquiry",
name: "tpl_inquiry",
scope: "inquiry",
blocks: [
{ type: "rich_text", title: "template.blocks.tpl_inquiry.0" },
{ type: "rich_text", title: "template.blocks.tpl_inquiry.1" },
{ type: "rich_text", title: "template.blocks.tpl_inquiry.2" },
{ type: "rich_text", title: "template.blocks.tpl_inquiry.3" },
{ type: "rich_text", title: "template.blocks.tpl_inquiry.4" },
],
},
{
id: "tpl_blank",
name: "tpl_blank",
scope: "blank",
blocks: [],
},
];
export const LESSON_PLAN_STATUS_KEYS: Record<string, string> = {
draft: "draft",
published: "published",
archived: "archived",
};
// @deprecated 使用 useTranslations("lessonPreparation").status.${key} 替代
export const LESSON_PLAN_STATUS_LABELS: Record<string, string> = LESSON_PLAN_STATUS_KEYS;