diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx index 2c2d098..c5f9d33 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx @@ -12,6 +12,32 @@ type PlanEditorDialogProps = { description? : string; }; + +/** + * Creates an action, as a step for a plan. + * @param type the type of action to build + * @param value the value of this action to build + * @param isGestureTag whether or not this action, restricted to gestures, is a tag. + * @returns An action + */ +function createAction( + type: ActionTypes, + value: string, + isGestureTag: boolean +): Action { + const id = crypto.randomUUID(); + + switch (type) { + case "speech": + return { id, text: value, type: "speech" }; + case "gesture": + return { id, gesture: value, isTag: isGestureTag, type: "gesture" }; + case "llm": + return { id, goal: value, type: "llm" }; + } +} + + export default function PlanEditorDialog({ plan, onSave,