Skip to content

Commit a08eb19

Browse files
committed
(fixed) issue in which onclick of node was not dispatching actions
2 parents e26d857 + e938454 commit a08eb19

File tree

1 file changed

+30
-36
lines changed

1 file changed

+30
-36
lines changed

src/app/components/StateRoute.tsx

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ import {
1414
import { ParentSize } from '@visx/responsive';
1515
import Tree from './Tree';
1616
import ComponentMap from './ComponentMap';
17-
// import PerfView from './PerfView';
1817
import AtomsRelationship from './AtomsRelationship.jsx';
1918
import PerformanceVisx from './PerformanceVisx';
20-
// import ZoomI from './zoomFt';
21-
// import History from './History'
2219

2320
import { changeView, changeSlider } from '../actions/actions';
2421
import { useStoreContext } from '../store';
@@ -48,19 +45,17 @@ interface StateRouteProps {
4845

4946
const StateRoute = (props: StateRouteProps) => {
5047
const { snapshot, hierarchy, snapshots, viewIndex } = props;
48+
<<<<<<< HEAD
5149
const [{ tabs, currentTab }, dispatch] = useStoreContext();
5250
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
51+
=======
52+
53+
console.log(hierarchy);
54+
>>>>>>> e938454e37a781e16248bb535d0850ea3a0020fd
5355

5456
const isRecoil = snapshot.atomsComponents ? true : false;
5557
const [noRenderData, setNoRenderData] = useState(false);
5658

57-
// component map zoom state
58-
const [{ x, y, k }, setZoomState]: any = useState({
59-
x: 150,
60-
y: 250,
61-
k: 1,
62-
});
63-
6459
// Map
6560
const renderComponentMap = () => {
6661
if (hierarchy) {
@@ -72,13 +67,12 @@ const StateRoute = (props: StateRouteProps) => {
7267
</ParentSize>
7368
);
7469
}
75-
return <div className="noState">{NO_STATE_MSG}</div>;
70+
return <div className='noState'>{NO_STATE_MSG}</div>;
7671
};
7772

7873
// the hierarchy gets set on the first click in the page
7974
// when the page is refreshed we may not have a hierarchy, so we need to check if hierarchy was initialized
80-
// if true involk render chart with hierarchy
81-
//* we wrap History in a ParentSize div, in order to make use of Visx's Zoom functionality
75+
// if true invoke render chart with hierarchy
8276
const renderHistory = () => {
8377
if (hierarchy) {
8478
return (
@@ -90,7 +84,7 @@ const StateRoute = (props: StateRouteProps) => {
9084
/>
9185
);
9286
}
93-
return <div className="noState">{NO_STATE_MSG}</div>;
87+
return <div className='noState'>{NO_STATE_MSG}</div>;
9488
};
9589

9690
const renderAtomsRelationship = () => (
@@ -103,12 +97,12 @@ const StateRoute = (props: StateRouteProps) => {
10397

10498
// the hierarchy gets set on the first click in the page
10599
// when the page is refreshed we may not have a hierarchy, so we need to check if hierarchy was initialized
106-
// if true involk render Tree with snapshot
100+
// if true invoke render Tree with snapshot
107101
const renderTree = () => {
108102
if (hierarchy) {
109103
return <Tree snapshot={snapshot} />;
110104
}
111-
return <div className="noState">{NO_STATE_MSG}</div>;
105+
return <div className='noState'>{NO_STATE_MSG}</div>;
112106
};
113107

114108
const renderPerfView = () => {
@@ -134,55 +128,55 @@ const StateRoute = (props: StateRouteProps) => {
134128
// />
135129
);
136130
}
137-
return <div className="noState">{NO_STATE_MSG}</div>;
131+
return <div className='noState'>{NO_STATE_MSG}</div>;
138132
};
139133

140134
return (
141135
<Router>
142-
<div className="navbar">
136+
<div className='navbar'>
143137
<NavLink
144-
className="router-link"
145-
activeClassName="is-active"
138+
className='router-link'
139+
activeClassName='is-active'
146140
exact
147-
to="/"
141+
to='/'
148142
>
149143
Tree
150144
</NavLink>
151145
<NavLink
152-
className="router-link"
153-
activeClassName="is-active"
154-
to="/history"
146+
className='router-link'
147+
activeClassName='is-active'
148+
to='/history'
155149
>
156150
History
157151
</NavLink>
158-
<NavLink className="router-link" activeClassName="is-active" to="/map">
152+
<NavLink className='router-link' activeClassName='is-active' to='/map'>
159153
Map
160154
</NavLink>
161155

162156
{isRecoil && (
163157
<NavLink
164-
className="router-link"
165-
activeClassName="is-active"
166-
to="/relationship"
158+
className='router-link'
159+
activeClassName='is-active'
160+
to='/relationship'
167161
>
168162
AtomsRecoil
169163
</NavLink>
170164
)}
171165

172166
<NavLink
173-
className="router-link"
174-
activeClassName="is-active"
175-
to="/performance"
167+
className='router-link'
168+
activeClassName='is-active'
169+
to='/performance'
176170
>
177171
Performance
178172
</NavLink>
179173
</div>
180174
<Switch>
181-
<Route path="/map" render={renderComponentMap} />
182-
<Route path="/history" render={renderHistory} />
183-
<Route path="/relationship" render={renderAtomsRelationship} />
184-
<Route path="/performance" render={renderPerfView} />
185-
<Route path="/" render={renderTree} />
175+
<Route path='/map' render={renderComponentMap} />
176+
<Route path='/history' render={renderHistory} />
177+
<Route path='/relationship' render={renderAtomsRelationship} />
178+
<Route path='/performance' render={renderPerfView} />
179+
<Route path='/' render={renderTree} />
186180
</Switch>
187181
</Router>
188182
);

0 commit comments

Comments
 (0)