From 5617385b881a007ec47930116d129cab93db1155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A8=E6=AC=A3?= Date: Wed, 4 Sep 2024 23:57:59 +0800 Subject: [PATCH] feat: Add helper function to render control component in AddFlowVariableModal --- .../canvas-modal/add-flow-variable-modal.tsx | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/web/components/flow/canvas-modal/add-flow-variable-modal.tsx b/web/components/flow/canvas-modal/add-flow-variable-modal.tsx index 6be1c6982..5105acb94 100644 --- a/web/components/flow/canvas-modal/add-flow-variable-modal.tsx +++ b/web/components/flow/canvas-modal/add-flow-variable-modal.tsx @@ -126,6 +126,37 @@ export const AddFlowVariableModal: React.FC = ({ flowInfo }) => { } }; + // Helper function to render the appropriate control component + const renderVariableValue = (type: string, index: number) => { + switch (type) { + case 'ref': + return ( + onRefTypeValueChange(value, selectedOptions, index)} + changeOnSelect + /> + ); + case 'str': + return ; + case 'int': + return ; + case 'float': + return ; + case 'bool': + return ( + + ); + default: + return ; + } + }; + return ( <>