Skip to content

Commit a27790c

Browse files
committed
merge dependencies branch with errors branch
2 parents bfba638 + b40c053 commit a27790c

23 files changed

+691
-89
lines changed

src/app/FrontendTypes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,7 @@ export interface Snapshots {
379379
component3: number;
380380
'all others': number;
381381
}
382+
383+
export interface ErrorContainerProps {
384+
port: chrome.runtime.Port | null;
385+
}

src/app/components/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function App(): JSX.Element {
1515
<ThemeProvider theme={theme}>
1616
<Router>
1717
{/* we wrap our application with the <Router> tag so that all components that are nested will have the react-router context */}
18+
{console.log('App reloaded', new Date().toLocaleString())}
1819
<MainContainer />
1920
</Router>
2021
</ThemeProvider>

src/app/components/Diff.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
// return newObj; // return the cleaned state snapshot(s)
8181
// };
8282

83+
<<<<<<< HEAD
8384
// const previousDisplay: StatelessCleaning = statelessCleaning(previous); // displays stateful data from the first snapshot that was taken before our current snapshot.
8485

8586
// const delta: StatelessCleaning = diff(previousDisplay, snapshot); // diff function from 'jsondiffpatch' returns the difference in state between 'previousDisplay' and 'snapshot'
@@ -89,6 +90,24 @@
8990
// if (show)
9091
// formatters.html.showUnchanged(); // shows unchanged values if we're on the '/diffRaw' path
9192
// else formatters.html.hideUnchanged(); // hides unchanged values
93+
=======
94+
// console.log('previousDisplay before stateless cleaning: ', previous);
95+
const previousDisplay: StatelessCleaning = statelessCleaning(previous); // displays stateful data from the first snapshot that was taken before our current snapshot.
96+
97+
// console.log('previousDisplay after stateless cleaning: ', previousDisplay);
98+
const delta: StatelessCleaning = diff(previousDisplay, snapshot); // diff function from 'jsondiffpatch' returns the difference in state between 'previousDisplay' and 'snapshot'
99+
100+
// console.log('delta: ', delta);
101+
const html: StatelessCleaning = formatters.html.format(delta, previousDisplay); // formatters function from 'jsondiffpatch' returns an html string that shows the difference between delta and the previousDisplay
102+
103+
// console.log('html: ', html);
104+
105+
console.log(show);
106+
console.log(formatters.html.showUnchanged());
107+
if (show)
108+
formatters.html.showUnchanged(); // shows unchanged values if we're on the '/diffRaw' path
109+
else formatters.html.hideUnchanged(); // hides unchanged values
110+
>>>>>>> errors
92111

93112
// if (previous === undefined || delta === undefined) {
94113
// // if there has been no state changes on the target/hooked application, previous and delta would be undefined.

src/app/components/DiffRoute.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// Loads the appropriate DiffRoute view and renders the 'Tree' and 'Raw' navbar buttons after clicking on the 'Diff' button located near the top rightmost corner.
88
// */
99

10+
<<<<<<< HEAD
1011
// // 'DiffRoute' only passed in prop is 'snapshot' from 'tabs[currentTab]' object in 'MainContainer'
1112
// const DiffRoute = (props: DiffRouteProps): JSX.Element => (
1213
// <Router>
@@ -24,5 +25,24 @@
2425
// </Routes>
2526
// </Router>
2627
// );
28+
=======
29+
// 'DiffRoute' only passed in prop is 'snapshot' from 'tabs[currentTab]' object in 'MainContainer'
30+
const DiffRoute = (props: DiffRouteProps): JSX.Element => (
31+
<Router>
32+
<div className='navbar'>
33+
<NavLink className='router-link' activeClassName='is-active' exact to='/'>
34+
Tree
35+
</NavLink>
36+
<NavLink className='router-link' activeClassName='is-active' to='/diffRaw'>
37+
Raw
38+
</NavLink>
39+
</div>
40+
<Switch>
41+
<Route path='/diffRaw' render={() => <Diff snapshot={props.snapshot} />} />
42+
<Route path='/' render={() => <Diff snapshot={props.snapshot} show={false} />} />
43+
</Switch>
44+
</Router>
45+
);
46+
>>>>>>> errors
2747

2848
// export default DiffRoute;

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ export default function ComponentMap({
127127
};
128128

129129
const formatRenderTime: string = (time: number): string => {
130+
<<<<<<< HEAD
130131
const renderTime = parseFloat(time).toFixed(3);
132+
=======
133+
if (!time) return 'No time information';
134+
const renderTime = time.toFixed(3);
135+
>>>>>>> errors
131136
return `${renderTime} ms `;
132137
};
133138

src/app/components/StateRoute/History.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function History(props: Record<string, unknown>): JSX.Element {
4242

4343
const svgRef = React.useRef(null);
4444
const root = JSON.parse(JSON.stringify(hierarchy)); // why do we stringify and then parse our hierarchy back to JSON? (asked 7/31/23)
45-
45+
console.log('history root: ', root);
4646
// setting the margins for the Map to render in the tab window.
4747
const innerWidth: number = totalWidth - margin.left - margin.right;
4848
const innerHeight: number = totalHeight - margin.top - margin.bottom - 60;
@@ -171,14 +171,15 @@ function History(props: Record<string, unknown>): JSX.Element {
171171
const makeD3Tree = () => {
172172
const svg = d3.select(svgRef.current); // d3.select Selects the first element/node that matches svgRef.current. If no element/node match returns an empty selection. If multiple elements/nodes match the selector, only the first matching element/node (in document order) will be selected.
173173
svg.selectAll('*').remove(); // Selects all elements. The elements will be selected in document order (top-to-bottom). We then remove the selected elements/nodes from the DOM. This is important as to ensure that the SVG is empty before rendering the D3 based visualization to avoid interference/overlap with any previously rendered content.
174-
174+
console.log('makeD3Tree initial svgRef: ', svgRef);
175175
const tree = (data) => {
176176
// function that takes in data and turns it into a d3 tree.
177177
const treeRoot = d3.hierarchy(data); // 'd3.hierarchy' constructs a root node from the specified hierarchical data.
178178
return d3.tree().size([innerWidth, innerHeight])(treeRoot); // d3.tree creates a new tree layout with a size option of innerWidth (~line 41) and innerHeight (~line 42). We specify our new tree layout's root as 'treeRoot' which assigns an x and y property to each node to represent an [x, y] coordinate system.
179179
};
180180

181181
const d3root = tree(root); // create a d3. tree from our root
182+
console.log('d3root: ', d3root);
182183
const currNode = labelCurrentNode(d3root); // iterate through our nodes and apply a color property
183184

184185
const g = svg //serves as a container for the nodes and links within the D3 Visualization of the tree
@@ -310,12 +311,13 @@ function History(props: Record<string, unknown>): JSX.Element {
310311
};
311312

312313
useEffect(() => {
314+
console.log('currLocation: ', currLocation);
313315
makeD3Tree();
314-
}, [root, currLocation]); // if the 'root' or 'currLocation' changes, re-build the D3 Tree
316+
}, [root /*, currLocation*/]); // if the 'root' or 'currLocation' changes, re-build the D3 Tree
315317

316-
useEffect(() => {
317-
dispatch(setCurrentTabInApp('history')); // dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'webmetrics' to facilitate render.
318-
}, []);
318+
// useEffect(() => {
319+
// dispatch(setCurrentTabInApp('history')); // dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'webmetrics' to facilitate render.
320+
// }, []);
319321

320322
// then rendering each node in History tab to render using D3, which will share area with LegendKey
321323
return (

src/app/components/StateRoute/StateRoute.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ const StateRoute = (props: StateRouteProps) => {
3232
webMetrics, // from 'tabs[currentTab]' object in 'MainContainer'
3333
currLocation, // from 'tabs[currentTab]' object in 'MainContainer'
3434
} = props;
35-
35+
console.log('snapshot from StateRoute props: ', snapshot);
36+
console.log('snapshots from StateRoute props: ', snapshots);
37+
console.log('currLocation from StateRoute props', currLocation);
3638
const { tabs, currentTab }: MainState = useSelector((state: RootState) => state.main);
3739
const { hierarchy: tabsHierarchy, sliderIndex, viewIndex: tabsViewIndex } = tabs[currentTab];
3840
const hierarchy = propsHierarchy || tabsHierarchy; //JR: RETURN TO THIS: alias to deconstruct from props and tab with the same name, aliases were deleted above

src/app/components/SwitchApp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { setTab } from '../slices/mainSlice';
44
//importing these methods for RTK
55
import { useSelector, useDispatch } from 'react-redux';
66
import { MainState, RootState } from '../FrontendTypes';
7+
import { current } from '@reduxjs/toolkit';
78

89
/*
910
This is the dropdown menu on the left column above the 'clear' button and the state snapshots list. It allows us to switch between which website/application we are currently working on.
@@ -17,7 +18,7 @@ const SwitchAppDropdown = (): JSX.Element => {
1718
const { currentTab, tabs }: MainState = useSelector((state: RootState) => state.main);
1819

1920
const tabsArray: {}[] = []; // tabsArray is an empty array that will take objects as it's elements
20-
21+
console.log('switchAppDropdown; currentTab: ', currentTab, 'tabs: ', tabs);
2122
Object.keys(tabs).forEach((tab) => {
2223
// We populate our 'tabsArray' with objects derived from the 'tab' that is currently being iterated on.
2324
tabsArray.unshift({ value: tab, label: tabs[tab].title });

src/app/components/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createTheme } from '@mui/material/styles';
22
const theme = createTheme({
33
palette: {
44
primary: {
5-
main: '#8Fb5f9',
5+
main: '#b2f7a1',
66
},
77
secondary: {
88
main: '#BF6DD2',

src/app/containers/ActionContainer.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
146146
);
147147
},
148148
);
149-
useEffect(() => {
150-
setActionView(true);
151-
}, [setActionView]);
149+
150+
// JR: this is questionable, why would you always set it to true?
151+
// useEffect(() => {
152+
// setActionView(true);
153+
// }, [setActionView]);
152154

153155
// Function sends message to background.js which sends message to the content script
154156
const toggleRecord = (): void => {
@@ -181,13 +183,25 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
181183
<div className='actionToolContainer'>
182184
<div id='arrow'>
183185
<aside className='aside'>
184-
<a onClick={toggleActionContainer} className='toggle'>
186+
<a
187+
onClick={(e) => {
188+
e.stopPropagation;
189+
toggleActionContainer();
190+
}}
191+
className='toggle'
192+
>
193+
{' '}
194+
{/* JR: updating onClick to stop propagation so that it detects the click only on the arrow and not the parent*/}
185195
<i />
186196
</a>
187197
</aside>
198+
<div className='collapse'>Collapse</div>
188199
</div>
189200
<a type='button' id='recordBtn' onClick={toggleRecord}>
190201
<i />
202+
<div style={{ display: 'flex', alignItems: 'center', textAlign: 'right' }}>
203+
Toggle Record
204+
</div>
191205
{recordingActions ? <Switch defaultChecked /> : <Switch />}
192206
</a>
193207
</div>

0 commit comments

Comments
 (0)