diff --git a/space_flow/src/CustomNodes/ChatInputNode/index.tsx b/space_flow/src/CustomNodes/ChatInputNode/index.tsx index 160759241..09ad117d7 100644 --- a/space_flow/src/CustomNodes/ChatInputNode/index.tsx +++ b/space_flow/src/CustomNodes/ChatInputNode/index.tsx @@ -1,5 +1,5 @@ import { Bars3CenterLeftIcon, ChatBubbleBottomCenterTextIcon } from "@heroicons/react/24/outline"; -import Input from "../../components/inputComponent"; +import InputComponent from "../../components/inputComponent"; import { isValidConnection, nodeColors, snakeToNormalCase } from "../../utils"; import { Handle, Position } from "reactflow"; import Tooltip from "../../components/TooltipComponent"; diff --git a/space_flow/src/CustomNodes/ChatOutputNode/index.tsx b/space_flow/src/CustomNodes/ChatOutputNode/index.tsx index 3e8e5994f..696a9b3ea 100644 --- a/space_flow/src/CustomNodes/ChatOutputNode/index.tsx +++ b/space_flow/src/CustomNodes/ChatOutputNode/index.tsx @@ -1,6 +1,6 @@ import { Bars3CenterLeftIcon, ChatBubbleBottomCenterTextIcon } from "@heroicons/react/24/outline"; import { Handle, Position } from "reactflow"; -import Input from "../../components/inputComponent"; +import InputComponent from "../../components/inputComponent"; import { isValidConnection, nodeColors, snakeToNormalCase } from "../../utils"; import Tooltip from "../../components/TooltipComponent"; diff --git a/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index cac97a131..f55dc430a 100644 --- a/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -6,7 +6,7 @@ import { snakeToNormalCase, } from "../../../../utils"; import { useEffect, useRef, useState } from "react"; -import Input from "../../../../components/inputComponent"; +import InputComponent from "../../../../components/inputComponent"; import ToggleComponent from "../../../../components/toggleComponent"; export default function ParameterComponent({ @@ -60,7 +60,7 @@ export default function ParameterComponent({ {left === true && type === "str" ? (
- { data.node.template[name].value = t; diff --git a/space_flow/src/CustomNodes/InputNode/index.tsx b/space_flow/src/CustomNodes/InputNode/index.tsx index c1fb65c8a..379e89717 100644 --- a/space_flow/src/CustomNodes/InputNode/index.tsx +++ b/space_flow/src/CustomNodes/InputNode/index.tsx @@ -1,5 +1,5 @@ import { Bars3CenterLeftIcon, TrashIcon } from "@heroicons/react/24/outline"; -import Input from "../../components/inputComponent"; +import InputComponent from "../../components/inputComponent"; import { isValidConnection, nodeColors, @@ -43,7 +43,7 @@ export default function InputNode({ data }) {
- { data.text = e; diff --git a/space_flow/src/components/inputComponent/index.tsx b/space_flow/src/components/inputComponent/index.tsx index 831d6638b..eb39e792a 100644 --- a/space_flow/src/components/inputComponent/index.tsx +++ b/space_flow/src/components/inputComponent/index.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; -export default function Input({value, onChange}){ +export default function InputComponent({value, onChange}){ const [myValue, setMyValue] = useState(value ?? ""); return ( <> diff --git a/space_flow/src/components/inputListComponent/index.tsx b/space_flow/src/components/inputListComponent/index.tsx new file mode 100644 index 000000000..0e08e56d5 --- /dev/null +++ b/space_flow/src/components/inputListComponent/index.tsx @@ -0,0 +1,29 @@ +import { useState } from "react"; + +var _ = require('lodash'); + +export default function InputListComponent({value, onChange}){ + const [inputList, setInputList] = useState(value ?? []); + + return ( + <> + {inputList.map((i, idx) =>( + { + setInputList((old) => { + let newInputList = _.cloneDeep(old); + newInputList[idx] = e.target.value; + return newInputList; + }); + onChange(inputList); + }} + /> + ))} + + + ); +} \ No newline at end of file