diff --git a/src/frontend/src/CustomNodes/GenericNode/components/NodeDescription/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/NodeDescription/index.tsx new file mode 100644 index 000000000..81d334b19 --- /dev/null +++ b/src/frontend/src/CustomNodes/GenericNode/components/NodeDescription/index.tsx @@ -0,0 +1,100 @@ +import { Textarea } from "@/components/ui/textarea"; +import useFlowsManagerStore from "@/stores/flowsManagerStore"; +import useFlowStore from "@/stores/flowStore"; +import { handleKeyDown } from "@/utils/reactflowUtils"; +import { cn } from "@/utils/utils"; +import { useEffect, useState } from "react"; +import Markdown from "react-markdown"; + +export default function NodeDescription({ + description, + selected, + nodeId, +}: { + description?: string; + selected: boolean; + nodeId: string; +}) { + const [inputDescription, setInputDescription] = useState(false); + const [nodeDescription, setNodeDescription] = useState(description); + const takeSnapshot = useFlowsManagerStore((state) => state.takeSnapshot); + const setNode = useFlowStore((state) => state.setNode); + + useEffect(() => { + if (!selected) { + setInputDescription(false); + } + }, [selected]); + + useEffect(() => { + setNodeDescription(description); + }, [description]); + + return ( +
+ {inputDescription ? ( +