Skip to content

Commit 9647fe4

Browse files
authored
Merge pull request #36 from oslabs-beta/reactime7
Updated manifest and link fiber tests
2 parents 7dbd714 + a75e653 commit 9647fe4

File tree

11 files changed

+12
-32
lines changed

11 files changed

+12
-32
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"scripts": {
1616
"build": "webpack --mode production",
1717
"dev": "webpack --mode development --watch",
18-
"test": "jest --verbose --coverage --watchAll --forceExit",
18+
"test": "jest --verbose --coverage",
1919
"docker-test-lint": "eslint --ext .js --ext .jsx src",
2020
"docs": "typedoc --json docs --inputFiles src/app --inputFiles src/backend --readme docs/readme.md"
2121
},

src/app/components/BarGraph.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const tooltipStyles = {
5656
const BarGraph = (props) => {
5757
const [{ tabs, currentTab }, dispatch] = useStoreContext();
5858
const { width, height, data } = props;
59-
console.log('data: ', data)
6059
const {
6160
tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip,
6261
} = useTooltip<TooltipData>();
@@ -92,7 +91,6 @@ const BarGraph = (props) => {
9291
const yMax = height - margin.top - 150;
9392
snapshotIdScale.rangeRound([0, xMax]);
9493
renderingScale.range([yMax, 0]);
95-
console.log("renderingScale range: ", renderingScale.range([yMax, 0]))
9694
return (
9795
<div>
9896
<svg ref={containerRef} width={width} height={height}>
@@ -143,7 +141,6 @@ const BarGraph = (props) => {
143141
/* TIP TOOL EVENT HANDLERS */
144142
// Hides tool tip once cursor moves off the current rect
145143
onMouseLeave={() => {
146-
console.log('bar: ', bar)
147144
dispatch(onHoverExit(data.componentData[bar.key].rtid),
148145
tooltipTimeout = window.setTimeout(() => {
149146
hideTooltip()

src/app/components/ComponentMap.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ export default function ComponentMap({
5050
// This is where we select the last object in the snapshots array from props to allow hierarchy to parse the data for render on the component map per hierarchy layout specifications.
5151
const lastNode = snapshots.length - 1;
5252
const data: {} = snapshots[lastNode];
53+
5354
// importing custom hooks for the selection tabs.
5455
const [layout, setLayout] = useState('cartesian');
5556
const [orientation, setOrientation] = useState('horizontal');
5657
const [linkType, setLinkType] = useState('diagonal');
5758
const [stepPercent, setStepPercent] = useState(10);
59+
5860
// Declared this variable and assigned it to the useForceUpdate function that forces a state to change causing that component to re-render and display on the map
5961
const forceUpdate = useForceUpdate();
6062
// setting the margins for the Map to render in the tab window.
@@ -101,7 +103,6 @@ export default function ComponentMap({
101103
setStepPercent={setStepPercent}
102104
/>
103105

104-
105106
<svg width={totalWidth} height={totalHeight}>
106107
<LinearGradient id='links-gradient' from='#fd9b93' to='#fe6e9e' />
107108
<rect width={totalWidth} height={totalHeight} rx={14} fill='#242529'/>
@@ -125,7 +126,6 @@ export default function ComponentMap({
125126
))}
126127

127128
{tree.descendants().map((node, key) => {
128-
// const width = (node.data.name.length) + 70;
129129
const widthFunc = (name) => {
130130
let nodeLength = name.length;
131131
if (nodeLength < 5) return nodeLength + 40;
@@ -158,12 +158,11 @@ export default function ComponentMap({
158158
stroke="#ff6569"
159159
onClick={() => {
160160
node.data.isExpanded = !node.data.isExpanded;
161-
// console.log(node);
162161
forceUpdate();
163162
}}
164163
/>
165164
)}
166-
{/* This creates the rectangle boxes for each component and sets it relative position to other parent nodes of the same level. */}
165+
{/* This creates the rectangle boxes for each component and sets it relative position to other parent nodes of the same level.*/}
167166
{node.depth !== 0 && (
168167
<rect
169168
height={height}
@@ -174,7 +173,7 @@ export default function ComponentMap({
174173
stroke={node.children ? '#62d6fb' : '#161521'}
175174
strokeWidth={1}
176175
strokeDasharray={node.children ? '0' : '2,2'}
177-
strokeOpazcity='1'
176+
strokeOpacity='1'
178177
rx={node.children ? 4 : 10}
179178
onClick={() => {
180179
node.data.isExpanded = !node.data.isExpanded;

src/app/components/legend.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ type snapHierarchy = {};
1010
//type snapHierarchy = {`Record<string, unknown>`};
1111
export default function LegendKey(props: any) {
1212
const { hierarchy } = props;
13-
// console.log('this is the props' + JSON.stringify(Object.entries(props)))
14-
// console.log('this is the props.hierarchy' + JSON.stringify(Object.entries(props.hierarchy)))
1513
// we are sifting through array of displayNames and sorting them into key value pairs in an object, based on the branch they are on:
1614
// { '.0': [1.0, 2.0, 3.0, 4.0], '.1': [1.1, 2.1, 3.1,...], '.2': [....]}
1715
// then we create an array, with each index being strings showing the range of the branch, see below:

src/backend/__tests__/linkFiber.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,4 @@ xdescribe('unit test for linkFiber', () => {
105105
});
106106
});
107107

108-
109-
108+
SERVER.close();

src/backend/index.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ const mode: Mode = {
2525
jumping: false,
2626
paused: false,
2727
};
28-
// console.log("linkFiberStart in index.ts:" + linkFiberStart);
28+
2929
const linkFiber = linkFiberStart(snapShot, mode);
30-
// console.log('linkFiber in index.ts: ' + linkFiber);
3130
const timeJump = timeJumpStart(snapShot, mode);
3231

3332
// function getRouteURL(node: SnapshotNode): string {
@@ -44,7 +43,6 @@ const timeJump = timeJumpStart(snapShot, mode);
4443

4544
// * Event listener for time-travel actions
4645
window.addEventListener('message', ({ data: { action, payload } }: MsgData) => {
47-
// console.log('linkFiber in index.ts: ' + linkFiber);
4846
switch (action) {
4947
case 'jumpToSnap':
5048
timeJump(payload, true); // * This sets state with given payload
@@ -57,21 +55,16 @@ window.addEventListener('message', ({ data: { action, payload } }: MsgData) => {
5755
mode.paused = payload;
5856
break;
5957
case 'onHover':
60-
// console.log("curr payload ", payload);
6158
if (Array.isArray(payload)) {
62-
// console.log('inside array is array if block')
6359
for (let i = 0; i < payload.length; i + 1) {
64-
// console.log("current payload value: ", payload[i]);
6560
let element = document.getElementById(payload[i])
6661
if (element !== null) {
6762
element.style.backgroundColor = '#C0D9D9';
6863
}
6964
}
7065
} else {
7166
let element: HTMLElement = document.querySelector(`.${payload}`);
72-
// console.log("element: ", element);
7367
if (element !== null) {
74-
// console.log("element style: ", element.style)
7568
element.style.backgroundColor = '#C0D9D9';
7669
}
7770
}
@@ -86,7 +79,6 @@ window.addEventListener('message', ({ data: { action, payload } }: MsgData) => {
8679
}
8780
} else {
8881
let element: HTMLElement = document.querySelector(`.${payload}`);
89-
// console.log("element style: ", element.style)
9082
if (element !== null) {
9183
element.style.backgroundColor = '';
9284
}

src/backend/linkFiber.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ function createTree(
313313
// We then store them along with the corresponding memoizedState.queue,
314314
// which includes the dispatch() function we use to change their state.
315315
const hooksStates = traverseRecoilHooks(memoizedState, memoizedProps);
316-
// console.log("hookStates: ", hooksStates);
317316
hooksStates.forEach((state, i) => {
318317
hooksIndex = componentActionsRecord.saveNew(
319318
state.state,
@@ -326,8 +325,7 @@ function createTree(
326325

327326
// }
328327
// newState.push(state.state);
329-
// console.log('newState in Recoil: ', newState);
330-
// console.log('state.state: ', state.state);
328+
331329
/* what is this supposed to do??? currently doesn't work?? and makes no sense, newState is an object, how can you push state.state into an object?? */
332330
// if (newState && newState.hooksState) {
333331
// newState.push(state.state);
@@ -416,7 +414,6 @@ function createTree(
416414
// remove existing rtid before adding a new one
417415
if (pointer.stateNode.classList.length > 0) {
418416
let lastClass = pointer.stateNode.classList[pointer.stateNode.classList.length -1];
419-
// console.log("last class: ", lastClass, "linkFiber class? ", lastClass.includes("fromLinkFiber"));
420417
if (lastClass.includes("fromLinkFiber")) {
421418
pointer.stateNode.classList.remove(lastClass);
422419
}
@@ -434,7 +431,6 @@ function createTree(
434431
// remove existing rtid before adding a new one
435432
if (currentFiber.child.stateNode.classList.length > 0) {
436433
let lastClass = currentFiber.child.stateNode.classList[currentFiber.child.stateNode.classList.length -1];
437-
// console.log("lastClass: ", lastClass, "linkFiber class? ", lastClass.includes("fromLinkFiber"));
438434
if (lastClass.includes("fromLinkFiber")) {
439435
currentFiber.child.stateNode.classList.remove(lastClass);
440436
}

src/backend/timeJump.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export default (origin, mode) => {
2626
// Set the state of the origin tree if the component is stateful
2727
function jump(target, firstCall = false) {
2828
if (!target) return;
29-
//console.log("target in jump: ", target)
3029
if (target.state === 'stateless') {
3130
target.children.forEach(child => jump(child));
3231
return;
@@ -35,7 +34,6 @@ export default (origin, mode) => {
3534
const component = componentActionsRecord.getComponentByIndex(
3635
target.componentData.index,
3736
);
38-
// console.log("component in time jump: ", component)
3937
// check if it is a stateful class component
4038
// if yes, find the component by its index and assign it to a variable
4139
// call that components setState method to reset state to the state at the time of the jump snapshot

src/extension/background.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ chrome.runtime.onMessage.addListener((request, sender) => {
185185
const { action, index, name } = request;
186186
let isReactTimeTravel = false;
187187

188+
188189
// Filter out tabs that don't have reactime, tabs that dont use react?
189190
if (
190191
action === 'tabReload' ||

src/extension/build/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"icons": { "48": "assets/icon48.png", "128": "assets/icon128.png" },
1313
"content_scripts": [
1414
{
15-
"matches": ["<all_urls>"],
15+
"matches": ["http://localhost/*", "https://localhost/*"],
1616
"js": ["bundles/content.bundle.js"]
1717
}
1818
],
1919
"web_accessible_resources" : ["bundles/backend.bundle.js"],
20-
"permissions": ["contextMenus", "tabs", "activeTab", "<all_urls>"]
20+
"permissions": ["contextMenus", "tabs", "activeTab", "http://localhost/*", "https://localhost/*"]
2121

2222
}

0 commit comments

Comments
 (0)