diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx index 5f41a03537f..4c2e668c459 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx @@ -9,10 +9,11 @@ import { Input, Label, Textarea, + Tooltip, } from '@sim/emcn' import { Trash } from '@sim/emcn/icons' import { generateId } from '@sim/utils/id' -import { Plus } from 'lucide-react' +import { ArrowLeftRight, Plus } from 'lucide-react' import { useParams } from 'next/navigation' import { formatDisplayText } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/formatted-text' import { @@ -62,6 +63,12 @@ const BOOLEAN_OPTIONS: ComboboxOption[] = [ { label: 'false', value: 'false' }, ] +/** + * Values representable by the boolean selector; anything else (e.g. a block + * reference) requires the manual input. + */ +const BOOLEAN_LITERALS = new Set(['', 'true', 'false']) + /** * Parses a value that might be a JSON string or already an array of VariableAssignment. * This handles the case where workflows are imported with stringified values. @@ -116,6 +123,7 @@ export function VariablesInput({ const overlayRefs = useRef>({}) const [dragHighlight, setDragHighlight] = useState>({}) const [collapsedAssignments, setCollapsedAssignments] = useState>({}) + const [manualBooleanModes, setManualBooleanModes] = useState>({}) const currentWorkflowVariables = Object.values(workflowVariables).filter( (v: Variable) => v.workflowId === workflowId @@ -375,6 +383,9 @@ export function VariablesInput({ valuePath: [index, 'variableName'], label: variableLabel, }) + const isManualBoolean = + assignment.type === 'boolean' && + (manualBooleanModes[assignment.id] ?? !BOOLEAN_LITERALS.has(assignment.value ?? '')) const booleanLabelHighlight = getWorkflowSearchLabelHighlight({ activeSearchTarget, blockId, @@ -467,8 +478,44 @@ export function VariablesInput({
- - {assignment.type === 'boolean' ? ( +
+ + {assignment.type === 'boolean' && ( + + + + + +

+ {isManualBoolean ? 'Switch to selector' : 'Switch to manual value'} +

+
+
+ )} +
+ {assignment.type === 'boolean' && !isManualBoolean ? (