danylokhodus commited on
Commit
6c7159f
·
1 Parent(s): 433b3b5

feat: render subgoal edges as amber dashed lines and continuation edges as green dashed lines on canvas

Browse files
src/features/canvas/hooks/useCanvasLogic.js CHANGED
@@ -1096,19 +1096,25 @@ export const useCanvasLogic = (projectId, user) => {
1096
  }
1097
 
1098
  setEdges(eds => eds.map(e => {
 
 
 
 
1099
  const isAnimated = activeEdgeIds.has(e.id);
1100
 
1101
  const isSubgoalEdge = e.sourceHandle && e.sourceHandle.startsWith('subgoals-source');
1102
 
1103
  const strokeColor = isSubgoalEdge
1104
  ? (isAnimated ? '#EAB308' : 'rgba(234, 179, 8, 0.55)')
1105
- : (isAnimated ? '#22C55E' : 'rgba(140, 144, 148, 0.5)');
1106
  const strokeWidth = isAnimated ? 3 : 2;
 
1107
 
1108
  if (
1109
  e.animated === isAnimated &&
1110
  e.style?.stroke === strokeColor &&
1111
  e.style?.strokeWidth === strokeWidth &&
 
1112
  e.markerEnd?.color === strokeColor
1113
  ) {
1114
  return e;
@@ -1120,7 +1126,8 @@ export const useCanvasLogic = (projectId, user) => {
1120
  style: {
1121
  ...e.style,
1122
  stroke: strokeColor,
1123
- strokeWidth: strokeWidth
 
1124
  },
1125
  markerEnd: {
1126
  ...e.markerEnd,
 
1096
  }
1097
 
1098
  setEdges(eds => eds.map(e => {
1099
+ if (e.type === 'sticker') {
1100
+ return e; // Keep sticker edges as they are, they have their own component-level custom styling!
1101
+ }
1102
+
1103
  const isAnimated = activeEdgeIds.has(e.id);
1104
 
1105
  const isSubgoalEdge = e.sourceHandle && e.sourceHandle.startsWith('subgoals-source');
1106
 
1107
  const strokeColor = isSubgoalEdge
1108
  ? (isAnimated ? '#EAB308' : 'rgba(234, 179, 8, 0.55)')
1109
+ : (isAnimated ? '#22C55E' : 'rgba(34, 197, 94, 0.35)');
1110
  const strokeWidth = isAnimated ? 3 : 2;
1111
+ const dashArray = '6 4';
1112
 
1113
  if (
1114
  e.animated === isAnimated &&
1115
  e.style?.stroke === strokeColor &&
1116
  e.style?.strokeWidth === strokeWidth &&
1117
+ e.style?.strokeDasharray === dashArray &&
1118
  e.markerEnd?.color === strokeColor
1119
  ) {
1120
  return e;
 
1126
  style: {
1127
  ...e.style,
1128
  stroke: strokeColor,
1129
+ strokeWidth: strokeWidth,
1130
+ strokeDasharray: dashArray
1131
  },
1132
  markerEnd: {
1133
  ...e.markerEnd,