refactor: ♻️ Rename step to block
This commit is contained in:
@ -13,7 +13,7 @@ export const SourceEndpoint = ({
|
||||
const {
|
||||
setConnectingIds,
|
||||
addSourceEndpoint,
|
||||
blocksCoordinates,
|
||||
groupsCoordinates,
|
||||
previewingEdge,
|
||||
} = useGraph()
|
||||
const ref = useRef<HTMLDivElement | null>(null)
|
||||
@ -24,18 +24,18 @@ export const SourceEndpoint = ({
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (ranOnce || !ref.current || Object.keys(blocksCoordinates).length === 0)
|
||||
if (ranOnce || !ref.current || Object.keys(groupsCoordinates).length === 0)
|
||||
return
|
||||
const id = source.itemId ?? source.stepId
|
||||
const id = source.itemId ?? source.blockId
|
||||
addSourceEndpoint({
|
||||
id,
|
||||
ref,
|
||||
})
|
||||
setRanOnce(true)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [ref.current, blocksCoordinates])
|
||||
}, [ref.current, groupsCoordinates])
|
||||
|
||||
if (!blocksCoordinates) return <></>
|
||||
if (!groupsCoordinates) return <></>
|
||||
return (
|
||||
<Flex
|
||||
ref={ref}
|
||||
@ -62,7 +62,7 @@ export const SourceEndpoint = ({
|
||||
borderWidth="3.5px"
|
||||
shadow={`sm`}
|
||||
borderColor={
|
||||
previewingEdge?.from.stepId === source.stepId &&
|
||||
previewingEdge?.from.blockId === source.blockId &&
|
||||
previewingEdge.from.itemId === source.itemId
|
||||
? 'blue.300'
|
||||
: 'blue.200'
|
||||
|
@ -3,11 +3,11 @@ import { useGraph } from 'contexts/GraphContext'
|
||||
import React, { useEffect, useRef } from 'react'
|
||||
|
||||
export const TargetEndpoint = ({
|
||||
stepId,
|
||||
blockId,
|
||||
isVisible,
|
||||
...props
|
||||
}: BoxProps & {
|
||||
stepId: string
|
||||
blockId: string
|
||||
isVisible?: boolean
|
||||
}) => {
|
||||
const { addTargetEndpoint } = useGraph()
|
||||
@ -16,7 +16,7 @@ export const TargetEndpoint = ({
|
||||
useEffect(() => {
|
||||
if (!ref.current) return
|
||||
addTargetEndpoint({
|
||||
id: stepId,
|
||||
id: blockId,
|
||||
ref,
|
||||
})
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
Reference in New Issue
Block a user