Skip to content

Commit 4e1ccf4

Browse files
committed
Fix critical TypeScript compilation errors
- Unified WorkItem interface across components to resolve type mismatches - Fixed role type comparison errors by updating auth types - Resolved ReactNode JSX expression issues - Fixed LucideProps incompatibility by removing invalid title prop - Added missing edgeCount property to GraphHierarchy interface - Added memberCount property to Team interface - Fixed priorityComp undefined errors with null checks - Updated CI workflow to trigger on development branch PRs - Created shared type definitions in types/graph.ts All critical build-blocking TypeScript errors resolved.
1 parent b3b7bd4 commit 4e1ccf4

8 files changed

Lines changed: 86 additions & 111 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, develop]
5+
branches: [main, develop, development]
66
pull_request:
7-
branches: [main, develop]
7+
branches: [main, develop, development]
88

99
# Prevent duplicate runs
1010
concurrency:

packages/web/src/components/EditNodeModal.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,12 @@ import { useAuth } from '../contexts/AuthContext';
66
import { useNotifications } from '../contexts/NotificationContext';
77
import { NodeTypeSelector } from './NodeCategorySelector';
88
import { TagInput } from './TagInput';
9+
import { WorkItem } from '../types/graph';
910

1011
interface EditNodeModalProps {
1112
isOpen: boolean;
1213
onClose: () => void;
13-
node: {
14-
id: string;
15-
title: string;
16-
description?: string;
17-
type: string;
18-
status: string;
19-
priorityExec: number;
20-
priorityIndiv: number;
21-
priorityComm: number;
22-
tags?: string[];
23-
dueDate?: string;
24-
assignedTo?: string;
25-
};
14+
node: WorkItem;
2615
}
2716

2817
export function EditNodeModal({ isOpen, onClose, node }: EditNodeModalProps) {
@@ -48,7 +37,7 @@ export function EditNodeModal({ isOpen, onClose, node }: EditNodeModalProps) {
4837
priorityExec: node.priorityExec || 0,
4938
priorityIndiv: node.priorityIndiv || 0,
5039
priorityComm: node.priorityComm || 0,
51-
assignedTo: node.assignedTo || '',
40+
assignedTo: typeof node.assignedTo === 'string' ? node.assignedTo : (node.assignedTo?.id || ''),
5241
dueDate: formatDateForInput(node.dueDate),
5342
tags: node.tags || [],
5443
});
@@ -63,7 +52,7 @@ export function EditNodeModal({ isOpen, onClose, node }: EditNodeModalProps) {
6352
priorityExec: node.priorityExec || 0,
6453
priorityIndiv: node.priorityIndiv || 0,
6554
priorityComm: node.priorityComm || 0,
66-
assignedTo: node.assignedTo || '',
55+
assignedTo: typeof node.assignedTo === 'string' ? node.assignedTo : (node.assignedTo?.id || ''),
6756
dueDate: formatDateForInput(node.dueDate),
6857
tags: node.tags || [],
6958
});

packages/web/src/components/GraphSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export function GraphSelector() {
193193
</div>
194194
<div className="flex items-center gap-2 text-xs text-gray-400">
195195
<span>{graph.id === currentGraph.id ? actualNodeCount : (graph.nodeCount || 0)} node{(graph.id === currentGraph.id ? actualNodeCount : (graph.nodeCount || 0)) !== 1 ? 's' : ''}, {graph.id === currentGraph.id ? actualEdgeCount : (graph.edgeCount || 0)} connection{(graph.id === currentGraph.id ? actualEdgeCount : (graph.edgeCount || 0)) !== 1 ? 's' : ''}</span>
196-
<Eye className="h-3 w-3 opacity-50" title={`${graph.type}${graph.isShared ? ' • Shared' : ''}`} />
196+
<Eye className="h-3 w-3 opacity-50" />
197197
</div>
198198
</div>
199199
{graph.id === currentGraph.id && (

packages/web/src/components/InteractiveGraphVisualization.tsx

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useQuery, useMutation } from '@apollo/client';
55
import { useGraph } from '../contexts/GraphContext';
66
import { useAuth } from '../contexts/AuthContext';
77
import { GET_WORK_ITEMS, GET_EDGES, CREATE_EDGE, UPDATE_EDGE, DELETE_EDGE } from '../lib/queries';
8-
import { relationshipTypeInfo, RelationshipType } from '../types/projectData';
8+
import { relationshipTypeInfo } from '../types/projectData';
99
import { validateGraphData, getValidationSummary, ValidationResult } from '../utils/graphDataValidation';
1010
import { EditNodeModal } from './EditNodeModal';
1111
import { DeleteNodeModal } from './DeleteNodeModal';
@@ -17,42 +17,7 @@ import { DeleteGraphModal } from './DeleteGraphModal';
1717
import { ConnectNodeModal } from './ConnectNodeModal';
1818
import { NodeDetailsModal } from './NodeDetailsModal';
1919

20-
interface WorkItem {
21-
id: string;
22-
title: string;
23-
description?: string;
24-
type: string;
25-
status: string;
26-
positionX: number;
27-
positionY: number;
28-
positionZ?: number;
29-
priorityExec: number;
30-
priorityIndiv: number;
31-
priorityComm: number;
32-
priorityComp: number;
33-
teamId: string;
34-
userId: string;
35-
tags?: string[];
36-
dueDate?: string;
37-
assignedTo?: string;
38-
dependencies?: WorkItem[];
39-
dependents?: WorkItem[];
40-
priority?: {
41-
executive: number;
42-
individual: number;
43-
community: number;
44-
computed: number;
45-
};
46-
}
47-
48-
interface WorkItemEdge {
49-
id: string;
50-
source: string;
51-
target: string;
52-
type: RelationshipType;
53-
strength?: number;
54-
description?: string;
55-
}
20+
import { WorkItem, WorkItemEdge, RelationshipType } from '../types/graph';
5621

5722
interface NodeMenuState {
5823
node: WorkItem | null;
@@ -774,8 +739,9 @@ export function InteractiveGraphVisualization() {
774739
.attr('cx', (d: WorkItem) => getNodeDimensions(d).width / 2 - 8)
775740
.attr('cy', (d: WorkItem) => getNodeDimensions(d).height / 2 - 8)
776741
.attr('fill', (d: WorkItem) => {
777-
if (d.priorityComp > 0.7) return '#dc2626'; // High priority - red
778-
if (d.priorityComp > 0.4) return '#d97706'; // Medium priority - orange
742+
const priority = d.priorityComp || 0;
743+
if (priority > 0.7) return '#dc2626'; // High priority - red
744+
if (priority > 0.4) return '#d97706'; // Medium priority - orange
779745
return '#059669'; // Low priority - green
780746
})
781747
.attr('stroke', '#ffffff')
@@ -1472,7 +1438,7 @@ export function InteractiveGraphVisualization() {
14721438
<div className="grid grid-cols-2 gap-2 text-xs">
14731439
<div>
14741440
<span className="text-gray-400">Priority:</span>
1475-
<span className="ml-1 font-medium">{Math.round((nodeMenu.node.priority?.computed || nodeMenu.node.priorityComp) * 100)}%</span>
1441+
<span className="ml-1 font-medium">{Math.round((nodeMenu.node?.priority?.computed || nodeMenu.node?.priorityComp || 0) * 100)}%</span>
14761442
</div>
14771443
</div>
14781444
</div>
@@ -1712,9 +1678,6 @@ export function InteractiveGraphVisualization() {
17121678
}}
17131679
/>
17141680
)}
1715-
1716-
{/* Debug info */}
1717-
{console.log('Modal states:', { showConnectModal, selectedNode: selectedNode?.title })}
17181681
</div>
17191682
);
17201683
}

packages/web/src/components/NodeDetailsModal.tsx

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,6 @@
11
import React from 'react';
22
import { X, Calendar, Clock, User, Flag, Edit3 } from 'lucide-react';
3-
4-
interface WorkItem {
5-
id: string;
6-
title: string;
7-
description?: string;
8-
type: string;
9-
status: string;
10-
priorityExec?: number;
11-
priorityIndiv?: number;
12-
priorityComm?: number;
13-
priorityComp?: number;
14-
dueDate?: string;
15-
tags?: string[];
16-
assignedTo?: {
17-
id: string;
18-
name: string;
19-
username: string;
20-
} | string;
21-
owner?: {
22-
id: string;
23-
name: string;
24-
username: string;
25-
};
26-
createdAt?: string;
27-
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-
};
42-
}
3+
import { WorkItem } from '../types/graph';
434

445
interface NodeDetailsModalProps {
456
isOpen: boolean;

packages/web/src/components/UserManagement.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ const UPDATE_USER_ROLE = gql`
3636
`;
3737

3838
const ROLE_HIERARCHY = [
39-
{ value: 'NODE_WATCHER', label: 'Node Watcher', icon: Eye, color: 'text-gray-400', description: 'Read-only access' },
40-
{ value: 'CONNECTOR', label: 'Connector', icon: Users, color: 'text-blue-400', description: 'Can work on tasks' },
41-
{ value: 'ORIGIN_NODE', label: 'Origin Node', icon: UserCheck, color: 'text-green-400', description: 'Task creators' },
42-
{ value: 'PATH_KEEPER', label: 'Path Keeper', icon: Settings, color: 'text-purple-400', description: 'Project maintainers' },
43-
{ value: 'GRAPH_MASTER', label: 'Graph Master', icon: Crown, color: 'text-yellow-400', description: 'System administrators' }
39+
{ value: 'GUEST', label: 'Guest', icon: Eye, color: 'text-purple-400', description: 'Anonymous demo access (read-only)' },
40+
{ value: 'VIEWER', label: 'Viewer', icon: Eye, color: 'text-gray-400', description: 'Read-only access to graphs and nodes' },
41+
{ value: 'USER', label: 'User', icon: Users, color: 'text-blue-400', description: 'Can create and work on tasks' },
42+
{ value: 'ADMIN', label: 'Admin', icon: Crown, color: 'text-yellow-400', description: 'Full system administration access' }
4443
];
4544

4645
export function UserManagement() {
@@ -56,15 +55,15 @@ export function UserManagement() {
5655
});
5756

5857
// Check if user can manage roles
59-
const canManageRoles = currentUser && ['PATH_KEEPER', 'GRAPH_MASTER'].includes(currentUser.role);
60-
const canPromoteToMaster = currentUser?.role === 'GRAPH_MASTER';
58+
const canManageRoles = currentUser && ['ADMIN'].includes(currentUser.role);
59+
const canPromoteToAdmin = currentUser?.role === 'ADMIN';
6160

6261
if (!canManageRoles) {
6362
return (
6463
<div className="p-8 text-center">
6564
<Crown className="h-16 w-16 text-gray-600 mx-auto mb-4" />
6665
<h2 className="text-xl font-semibold text-gray-300 mb-2">Access Restricted</h2>
67-
<p className="text-gray-400">You need PATH_KEEPER or GRAPH_MASTER role to manage users.</p>
66+
<p className="text-gray-400">You need ADMIN role to manage users.</p>
6867
</div>
6968
);
7069
}
@@ -191,7 +190,7 @@ export function UserManagement() {
191190
<option
192191
key={role.value}
193192
value={role.value}
194-
disabled={role.value === 'GRAPH_MASTER' && !canPromoteToMaster}
193+
disabled={role.value === 'ADMIN' && !canPromoteToAdmin}
195194
>
196195
{role.label}
197196
</option>

packages/web/src/types/auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface User {
44
email: string;
55
username: string;
66
avatar?: string;
7-
role: 'NODE_WATCHER' | 'CONNECTOR' | 'ORIGIN_NODE' | 'PATH_KEEPER' | 'GRAPH_MASTER';
7+
role: 'GUEST' | 'VIEWER' | 'USER' | 'ADMIN';
88
isActive: boolean;
99
isEmailVerified: boolean;
1010
lastLogin?: string;
@@ -17,6 +17,7 @@ export interface Team {
1717
description?: string;
1818
logo?: string;
1919
isActive: boolean;
20+
memberCount?: number;
2021
}
2122

2223
export interface AuthContextType {

packages/web/src/types/graph.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,72 @@ export interface GraphHierarchy {
6464
type: Graph['type'];
6565
children: GraphHierarchy[];
6666
nodeCount: number;
67+
edgeCount: number;
6768
isShared: boolean;
6869
permissions: 'OWNER' | 'ADMIN' | 'EDIT' | 'VIEW';
6970
}
7071

72+
export interface WorkItem {
73+
id: string;
74+
title: string;
75+
description?: string;
76+
type: string;
77+
status: string;
78+
priorityExec?: number;
79+
priorityIndiv?: number;
80+
priorityComm?: number;
81+
priorityComp?: number;
82+
dueDate?: string;
83+
tags?: string[];
84+
assignedTo?: {
85+
id: string;
86+
name: string;
87+
username: string;
88+
} | string;
89+
owner?: {
90+
id: string;
91+
name: string;
92+
username: string;
93+
};
94+
createdAt?: string;
95+
updatedAt?: string;
96+
// Additional fields that may exist in InteractiveGraphVisualization's WorkItem
97+
positionX?: number;
98+
positionY?: number;
99+
positionZ?: number;
100+
teamId?: string;
101+
userId?: string;
102+
dependencies?: WorkItem[];
103+
dependents?: WorkItem[];
104+
priority?: {
105+
executive: number;
106+
individual: number;
107+
community: number;
108+
computed: number;
109+
};
110+
}
111+
112+
export type RelationshipType =
113+
| 'DEPENDS_ON' // This node depends on another to be completed
114+
| 'BLOCKS' // This node blocks another from starting
115+
| 'ENABLES' // This node enables another (similar to depends but softer)
116+
| 'RELATES_TO' // General relationship
117+
| 'PART_OF' // This node is a part/component of another
118+
| 'FOLLOWS' // This node should be done after another (sequence)
119+
| 'PARALLEL_WITH' // This node can be done in parallel with another
120+
| 'DUPLICATES' // This node duplicates effort of another
121+
| 'CONFLICTS_WITH' // This node conflicts with another
122+
| 'VALIDATES' // This node validates/tests another
123+
124+
export interface WorkItemEdge {
125+
id: string;
126+
source: string;
127+
target: string;
128+
type: RelationshipType;
129+
strength?: number;
130+
description?: string;
131+
}
132+
71133
export interface CreateGraphInput {
72134
name: string;
73135
description?: string;

0 commit comments

Comments
 (0)