Skip to content

Commit 211132c

Browse files
committed
changes to diff test
1 parent dcdc565 commit 211132c

File tree

3 files changed

+20
-27
lines changed

3 files changed

+20
-27
lines changed

src/app/components/Chart.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import React, { Component } from 'react';
1515
import * as d3 from 'd3';
1616

17-
const colors = ['#2C4870','#519331','#AA5039','#8B2F5F','#C5B738','#858DFF', '#FF8D02','#FFCD51','#ACDAE6','#FC997E','#CF93AD','#AA3939','#AA6C39','#226666',]
17+
const colors = ['#2C4870', '#519331', '#AA5039', '#8B2F5F', '#C5B738', '#858DFF', '#FF8D02','#FFCD51','#ACDAE6','#FC997E','#CF93AD','#AA3939','#AA6C39','#226666',]
1818

1919
let root = {};
2020
class Chart extends Component {
@@ -174,7 +174,7 @@ class Chart extends Component {
174174

175175
chartContainer.call(d3.zoom()
176176
.extent([[0, 0], [width, height]])
177-
.scaleExtent([0, 8]) //scaleExtent([minimum scale factor, maximum scale factor])
177+
.scaleExtent([0, 8]) // scaleExtent([minimum scale factor, maximum scale factor])
178178
.on('zoom', zoomed));
179179

180180
function dragstarted() {

src/app/components/Diff.jsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,37 @@ import { useStoreContext } from '../store';
77

88
function Diff({ snapshot, show }) {
99
const [mainState] = useStoreContext();
10+
console.log('this is the mainState variable -->', mainState);
1011
const { currentTab, tabs } = mainState; // Nate:: k/v pairs of mainstate store object being created
12+
console.log('this is the currentTab variable -->', currentTab);
13+
console.log('this is the tabs variable -->', tabs);
1114
const { snapshots, viewIndex, sliderIndex } = tabs[currentTab];
1215
let previous;
1316

1417
// previous follows viewIndex or sliderIndex
15-
if (viewIndex !== -1) {
18+
if (viewIndex !== -1) { // if tab isnt selected, view index is set to -1
1619
previous = snapshots[viewIndex - 1];
20+
console.log('previous with viewIndex - 1: ', previous)
1721
} else {
1822
previous = snapshots[sliderIndex - 1];
23+
console.log('previous with sliderIndex - 1: ', previous)
1924
}
2025
// Nate:: diff function returns a comparaison of two objects, one has an updated change
21-
const delta = diff(previous, snapshot);
26+
const delta = diff(previous, snapshot); // initilly an array with one object, on state change becomes an object
27+
console.log('delta: ', delta);
2228
// returns html in string
2329
const html = formatters.html.format(delta, previous);
24-
if (show) formatters.html.showUnchanged();
25-
else formatters.html.hideUnchanged();
26-
30+
// console.log('html -->', html)
31+
if (show){
32+
console.log('showing unchanged values', formatters.html.showUnchanged() );
33+
formatters.html.showUnchanged();
34+
} else {
35+
console.log('hiding unchanged values', formatters.html.hideUnchanged() );
36+
formatters.html.hideUnchanged();
37+
};
38+
2739
if (previous === undefined || delta === undefined) {
40+
console.log('reacthtml parser -->', ReactHtmlParser(html), typeof ReactHtmlParser(html))
2841
return <div className='noState'> No state change detected. Trigger an event to change state </div>;
2942
}
3043
return <div>{ReactHtmlParser(html)}</div>;

src/extension/background.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,9 @@ chrome.runtime.onConnect.addListener(port => {
143143
// gabi :: reset snapshots to page last state recorded
144144
tabsObj[tabId].snapshots = [tabsObj[tabId].snapshots[tabsObj[tabId].snapshots.length - 1]];
145145
// gabi :: record hierarchy of page initial state
146-
<<<<<<< HEAD
147-
tabsObj[tabId].initialHierarchy = { ...tabsObj[tabId].hierarchy };
148-
tabsObj[tabId].initialHierarchy.children = [];
149-
=======
150146
// tabsObj[tabId].initialHierarchy = {...tabsObj[tabId].hierarchy};
151147
// tabsObj[tabId].initialHierarchy.children = [];
152148
tabsObj[tabId].initialHierarchy = {...tabsObj[tabId].hierarchy, children: []};
153-
>>>>>>> a2b5286dc42dfbdd12f5d26322b1ac238958ed05
154149
// gabi :: reset hierarchy
155150
tabsObj[tabId].hierarchy.children = [];
156151
// gabi :: reset hierarchy to page last state recorded
@@ -237,23 +232,12 @@ chrome.runtime.onMessage.addListener((request, sender) => {
237232
tabsObj[tabId].currParent = 0;
238233
}
239234
}
240-
<<<<<<< HEAD
241-
// gabi :: reset currLocation to page initial state
242-
tabsObj[tabId].currLocation = tabsObj[tabId].hierarchy;
243-
// gabi :: reset index
244-
tabsObj[tabId].index = 0;
245-
// gabi :: reset currParent plus current state
246-
tabsObj[tabId].currParent = 1;
247-
// gabi :: reset currBranch
248-
tabsObj[tabId].currBranch = 0;
249-
=======
250235
// gabi :: reset currLocation to page initial state
251236
tabsObj[tabId].currLocation = tabsObj[tabId].hierarchy;
252237
// gabi :: reset index
253238
tabsObj[tabId].index = 0;
254239
// gabi :: reset currBranch
255240
tabsObj[tabId].currBranch = 0;
256-
>>>>>>> a2b5286dc42dfbdd12f5d26322b1ac238958ed05
257241

258242
// send a message to devtools
259243
portsArr.forEach(bg =>
@@ -339,10 +323,6 @@ chrome.tabs.onRemoved.addListener(tabId => {
339323
// when tab is view change, put the tabid as the current tab
340324
chrome.tabs.onActivated.addListener(info => {
341325
// tell devtools which tab to be the current
342-
<<<<<<< HEAD
343-
console.log('this is info.tabId from chrome.tabs.onActivated.addListener', info);
344-
=======
345-
>>>>>>> a2b5286dc42dfbdd12f5d26322b1ac238958ed05
346326
if (portsArr.length > 0) {
347327
portsArr.forEach(bg =>
348328
bg.postMessage({

0 commit comments

Comments
 (0)