1- import React , { useEffect , useRef , useState , useMemo } from 'react' ;
1+ import React , { useEffect , useRef , useState } from 'react' ;
22import * as d3 from 'd3' ;
33import { calculateDegreeCentrality , calculateBetweennessCentrality , calculateClusteringCoefficient } from '../utils/graphMetrics' ;
44import './NetworkGraph.css' ;
@@ -25,7 +25,7 @@ const NetworkGraph = ({
2525 const simulationRef = useRef ( null ) ;
2626 const [ selectedNode , setSelectedNode ] = useState ( null ) ;
2727 const [ isLayoutFrozen , setIsLayoutFrozen ] = useState ( false ) ;
28- const [ filterType , setFilterType ] = useState ( 'important' ) ; // Keep filterType internal for now or move next
28+ const [ filterType ] = useState ( 'important' ) ; // Keep filterType internal for now or move next
2929 const [ highlightedNodeId , setHighlightedNodeId ] = useState ( null ) ;
3030
3131 // Reset local filters when global search changes
@@ -34,21 +34,6 @@ const NetworkGraph = ({
3434 setSelectedNode ( null ) ;
3535 } , [ searchQuery , events ] ) ;
3636
37- // Extract unique actors and tags for dropdowns
38- const { uniqueActors, uniqueTags } = useMemo ( ( ) => {
39- const actors = new Set ( ) ;
40- const tags = new Set ( ) ;
41-
42- events ?. forEach ( event => {
43- event . actors ?. forEach ( actor => actors . add ( actor ) ) ;
44- event . tags ?. forEach ( tag => tags . add ( tag ) ) ;
45- } ) ;
46-
47- return {
48- uniqueActors : Array . from ( actors ) . sort ( ) ,
49- uniqueTags : Array . from ( tags ) . sort ( )
50- } ;
51- } , [ events ] ) ;
5237
5338 // Category colors and definitions
5439 const categories = [
@@ -803,24 +788,6 @@ const NetworkGraph = ({
803788 // Store reference to simulation (null for timeline layout)
804789 simulationRef . current = null ;
805790
806- // Drag functions for timeline (constrained movement)
807- function dragStarted ( event ) {
808- // Timeline layout is static
809- event . subject . fx = event . subject . x ;
810- event . subject . fy = event . subject . y ;
811- }
812-
813- function dragged ( event ) {
814- event . subject . fx = event . x ;
815- event . subject . fy = event . y ;
816- d3 . select ( this ) . attr ( 'cx' , event . x ) . attr ( 'cy' , event . y ) ;
817- }
818-
819- function dragEnded ( event ) {
820- event . subject . fx = event . x ;
821- event . subject . fy = event . y ;
822- }
823-
824791 function highlightConnections ( node ) {
825792 const connectedNodes = new Set ( [ node . id ] ) ;
826793
@@ -945,7 +912,6 @@ const NetworkGraph = ({
945912 const sortedNodes = graphData . nodes . sort ( ( a , b ) => ( b . impact || 0 ) - ( a . impact || 0 ) ) ;
946913
947914 const cols = Math . ceil ( Math . sqrt ( sortedNodes . length * ( width / height ) ) ) ;
948- const cellSize = width / cols ;
949915
950916 sortedNodes . forEach ( ( node , i ) => {
951917 const col = i % cols ;
@@ -1002,7 +968,7 @@ const NetworkGraph = ({
1002968 default :
1003969 renderForceLayout ( graphData ) ;
1004970 }
1005- } , [ events , graphLayout , filterType , showLabels , maxNodes , minConnectionStrength ,
971+ } , [ events , graphLayout , filterType , showLabels , showMetrics , maxNodes , minConnectionStrength ,
1006972 searchQuery , selectedActor , selectedTag , highlightedNodeId , activeCategories , isLayoutFrozen ] ) ;
1007973
1008974 const handleCategoryToggle = ( categoryId ) => {
0 commit comments