diff --git a/src/modules/lesson-preparation/components/paper-editor/inline-qa-dialog.tsx b/src/modules/lesson-preparation/components/paper-editor/inline-qa-dialog.tsx new file mode 100644 index 0000000..0ab2d84 --- /dev/null +++ b/src/modules/lesson-preparation/components/paper-editor/inline-qa-dialog.tsx @@ -0,0 +1,91 @@ +"use client"; + +import { useTranslations } from "next-intl"; +import type { InteractionBlockData, LessonPlanNode, QATurn } from "../../types"; +import { useLessonPlanEditor } from "../../hooks/use-lesson-plan-editor"; + +interface Props { + node: LessonPlanNode; +} + +/** + * V4 师生交互节点的 inline 对话体渲染。 + * - 师/生 角色标签(JetBrains Mono) + * - 教师提问下方 italic 灰色 [预期:...] + * - 对话轮次之间 dashed 线分隔 + */ +export function InlineQaDialog({ node }: Props) { + const t = useTranslations("lessonPreparation"); + const toggleExpand = useLessonPlanEditor((s) => s.toggleExpand); + const data = node.data as InteractionBlockData; + + return ( +
+
+ + {t("v4.interaction.label")} + + {data.turns?.length ?? 0} 轮 + + +
+

{node.title}

+
+ {data.designIntent && ( +

{data.designIntent}

+ )} +
+ {(data.turns ?? []).map((turn, idx) => ( + + ))} + {(!data.turns || data.turns.length === 0) && ( +

+ — +

+ )} +
+
+
+ ); +} + +function QaTurnView({ turn, index }: { turn: QATurn; index: number }) { + const t = useTranslations("lessonPreparation"); + const roleClass = turn.role === "teacher" ? "teacher" : "student"; + const roleLabel = turn.role === "teacher" ? t("v4.interaction.roleTeacher") : t("v4.interaction.roleStudent"); + void index; + + return ( +
+
{roleLabel}
+
+ {turn.content} + {turn.role === "teacher" && turn.expectedAnswer && ( + [预期:{turn.expectedAnswer}] + )} +
+
+ ); +}