feat(wizard): enhance branching logic and add next step selection in PropertiesPanel

This commit is contained in:
2026-04-08 12:08:33 -04:00
parent 86c1f35537
commit 6b54724171
5 changed files with 40 additions and 5 deletions
@@ -835,6 +835,40 @@ export function PropertiesPanelBase({
</SelectContent>
</Select>
</div>
<div>
<Label className="text-xs">After this step, go to</Label>
<p className="text-muted-foreground mb-1 text-[10px]">
Override the next step (use to converge branch paths).
</p>
<Select
value={(selectedStep.trigger.conditions as any)?.nextStepId ?? "__linear__"}
onValueChange={(val) => {
onStepUpdate(selectedStep.id, {
trigger: {
...selectedStep.trigger,
conditions: {
...(selectedStep.trigger.conditions as any),
nextStepId: val === "__linear__" ? undefined : val,
},
},
});
}}
>
<SelectTrigger className="mt-1 h-7 w-full text-xs">
<SelectValue placeholder="Next step (default)" />
</SelectTrigger>
<SelectContent>
<SelectItem value="__linear__">Next step (default)</SelectItem>
{design.steps
.filter((s) => s.id !== selectedStep.id)
.map((s) => (
<SelectItem key={s.id} value={s.id}>
{s.name}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
</div>
</div>
</div>
@@ -922,8 +922,8 @@ export const WizardInterface = React.memo(function WizardInterface({
// Log action execution
console.log("Executing action:", actionId, parameters);
// Handle branching logic (wizard_wait_for_response)
if (parameters?.value && parameters?.label) {
// Handle branching logic (wizard_wait_for_response / branch)
if (parameters?.label || parameters?.nextStepId) {
setLastResponse(String(parameters.value));
// If nextStepId is provided, jump immediately
@@ -499,6 +499,7 @@ export function WizardActionItem({
// Manual/Wizard Actions (Leaf nodes)
!isContainer &&
action.type !== "wizard_wait_for_response" &&
!isBranch &&
!isCompleted && (
<Button
size="sm"
@@ -524,7 +525,7 @@ export function WizardActionItem({
<div className="grid grid-cols-1 gap-2 pt-3 sm:grid-cols-2">
{(action.parameters.options as any[]).map((opt, optIdx) => {
const label = typeof opt === "string" ? opt : opt.label;
const value = typeof opt === "string" ? opt : opt.value;
const value = typeof opt === "string" ? opt : (opt.value ?? opt.label);
const nextStepId =
typeof opt === "object" ? opt.nextStepId : undefined;
+1 -1
View File
@@ -30,7 +30,7 @@
],
"incremental": true,
/* Path Aliases */
"baseUrl": ".",
// "baseUrl": ".",
"paths": {
"~/*": [
"./src/*"