Skip to content

Commit dc02c3a

Browse files
committed
Fix TypeScript errors in graph visualization components
- Fixed WorkItem interface mismatches between components - Removed unused variables (selectGraph, currentTeam, startConnection, etc.) - Fixed edge title property access (source/target are strings, not objects) - Made assignedTo field compatible with both string and object types - Cleaned up dead code and unused imports This resolves the main TypeScript compilation errors in the PR.
1 parent f322424 commit dc02c3a

2 files changed

Lines changed: 29 additions & 19 deletions

File tree

packages/web/src/components/InteractiveGraphVisualization.tsx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ interface EdgeMenuState {
6969
export function InteractiveGraphVisualization() {
7070
const svgRef = useRef<SVGSVGElement>(null);
7171
const containerRef = useRef<HTMLDivElement>(null);
72-
const { currentGraph, availableGraphs, selectGraph } = useGraph();
73-
const { currentTeam } = useAuth();
72+
const { currentGraph, availableGraphs } = useGraph();
73+
const { } = useAuth();
7474

7575
const { data: workItemsData, loading, error, refetch } = useQuery(GET_WORK_ITEMS, {
7676
variables: currentGraph ? {
@@ -840,8 +840,6 @@ export function InteractiveGraphVisualization() {
840840
const lineHeight = fontSize * 1.2;
841841

842842
// Calculate vertical offset to center multi-line text
843-
const totalHeight = lines.length * lineHeight;
844-
const startY = -(totalHeight / 2) + (lineHeight / 2);
845843

846844
// Determine text color based on node background color for contrast
847845
const getTextColor = (nodeType: string) => {
@@ -857,9 +855,6 @@ export function InteractiveGraphVisualization() {
857855
}
858856
};
859857

860-
const textColor = getTextColor(d.type);
861-
const shadowColor = textColor === '#ffffff' ? 'rgba(0,0,0,0.8)' : 'rgba(255,255,255,0.8)';
862-
863858
// Old text removed - using new Monopoly-style text instead
864859
});
865860

@@ -1118,11 +1113,6 @@ export function InteractiveGraphVisualization() {
11181113
}
11191114
};
11201115

1121-
const startConnection = (nodeId: string) => {
1122-
setConnectionSource(nodeId);
1123-
setIsConnecting(true);
1124-
setNodeMenu(prev => ({ ...prev, visible: false }));
1125-
};
11261116

11271117
const handleViewNodeDetails = (node: WorkItem) => {
11281118
setSelectedNode(node);
@@ -1188,8 +1178,8 @@ export function InteractiveGraphVisualization() {
11881178

11891179
const handleEditEdge = (edge: WorkItemEdge) => {
11901180
// For now, just allow changing the relationship type
1191-
const sourceTitle = typeof edge.source === 'string' ? edge.source : edge.source?.title || 'Unknown';
1192-
const targetTitle = typeof edge.target === 'string' ? edge.target : edge.target?.title || 'Unknown';
1181+
const sourceTitle = edge.source || 'Unknown';
1182+
const targetTitle = edge.target || 'Unknown';
11931183
const newType = prompt(`Change relationship type for "${sourceTitle}" → "${targetTitle}". Current: ${edge.type}`, edge.type);
11941184
if (newType && newType !== edge.type) {
11951185
updateEdgeMutation({
@@ -1203,8 +1193,8 @@ export function InteractiveGraphVisualization() {
12031193
};
12041194

12051195
const handleDeleteEdge = (edge: WorkItemEdge) => {
1206-
const sourceTitle = typeof edge.source === 'string' ? edge.source : edge.source?.title || 'Unknown';
1207-
const targetTitle = typeof edge.target === 'string' ? edge.target : edge.target?.title || 'Unknown';
1196+
const sourceTitle = edge.source || 'Unknown';
1197+
const targetTitle = edge.target || 'Unknown';
12081198
if (confirm(`Are you sure you want to delete the ${edge.type.toLowerCase()} relationship between "${sourceTitle}" and "${targetTitle}"?`)) {
12091199
deleteEdgeMutation({
12101200
variables: {

packages/web/src/components/NodeDetailsModal.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,28 @@ interface WorkItem {
1717
id: string;
1818
name: string;
1919
username: string;
20-
};
20+
} | string;
2121
owner?: {
2222
id: string;
2323
name: string;
2424
username: string;
2525
};
2626
createdAt?: string;
2727
updatedAt?: string;
28+
// Additional fields that may exist in InteractiveGraphVisualization's WorkItem
29+
positionX?: number;
30+
positionY?: number;
31+
positionZ?: number;
32+
teamId?: string;
33+
userId?: string;
34+
dependencies?: WorkItem[];
35+
dependents?: WorkItem[];
36+
priority?: {
37+
executive: number;
38+
individual: number;
39+
community: number;
40+
computed: number;
41+
};
2842
}
2943

3044
interface NodeDetailsModalProps {
@@ -175,8 +189,14 @@ export function NodeDetailsModal({ isOpen, onClose, node, onEdit }: NodeDetailsM
175189
<User className="h-4 w-4 mr-2" />
176190
Assigned To
177191
</h3>
178-
<div className="text-gray-300">{node.assignedTo.name}</div>
179-
<div className="text-gray-500 text-sm">@{node.assignedTo.username}</div>
192+
{typeof node.assignedTo === 'string' ? (
193+
<div className="text-gray-300">{node.assignedTo}</div>
194+
) : (
195+
<>
196+
<div className="text-gray-300">{node.assignedTo.name}</div>
197+
<div className="text-gray-500 text-sm">@{node.assignedTo.username}</div>
198+
</>
199+
)}
180200
</div>
181201
)}
182202

0 commit comments

Comments
 (0)