Skip to content

Commit a20b4e4

Browse files
committed
started on diff
1 parent 927aa82 commit a20b4e4

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

demo-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"copy-webpack-plugin": "^10.2.0",
2020
"css-loader": "^6.5.1",
2121
"html-webpack-plugin": "^5.5.0",
22+
"node": "^16.0.0",
2223
"nodemon": "^2.0.15",
2324
"ts-loader": "^9.2.6",
2425
"typescript": "^4.5.4",

src/app/components/DiffRoute/Diff.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { diff, formatters } from 'jsondiffpatch';
3-
const jsondiffpatch = require('jsondiffpatch');
3+
// const jsondiffpatch = require('jsondiffpatch');
44
import ReactHtmlParser from 'html-react-parser';
55
import {
66
CurrentTab,
@@ -91,11 +91,11 @@ function Diff(props: DiffProps): JSX.Element {
9191

9292
const delta = diff(previousDisplay, snapshot); // diff function from 'jsondiffpatch' returns the difference in state between 'previousDisplay' and 'snapshot'
9393

94-
const html = jsondiffpatch.formatters.format(delta, previousDisplay); // formatters function from 'jsondiffpatch' returns an html string that shows the difference between delta and the previousDisplay
94+
const html = formatters.format(delta, previousDisplay); // formatters function from 'jsondiffpatch' returns an html string that shows the difference between delta and the previousDisplay
9595

9696
if (show)
97-
jsondiffpatch.formatters.showUnchanged(); // shows unchanged values if we're on the '/diffRaw' path
98-
else jsondiffpatch.formatters.hideUnchanged(); // hides unchanged values
97+
formatters.showUnchanged(); // shows unchanged values if we're on the '/diffRaw' path
98+
else formatters.hideUnchanged(); // hides unchanged values
9999

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

src/app/components/DiffRoute/DiffRoute.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import { DiffRouteProps } from '../../FrontendTypes';
1111
const DiffRoute = (props: DiffRouteProps): JSX.Element => (
1212
<div className='diff-container'>
1313
<div className='navbar'>
14-
<NavLink className='router-link' to='/'>
14+
<NavLink className='router-link' to='/diff'>
1515
Tree
1616
</NavLink>
17-
<NavLink className='router-link' to='/diffRaw'>
17+
<NavLink className='router-link' to='/diff/diffRaw'>
1818
Raw
1919
</NavLink>
2020
</div>
2121
<Routes>
22-
<Route path='/diffRaw' element={<Diff snapshot={props.snapshot} show />} />
23-
<Route path='/' element={<Diff snapshot={props.snapshot} show={false} />} />
22+
<Route path='/diff/diffRaw' element={<Diff snapshot={props.snapshot} show />} />
23+
<Route path='/diff' element={<Diff snapshot={props.snapshot} show={false} />} />
2424
</Routes>
2525
</div>
2626
);

src/app/containers/StateContainer.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React, { useState } from 'react';
55
*/
66
import { MemoryRouter as Router, Route, NavLink, Routes, Outlet } from 'react-router-dom';
77
import StateRoute from '../components/StateRoute/StateRoute';
8-
// import DiffRoute from '../components/DiffRoute/DiffRoute';
8+
import DiffRoute from '../components/DiffRoute/DiffRoute';
99
import { StateContainerProps } from '../FrontendTypes';
1010
import { Outlet } from 'react-router';
1111

@@ -22,7 +22,7 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
2222

2323
return (
2424
<div className='state-container'>
25-
{/* <div className='main-navbar-container'>
25+
<div className='main-navbar-container'>
2626
<div className='main-navbar-text' />
2727
<div className='main-navbar'>
2828
<NavLink className='main-router-link' to='/'>
@@ -37,25 +37,24 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
3737
<Route path='/diff/*' element={
3838
<div>
3939
<DiffRoute snapshot={snapshot} />
40-
<Outlet/>
40+
{/* <Outlet/> */}
4141
</div>} />
4242
<Route
43-
path='*'
43+
path='/*'
4444
element={
45-
<div>*/}
46-
<StateRoute
47-
webMetrics={webMetrics}
48-
viewIndex={viewIndex}
49-
snapshot={snapshot}
50-
hierarchy={hierarchy}
51-
snapshots={snapshots}
52-
currLocation={currLocation}
53-
/>
54-
{/* <Outlet/> */}
55-
{/*</div>
56-
}
57-
/>
58-
</Routes> */}
45+
<div height="100%">
46+
<StateRoute
47+
webMetrics={webMetrics}
48+
viewIndex={viewIndex}
49+
snapshot={snapshot}
50+
hierarchy={hierarchy}
51+
snapshots={snapshots}
52+
currLocation={currLocation}
53+
/>
54+
{/* <Outlet/> */}
55+
</div>}
56+
/>
57+
</Routes>
5958
</div>
6059
);
6160
};

0 commit comments

Comments
 (0)