From 03067f2dad58cae1030dc52cc01e3491bc653d85 Mon Sep 17 00:00:00 2001 From: aliraza556 Date: Thu, 19 Dec 2024 02:00:16 +0500 Subject: [PATCH] fix(graph): confirm button enabling without changes and sync node color --- .../ModalsContainer/BlueprintModal/Body/Editor/index.tsx | 4 ++-- .../BlueprintModal/Body/Graph/Nodes/Node/index.tsx | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx index ffbfaea43..cc43afb2e 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx @@ -420,7 +420,7 @@ export const Editor = ({ }) useEffect(() => { - if (selectedColor !== selectedSchema?.primary_color) { + if (isPopoverOpen && selectedColor !== selectedSchema?.primary_color) { setSubmitDisabled(false) } @@ -443,7 +443,7 @@ export const Editor = ({ }) return () => subscription.unsubscribe() - }, [form, attributes, parsedData, selectedSchema, loading, displayParentError, selectedColor]) + }, [form, attributes, parsedData, selectedSchema, loading, displayParentError, selectedColor, isPopoverOpen]) const resolvedParentValue = () => parentOptions?.find((i) => i.value === parent) diff --git a/src/components/ModalsContainer/BlueprintModal/Body/Graph/Nodes/Node/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/Graph/Nodes/Node/index.tsx index 276ee661e..b0c152384 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/Graph/Nodes/Node/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/Graph/Nodes/Node/index.tsx @@ -6,6 +6,7 @@ import styled from 'styled-components' import { BoxGeometry, Mesh, Vector3 } from 'three' import { SchemaExtended } from '~/components/ModalsContainer/BlueprintModal/types' import { fontProps } from '~/components/Universe/Graph/Cubes/Text/constants' +import { useAppStore } from '~/stores/useAppStore' import { useSchemaStore } from '~/stores/useSchemaStore' import { truncateText } from '~/utils/truncateText' import { NODE_RADIUS } from '../../constants' @@ -43,6 +44,7 @@ export const Node = memo(({ node, setSelectedNode, onSimulationUpdate, isSelecte const meshRef = useRef(null) const [normalizedSchemasByType] = useSchemaStore((s) => [s.normalizedSchemasByType]) const [showTooltip, setShowTooltip] = useState(false) + const { setSelectedColor } = useAppStore((s) => s) console.log(isSelected) @@ -124,7 +126,7 @@ export const Node = memo(({ node, setSelectedNode, onSimulationUpdate, isSelecte onPointerOver={handleMouseOver} position={new Vector3(node.x, node.y, 0)} > - + setSelectedColor(color)}>