diff --git a/app/w/[id]/components/custom-edge/custom-edge.tsx b/app/w/[id]/components/custom-edge/custom-edge.tsx index 73429527ca..6208068e8b 100644 --- a/app/w/[id]/components/custom-edge/custom-edge.tsx +++ b/app/w/[id]/components/custom-edge/custom-edge.tsx @@ -1,70 +1,70 @@ import { X } from 'lucide-react' -import { EdgeProps, getSmoothStepPath } from 'reactflow' +import { BaseEdge, EdgeLabelRenderer, EdgeProps, getSmoothStepPath } from 'reactflow' -export const CustomEdge = (props: EdgeProps) => { - const isHorizontal = props.sourcePosition === 'right' || props.sourcePosition === 'left' +export const CustomEdge = ({ + id, + sourceX, + sourceY, + targetX, + targetY, + sourcePosition, + targetPosition, + data, +}: EdgeProps) => { + const isHorizontal = sourcePosition === 'right' || sourcePosition === 'left' - // For horizontal handles, we'll add a minimum extension to ensure the path - // always goes outward before going up/down const [edgePath, labelX, labelY] = getSmoothStepPath({ - sourceX: props.sourceX, - sourceY: props.sourceY, - sourcePosition: props.sourcePosition, - targetX: props.targetX, - targetY: props.targetY, - targetPosition: props.targetPosition, + sourceX, + sourceY, + sourcePosition, + targetX, + targetY, + targetPosition, borderRadius: 8, offset: isHorizontal ? 30 : 20, }) - const isSelected = props.id === props.data?.selectedEdgeId + const isSelected = id === data?.selectedEdgeId return ( - - + + - - - {isSelected && ( - +
{ + e.preventDefault() e.stopPropagation() - props.data?.onDelete?.(props.id) + if (data?.onDelete) { + data.onDelete(id) + } }} >
-
+ )} -
+ ) }