Skip to content

Commit 8430fd3

Browse files
committed
added ax array to accessibility tab
1 parent 0e8bd84 commit 8430fd3

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

src/app/components/StateRoute/Ax.tsx

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ import { JSONTree } from 'react-json-tree'; // React JSON Viewer Component;
33
import { setCurrentTabInApp } from '../../slices/mainSlice';
44
import { useDispatch } from 'react-redux';
55

6-
// const getItemString = (
7-
// type: any,
8-
// data: { state?: object | string; name: string; children: [] },
9-
// ) => {
10-
// // function that allows the customization of how arrays, objects, and iterable nodes are displayed.
11-
// if (data && data.name) {
12-
// return <span>{data.name}</span>;
13-
// }
14-
// return <span />;
15-
// };
166
const theme = {
177
scheme: 'monokai',
188
author: 'wimer hazenberg (http://www.monokai.nl)',
@@ -39,27 +29,21 @@ const AxTree = (props) => {
3929
snapshot, // from 'tabs[currentTab]' object in 'MainContainer'
4030
snapshots, // from 'tabs[currentTab].snapshotDisplay' object in 'MainContainer'
4131
currLocation, // from 'tabs[currentTab]' object in 'MainContainer'
32+
axSnapshots,
4233
} = props;
4334

4435
const dispatch = useDispatch();
4536

4637
useEffect(() => {
4738
dispatch(setCurrentTabInApp('AxTree')); // dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'tree' to facilitate render.
4839
}, []);
49-
// const json = {
50-
// array: [1, 2, 3],
51-
// bool: true,
52-
// object: {
53-
// foo: 'bar',
54-
// },
55-
// };
5640

5741
//removing/adding snapshot at beginning of return statement didn't change anything
5842
return(
5943
<> {snapshot && (
6044
<JSONTree
61-
data={snapshots[currLocation.index] || snapshot}
62-
shouldExpandNodeInitially={() => true}
45+
data={axSnapshots}
46+
// shouldExpandNodeInitially={() => true}
6347
theme = {theme}
6448
/>
6549
)}

src/app/components/StateRoute/StateRoute.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const NO_STATE_MSG = 'No state change detected. Trigger an event to change state
2626

2727
const StateRoute = (props: StateRouteProps) => {
2828
const {
29+
axSnapshots, // from 'tabs[currentTab]' object in 'MainContainer'
2930
snapshot, // from 'tabs[currentTab]' object in 'MainContainer'
3031
hierarchy: propsHierarchy, // from 'tabs[currentTab]' object in 'MainContainer'
3132
snapshots, // from 'tabs[currentTab].snapshotDisplay' object in 'MainContainer'
@@ -99,6 +100,7 @@ const StateRoute = (props: StateRouteProps) => {
99100
<Route
100101
path = '/accessibility'
101102
element = {<AxTree
103+
axSnapshots={axSnapshots}
102104
snapshot={snapshot}
103105
snapshots={snapshots}
104106
currLocation={currLocation}/>}

src/app/containers/MainContainer.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ function MainContainer(): JSX.Element {
163163

164164
// }, 5000);
165165

166-
const { currLocation, viewIndex, sliderIndex, snapshots, hierarchy, webMetrics } =
167-
tabs[currentTab]; // we destructure the currentTab object
166+
console.log(tabs[currentTab]);
167+
168+
const { axSnapshots, currLocation, viewIndex, sliderIndex, snapshots, hierarchy, webMetrics } =
169+
tabs[currentTab]; // we destructure the currentTab object which is passed in from background.js
168170
//@ts-ignore
169171
const snapshotView = viewIndex === -1 ? snapshots[sliderIndex] : snapshots[viewIndex]; // if viewIndex is -1, then use the sliderIndex instead
170172

@@ -227,6 +229,7 @@ function MainContainer(): JSX.Element {
227229
snapshots={snapshots}
228230
// @ts-ignore
229231
currLocation={currLocation}
232+
axSnapshots={axSnapshots}
230233
/>
231234
</div>
232235
) : null}

src/app/containers/StateContainer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
1818
viewIndex, // from 'tabs[currentTab]' object in 'MainContainer'
1919
webMetrics, // from 'tabs[currentTab]' object in 'MainContainer'
2020
currLocation, // from 'tabs[currentTab]' object in 'MainContainer'
21+
axSnapshots,// from 'tabs[currentTab]' object in 'MainContainer'
2122
} = props;
2223

2324
return (
@@ -58,6 +59,7 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
5859
element={
5960
<div style={{ height: '100%' }}>
6061
<StateRoute
62+
axSnapshots={axSnapshots}
6163
webMetrics={webMetrics}
6264
viewIndex={viewIndex}
6365
snapshot={snapshot}

0 commit comments

Comments
 (0)