Skip to content

Commit

Permalink
fix(graph): confirm button enabling without changes and sync node color
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Dec 18, 2024
1 parent 6c300e7 commit 03067f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export const Editor = ({
})

useEffect(() => {
if (selectedColor !== selectedSchema?.primary_color) {
if (isPopoverOpen && selectedColor !== selectedSchema?.primary_color) {
setSubmitDisabled(false)
}

Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -43,6 +44,7 @@ export const Node = memo(({ node, setSelectedNode, onSimulationUpdate, isSelecte
const meshRef = useRef<Mesh | null>(null)
const [normalizedSchemasByType] = useSchemaStore((s) => [s.normalizedSchemasByType])
const [showTooltip, setShowTooltip] = useState(false)
const { setSelectedColor } = useAppStore((s) => s)

console.log(isSelected)

Check warning on line 49 in src/components/ModalsContainer/BlueprintModal/Body/Graph/Nodes/Node/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement

Expand Down Expand Up @@ -124,7 +126,7 @@ export const Node = memo(({ node, setSelectedNode, onSimulationUpdate, isSelecte
onPointerOver={handleMouseOver}
position={new Vector3(node.x, node.y, 0)}
>
<Circle args={[NODE_RADIUS, 30, 20]}>
<Circle args={[NODE_RADIUS, 30, 20]} onClick={() => setSelectedColor(color)}>
<meshStandardMaterial attach="material" color={color} />
</Circle>

Expand Down

0 comments on commit 03067f2

Please sign in to comment.