@@ -14,6 +14,7 @@ import {
14
14
import Tree from './Tree' ;
15
15
import ComponentMap from './ComponentMap' ;
16
16
import PerfView from './PerfView' ;
17
+ import AtomsRelationship from './AtomsRelationship.jsx' ;
17
18
18
19
const History = require ( './History' ) . default ;
19
20
@@ -29,15 +30,22 @@ interface StateRouteProps {
29
30
state ?: string | object ;
30
31
stateSnaphot ?: object ;
31
32
children ?: any [ ] ;
33
+ AtomsRelationship ?: any [ ] ;
32
34
} ;
33
- hierarchy : object ;
35
+ hierarchy : any ;
34
36
snapshots : [ ] ;
35
37
viewIndex : number ;
36
38
}
37
39
38
40
const StateRoute = ( props : StateRouteProps ) => {
39
41
const { snapshot, hierarchy, snapshots, viewIndex } = props ;
42
+ // let isRecoil = true;
43
+ // console.log('snapshot', snapshot)
44
+ // console.log(snapshot.AtomsRelationship)
45
+ let isRecoil = snapshot . AtomsRelationship ? true : false ;
40
46
const [ noRenderData , setNoRenderData ] = useState ( false ) ;
47
+
48
+ // component map zoom state
41
49
const [ { x, y, k } , setZoomState ] : any = useState ( {
42
50
x : 150 ,
43
51
y : 250 ,
@@ -52,14 +60,20 @@ const StateRoute = (props: StateRouteProps) => {
52
60
return < div className = "noState" > { NO_STATE_MSG } </ div > ;
53
61
} ;
54
62
63
+
55
64
// the hierarchy gets set on the first click in the page
56
65
// when the page is refreshed we may not have a hierarchy, so we need to check if hierarchy was initialized
57
66
// if true involk render chart with hierarchy
58
67
const renderHistory = ( ) => {
59
- if ( hierarchy ) {
68
+ if ( hierarchy . children . length > 0 ) {
69
+
60
70
return < History hierarchy = { hierarchy } /> ;
61
71
}
62
- return < div className = "noState" > { NO_STATE_MSG } </ div > ;
72
+ return < div className = "noState" > Application not compatible with history</ div > ;
73
+ } ;
74
+
75
+ const renderAtomsRelationship = ( ) => {
76
+ return < AtomsRelationship atomsRel = { snapshot . AtomsRelationship } /> ;
63
77
} ;
64
78
65
79
// the hierarchy gets set on the first click in the page
@@ -119,6 +133,11 @@ const StateRoute = (props: StateRouteProps) => {
119
133
< NavLink className = "router-link" activeClassName = "is-active" to = "/map" >
120
134
Map
121
135
</ NavLink >
136
+
137
+ { isRecoil && < NavLink className = "router-link" activeClassName = "is-active" to = "/relationship" >
138
+ Atoms Relationship
139
+ </ NavLink > }
140
+
122
141
< NavLink
123
142
className = "router-link"
124
143
activeClassName = "is-active"
@@ -130,6 +149,7 @@ const StateRoute = (props: StateRouteProps) => {
130
149
< Switch >
131
150
< Route path = "/map" render = { renderComponentMap } />
132
151
< Route path = "/history" render = { renderHistory } />
152
+ < Route path = "/relationship" render = { renderAtomsRelationship } />
133
153
< Route path = "/performance" render = { renderPerfView } />
134
154
< Route path = "/" render = { renderTree } />
135
155
</ Switch >
0 commit comments