From 7bad6c19e0ea86f810a7aa4c2531360e136b71e4 Mon Sep 17 00:00:00 2001 From: Juan Denis Date: Mon, 19 Jan 2026 12:17:32 -0500 Subject: [PATCH] feat(19-4): Create custom ConnectionEdge component - Extends smoothstep edge with labels - Shows connection type label (Routes to, Uses DB, etc.) - Color-coded by connection type - Selected state with glow effect - Delete button on selection Co-Authored-By: Claude Opus 4.5 --- .../components/workflow/ConnectionEdge.jsx | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 frontend/src/components/workflow/ConnectionEdge.jsx diff --git a/frontend/src/components/workflow/ConnectionEdge.jsx b/frontend/src/components/workflow/ConnectionEdge.jsx new file mode 100644 index 00000000..d1c56596 --- /dev/null +++ b/frontend/src/components/workflow/ConnectionEdge.jsx @@ -0,0 +1,80 @@ +import React, { memo } from 'react'; +import { BaseEdge, EdgeLabelRenderer, getSmoothStepPath } from '@xyflow/react'; +import { X } from 'lucide-react'; +import { connectionLabels, connectionColors, getConnectionType } from '../../utils/connectionRules'; + +const ConnectionEdge = ({ + id, + sourceX, + sourceY, + targetX, + targetY, + sourcePosition, + targetPosition, + source, + target, + sourceHandleId, + selected, + data, + markerEnd +}) => { + const [edgePath, labelX, labelY] = getSmoothStepPath({ + sourceX, + sourceY, + sourcePosition, + targetX, + targetY, + targetPosition, + borderRadius: 8 + }); + + // Get connection type from data or derive from source/target + const connectionType = data?.connectionType || getConnectionType( + data?.sourceType || 'dockerApp', + data?.targetType || 'dockerApp' + ); + + const label = connectionLabels[connectionType] || 'Connected'; + const color = connectionColors[connectionType] || '#6366f1'; + + return ( + <> + + +
+ {label} + {selected && data?.onDelete && ( + + )} +
+
+ + ); +}; + +export default memo(ConnectionEdge);