From deadc001cbe3e933ccdf71008f0b66f6ed795dff Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 15 Apr 2026 01:42:04 +0200 Subject: [PATCH] Add functions for creating and handling project sequence control steps --- src/app/App.tsx | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/app/App.tsx b/src/app/App.tsx index 0b84dfb7..15e1c955 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -4495,6 +4495,28 @@ export function App({ store, initialStatusMessage }: AppProps) { }; }; + const createProjectSequenceControlStepFromOption = ( + stepClass: "held" | "impulse", + targetKey: string, + effectOptionId: ProjectScheduleEffectOptionId + ): Extract => { + const targetOption = resolveSequenceControlTargetOption(targetKey); + + if (targetOption === null) { + throw new Error("The selected sequence control target no longer exists."); + } + + return { + stepClass, + type: "controlEffect", + effect: createProjectScheduleEffectFromOption({ + targetOption, + effectOptionId, + previousEffect: null + }) + }; + }; + const updateProjectSequence = ( sequenceId: string, label: string, @@ -4622,6 +4644,25 @@ export function App({ store, initialStatusMessage }: AppProps) { ); }; + const handleAddProjectSequenceSpecificControlStep = ( + sequenceId: string, + stepClass: "held" | "impulse", + targetKey: string, + effectOptionId: ProjectScheduleEffectOptionId, + label: string, + successMessage: string + ) => { + updateProjectSequence(sequenceId, label, successMessage, (sequence) => { + sequence.effects.push( + createProjectSequenceControlStepFromOption( + stepClass, + targetKey, + effectOptionId + ) + ); + }); + }; + const handleAddProjectSequenceDialogueStep = ( sequenceId: string, dialogueId: string