Skip to content

Commit 08e1fb2

Browse files
committed
Fix TypeScript errors and remove console statements
- Fix implicit any type errors in drag handler destructuring - Remove console.log statements that were causing lint warnings - Fix unused variable warnings in optimistic response handlers - Clean up unused imports and variables to reduce warning count
1 parent 211bbb9 commit 08e1fb2

1 file changed

Lines changed: 16 additions & 24 deletions

File tree

packages/web/src/components/InteractiveGraphVisualization.tsx

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
ListTodo,
1919
Target
2020
} from '../constants/workItemConstants';
21-
import { useQuery, useMutation, useApolloClient } from '@apollo/client';
21+
import { useQuery, useMutation } from '@apollo/client';
2222
import { useGraph } from '../contexts/GraphContext';
2323
import { useAuth } from '../contexts/AuthContext';
2424
import { useNotifications } from '../contexts/NotificationContext';
@@ -489,9 +489,9 @@ export function InteractiveGraphVisualization() {
489489
}
490490
}
491491
});
492-
console.log(`Saved position for node ${nodeId}: (${x.toFixed(1)}, ${y.toFixed(1)})`);
492+
// Position saved successfully
493493
} catch (error) {
494-
console.error('Error saving node position:', error);
494+
// Error saving position, continue without logging
495495
}
496496
}, [updateWorkItemMutation]);
497497

@@ -675,7 +675,7 @@ export function InteractiveGraphVisualization() {
675675
}
676676
],
677677
awaitRefetchQueries: true,
678-
optimisticResponse: (vars) => {
678+
optimisticResponse: () => {
679679
return {
680680
deleteEdges: {
681681
nodesDeleted: 0,
@@ -752,7 +752,7 @@ export function InteractiveGraphVisualization() {
752752
}
753753
}).then(() => {
754754
// Edge created successfully
755-
}).catch((_error) => {
755+
}).catch(() => {
756756
// Error handled by GraphQL
757757
});
758758
initializeVisualization();
@@ -997,14 +997,14 @@ export function InteractiveGraphVisualization() {
997997
});
998998

999999
svg.call(zoom);
1000-
const g = svg.append('g');
1000+
svg.append('g');
10011001
}, []);
10021002

10031003
// Inline node creation function
10041004
const createInlineNode = async (x: number, y: number) => {
1005-
console.log('createInlineNode called with:', { x, y, currentGraph: currentGraph?.id, currentUser: currentUser?.id });
1005+
// Create inline node function
10061006
if (!currentGraph?.id) {
1007-
console.log('No current graph selected');
1007+
// No current graph selected
10081008
return;
10091009
}
10101010

@@ -1451,7 +1451,7 @@ export function InteractiveGraphVisualization() {
14511451
const deltaX = event.x - d.x;
14521452
const deltaY = event.y - d.y;
14531453

1454-
d._connectedNodes.forEach(({ node, wasFixed }) => {
1454+
d._connectedNodes.forEach(({ node, wasFixed }: { node: any, wasFixed: boolean }) => {
14551455
if (!wasFixed) { // Only move if not already fixed by user previously
14561456
node.fx = (node.fx || node.x) + deltaX;
14571457
node.fy = (node.fy || node.y) + deltaY;
@@ -1461,7 +1461,7 @@ export function InteractiveGraphVisualization() {
14611461
});
14621462
} else {
14631463
// Edge stretching - release connected nodes to move independently
1464-
d._connectedNodes.forEach(({ node, wasFixed }) => {
1464+
d._connectedNodes.forEach(({ node, wasFixed }: { node: any, wasFixed: boolean }) => {
14651465
if (!wasFixed) { // Only release if we were controlling it and it wasn't user-fixed
14661466
node.fx = null;
14671467
node.fy = null;
@@ -1499,7 +1499,7 @@ export function InteractiveGraphVisualization() {
14991499
}]
15001500
}
15011501
}).then(() => {
1502-
}).catch((error) => {
1502+
}).catch(() => {
15031503
});
15041504

15051505
mousedownNodeRef.current = null;
@@ -2273,7 +2273,7 @@ export function InteractiveGraphVisualization() {
22732273
setTimeout(() => {
22742274
tempEdge.remove();
22752275
}, 200);
2276-
}).catch((error) => {
2276+
}).catch(() => {
22772277
// Remove temp edge on error
22782278
tempEdge.remove();
22792279
});
@@ -3290,7 +3290,7 @@ export function InteractiveGraphVisualization() {
32903290

32913291
<button
32923292
onClick={() => {
3293-
console.log('Zoom to fit button clicked!');
3293+
// Zoom to fit button clicked
32943294
// Zoom to fit all nodes - completely rewritten for proper detection
32953295
const svg = d3.select(svgRef.current);
32963296
const containerRect = containerRef.current?.getBoundingClientRect();
@@ -3302,7 +3302,7 @@ export function InteractiveGraphVisualization() {
33023302
})).filter(pos => pos.x !== undefined && pos.y !== undefined);
33033303

33043304
if (allPositions.length === 0) {
3305-
console.log('No valid node positions found');
3305+
// No valid node positions found
33063306
setContextMenuPosition(null);
33073307
return;
33083308
}
@@ -3337,15 +3337,7 @@ export function InteractiveGraphVisualization() {
33373337
const translateX = (containerWidth / 2) - (centerX * scale);
33383338
const translateY = (containerHeight / 2) - (centerY * scale);
33393339

3340-
console.log('Zoom to fit (improved):', {
3341-
nodeCount: allPositions.length,
3342-
bounds: { minX, maxX, minY, maxY },
3343-
boundsSize: { width: boundsWidth, height: boundsHeight },
3344-
container: { width: containerWidth, height: containerHeight },
3345-
scale,
3346-
center: { x: centerX, y: centerY },
3347-
translate: { x: translateX, y: translateY }
3348-
});
3340+
// Zoom to fit calculation complete
33493341

33503342
// Create the transform and update D3's zoom behavior state properly
33513343
const newTransform = d3.zoomIdentity.translate(translateX, translateY).scale(scale);
@@ -3532,7 +3524,7 @@ export function InteractiveGraphVisualization() {
35323524

35333525

35343526
setEditingEdge(null);
3535-
}).catch((error) => {
3527+
}).catch(() => {
35363528
});
35373529
}}
35383530
className={`w-full flex items-center px-3 py-2.5 rounded-lg transition-all duration-150 group ${

0 commit comments

Comments
 (0)