From ec313e4f3b9c61a36943e0e09d31f1c9525604ee Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 30 Jan 2024 15:55:25 -0300 Subject: [PATCH] feat(IOview): add support for rendering IOOutputView component based on selected output type feat(IOOutputView): create IOOutputView component to render different types of output views based on output type fix(utils): add helper functions isInputType and isOutputType to check if a type is an input or output type The changes were made to add support for rendering different types of output views in the IOView component. The IOOutputView component was created to handle rendering of different types of output views based on the output type. Helper functions isInputType and isOutputType were added to the utils file to check if a type is an input or output type. --- .../src/components/IOOutputView/index.tsx | 47 +++++++++++++++++++ src/frontend/src/components/IOview/index.tsx | 18 ++++--- src/frontend/src/types/components/index.ts | 4 ++ src/frontend/src/utils/reactflowUtils.ts | 8 ++++ 4 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 src/frontend/src/components/IOOutputView/index.tsx diff --git a/src/frontend/src/components/IOOutputView/index.tsx b/src/frontend/src/components/IOOutputView/index.tsx new file mode 100644 index 000000000..aed4317b8 --- /dev/null +++ b/src/frontend/src/components/IOOutputView/index.tsx @@ -0,0 +1,47 @@ +import { cloneDeep } from "lodash"; +import useFlowStore from "../../stores/flowStore"; +import { IOOutputProps } from "../../types/components"; +import { Textarea } from "../ui/textarea"; + +export default function IOOutputView({ + outputType, + outputId, +}: IOOutputProps): JSX.Element | undefined { + const nodes = useFlowStore((state) => state.nodes); + const setNode = useFlowStore((state) => state.setNode); + const flowPool = useFlowStore((state) => state.flowPool); + const node = nodes.find((node) => node.id === outputId); + function handleOutputType() { + if (!node) return "no node found"; + switch (outputType) { + case "TextOutput": + return ( +