Skip to content

Commit 78a4423

Browse files
authored
Merge pull request #18 from oslabs-beta/tidyUp
Tidy up
2 parents d01499c + 58ba114 commit 78a4423

18 files changed

+19
-171
lines changed

src/app/components/BarGraphComparisonTEST.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ const BarGraphComparison = props => {
332332
// height/width/etc. are calculated by visx.
333333
// to set X and Y scale, it will used the passed in function and
334334
// will run it on the array thats outputted by data
335-
// console.log("barStack.bars:",barStack.bars)
336-
const bar = barStack.bars[currentIndex];
335+
const bar = barStack.bars[currentIndex]
337336
if (Number.isNaN(bar.bar[1]) || bar.height < 0) {
338337
bar.height = 0;
339338
}

src/app/components/ComponentMap.tsx

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -167,55 +167,13 @@ export default function ComponentMap({
167167
// nestedObj = nestedObj.forEach(e => makePropsPretty(e));
168168
// }
169169
// } catch (error) {
170-
// console.log('not a react componenet');
171170
// }
172171
// }
173172
// }
174-
// const makePropsPretty = data => {
175-
// const propsFormat = [];
176-
// let nestedObj;
177-
// for (const key in data) {
178-
// if (data[key] !== 'reactFiber' && typeof data[key] !== 'object' && exclude.includes(key) !== true) {
179-
// propsFormat.push(<p className="stateprops">
180-
// {`${key}: ${nestedObj || data[key]}`}
181-
// </p>);
182-
// } else if (typeof data[key] === 'object' && exclude.includes(key) !== true) {
183-
// nestedObj = makePropsPretty(data[key]);
184-
// try {
185-
// if (nestedObj[0].$$typeof) {
186-
// // nestedObj = nestedObj.forEach(e => makePropsPretty(e.props.children));
187-
// nestedObj = nestedObj.forEach(e => {
188-
// console.log('this is e show the object', e);
189-
// if (typeof e.props.children === 'object') {
190-
// console.log('nested obj show me ', typeof e.props.children, e.props.children);
191-
// return e.props.children;
192-
// }
193-
// console.log('not an object in nestedobj', typeof e.props.children, e.props.children);
194-
// return e.props.children;
195-
// });
196-
// console.log('show me show show show show show show show', nestedObj);
197-
// // console.log('show me the nestedobj after the react thing', nestedObj)
198-
// } else {
199-
// nestedObj = nestedObj.forEach(e =>{
200-
// console.log('this is not a react thing so show me', e)
201-
// makePropsPretty(e)
202-
// });
203-
// }
204-
// } catch (error) {
205-
// console.log(error);
206-
// }
207-
// }
208-
// if (nestedObj) {
209-
// propsFormat.push(nestedObj);
210-
// }
211-
// }
212-
// return propsFormat;
213-
// };
214173

215174
const makePropsPretty = data => {
216175
const propsFormat = [];
217176
const nestedObj = [];
218-
// console.log('show me the data we are getting', data);
219177
for (const key in data) {
220178
if (data[key] !== 'reactFiber' && typeof data[key] !== 'object' && exclude.includes(key) !== true) {
221179
propsFormat.push(<p className="stateprops">
@@ -235,7 +193,6 @@ export default function ComponentMap({
235193

236194
const collectNodes = node => {
237195
nodeList.splice(0, nodeList.length);
238-
// console.log('Root node:', node);
239196
nodeList.push(node);
240197
for (let i = 0; i < nodeList.length; i++) {
241198
const cur = nodeList[i];
@@ -245,14 +202,12 @@ export default function ComponentMap({
245202
}
246203
}
247204
}
248-
// console.log('NODELIST in ComponentMap: ', nodeList);
249205
};
250206
collectNodes(snapshots[lastNode]);
251207

252208
// find the node that has been selected and use it as the root
253209
const startNode = null;
254210
const findSelectedNode = () => {
255-
// console.log(selectedNode);
256211
for (const node of nodeList) {
257212
if (node.name === selectedNode) {
258213
startNode = node;
@@ -283,7 +238,6 @@ export default function ComponentMap({
283238
<LinearGradient id="links-gradient" from="#fd9b93" to="#fe6e9e" />
284239
<rect width={totalWidth} height={totalHeight} rx={14} fill="#242529" />
285240
<Group top={margin.top} left={margin.left}>
286-
{console.log('This is the SelectedNode:', selectedNode)}
287241
<Tree
288242
root={hierarchy(startNode || data, d => (d.isExpanded ? null : d.children))}
289243
size={[sizeWidth, sizeHeight]}
@@ -329,16 +283,11 @@ export default function ComponentMap({
329283
// mousing controls & Tooltip display logic
330284
const handleMouseAndClickOver = event => {
331285
() => dispatch(onHover(node.data.rtid));
332-
console.log('line 197 event.target', event.target.ownerSVGElement);
333-
console.log('line 199 This is DATA: ', data);
334-
console.log('line 200 This is TREE: ', tree);
335-
console.log('line 201 This is NODE: ', node);
336286
const coords = localPoint(
337287
event.target.ownerSVGElement,
338288
event,
339289
);
340290
const tooltipObj = { ...node.data };
341-
console.log('NODE DATAAAAAAAAAAAAA', node);
342291
if (typeof tooltipObj.state === 'object') tooltipObj.state = 'stateful';
343292
showTooltip({
344293
tooltipLeft: coords.x,
@@ -371,8 +320,8 @@ export default function ComponentMap({
371320
fill={node.children ? '#161521' : '#62d6fb'}
372321
// node.data.isExpanded = if node is collapsed
373322
// stroke={(node.data.isExpanded && node.child) ? '#95fb62' : '#a69ff5'} => node.child is gone when clicked, even if it actually has children. Maybe better call node.children => node.leaf
374-
stroke={(node.data.isExpanded && node.data.children.length > 0) ? '#ff6569' : 'none'}
375-
strokeWidth={3}
323+
stroke={(node.data.isExpanded && node.data.children.length > 0) ? '#ff6569' : '#4D4D4D'}
324+
strokeWidth={1.5}
376325
// strokeDasharray={node.children ? '0' : '2,2'}
377326
strokeOpacity="1"
378327
rx={node.children ? 4 : 10}

src/app/components/History.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ function History(props: Record<string, unknown>) {
5151
}
5252
let found;
5353
if (!d3root.children) {
54-
console.log('DEBUG >>> no child: ', d3root);
5554
return found;
5655
}
5756
d3root.children.forEach(child => {
5857
if (!found) {
59-
console.log('DEBUG >>> child: ', child);
6058
found = labelCurrentNode(child);
6159
}
6260
});
@@ -75,14 +73,10 @@ function History(props: Record<string, unknown>) {
7573
};
7674
// const hierarchy = d3.hierarchy(root);
7775
const d3root = tree(root);
78-
console.log('DEBUG >>> d3root: ', d3root);
7976

8077
const currNode = labelCurrentNode(d3root);
81-
console.log('DEBUG >>> currNode: ', currNode);
8278

8379
const g = svg.append('g')
84-
// .attr("font-family", "sans-serif")
85-
// .attr("font-size", 10)
8680
.attr('transform', `translate(${margin.left},${d3root.height === 0 ? (totalHeight / 2) : margin.top})`);
8781

8882
const link = g.selectAll('.link')

src/app/components/LinkControls.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ type Props = {
3737
const nodeList = [];
3838

3939
const collectNodes = (node) => {
40-
// console.log("This is the root node", node);
41-
// console.log('this is nodelist', nodeList)
4240
nodeList.splice(0, nodeList.length); { /* We used the .splice method here to ensure that nodeList did not accumulate with page refreshes */ }
4341
nodeList.push(node);
4442
for (let i = 0; i < nodeList.length; i++) {
@@ -49,7 +47,6 @@ const collectNodes = (node) => {
4947
}
5048
}
5149
}
52-
// console.log('NODELIST looks like: ', nodeList);
5350
}
5451

5552
export default function LinkControls({
@@ -65,7 +62,6 @@ export default function LinkControls({
6562
setSelectedNode,
6663
snapShots,
6764
}: Props) {
68-
// console.log('this is line 64', snapShots)
6965
collectNodes(snapShots);
7066

7167
return (
@@ -106,7 +102,6 @@ export default function LinkControls({
106102
<select
107103
onClick={e => e.stopPropagation()}
108104
onChange={e => setLinkType(e.target.value)}
109-
// value={linkType}
110105
style={dropDownStyle}
111106
>
112107
<option value="diagonal">Diagonal</option>

src/app/components/MainSlider.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ function MainSlider(props: MainSliderProps) {
4141
const { currLocation } = tabs[currentTab];
4242
const [sliderIndex, setSliderIndex] = useState(0);
4343

44-
console.log('DEBUG >>> slider: ', currLocation);
45-
4644
useEffect(() => {
4745
setSliderIndex(currLocation.index);
4846
}, [currLocation])
@@ -56,7 +54,6 @@ function MainSlider(props: MainSliderProps) {
5654
setSliderIndex(index);
5755
}}
5856
onAfterChange={() => {
59-
console.log("DEBUG >>> sliderIndex: ", sliderIndex);
6057
dispatch(changeSlider(sliderIndex));
6158
dispatch(pause());
6259
}}

src/app/components/PerformanceVisx.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ const collectNodes = (snaps, componentName) => {
121121
finalResults[i][componentSnapshot] = makePropsPretty(finalResults[i][componentSnapshot]).reverse();
122122
}
123123
}
124-
console.log('is this going to reverse', finalResults);
125124
return finalResults;
126125
};
127126

@@ -178,13 +177,12 @@ const allStorage = () => {
178177
const values = [];
179178
const keys = Object.keys(localStorage);
180179
let i = keys.length;
181-
// console.log('allstorage keys', keys);
180+
182181

183182
while (i--) {
184183
const series = localStorage.getItem(keys[i]);
185184
values.push(JSON.parse(series));
186185
}
187-
// console.log('allstorage values', values);
188186
return values;
189187
};
190188

@@ -206,7 +204,6 @@ const getPerfMetrics = (snapshots, snapshotsIds): {} => {
206204
componentData: {},
207205
maxTotalRender: 0,
208206
};
209-
// console.log('show me all of the snapshots', snapshots);
210207
snapshots.forEach((snapshot, i) => {
211208
perfData.barStack.push({ snapshotId: snapshotsIds[i] });
212209
traverse(snapshot, perfData, snapshots);
@@ -247,9 +244,7 @@ const PerformanceVisx = (props: BarStackProps) => {
247244
};
248245

249246
const renderComponentDetailsView = () => {
250-
// console.log('this is the info for rendering frequency', data.componentData);
251247
if (hierarchy) {
252-
// console.log('this is line 246', data.comparisonData);
253248
return <RenderingFrequency data={data.componentData} />;
254249
}
255250
return <div className="noState">{NO_STATE_MSG}</div>;

src/app/components/RenderingFrequency.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ const ComponentCard = props => {
4242
const [{ tabs, currentTab }, dispatch] = useStoreContext();
4343
const [expand, setExpand] = useState(false);
4444

45-
// const onMouseMove = () => {
46-
// console.log(rtid);
47-
// dispatch(onHover(rtid));
48-
// };
49-
// const onMouseLeave = () => {
50-
// console.log(rtid);
51-
// dispatch(onHoverExit(rtid));
52-
// };
53-
5445
// render time for each component from each snapshot
5546
// differences in state change that happened prior;
5647

@@ -98,23 +89,12 @@ const ComponentCard = props => {
9889
);
9990
};
10091

101-
// const dataComponentContainer = (
102-
// <div>
103-
// {dataComponentArray.}
104-
// </div>
105-
// );
106-
10792
const DataComponent = props => {
10893
const {
10994
header,
11095
paragraphs,
11196
} = props;
11297

113-
// current bug
114-
// we want render time to display first but it gets push to the end of the array
115-
// first pop is because the last item of array is always empty for some reason
116-
117-
// const [{ tabs, currentTab }, dispatch] = useStoreContext();
11898
return (
11999
<div className="borderCheck">
120100
<h4>

src/app/components/StateRoute.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export interface StateRouteProps {
4646
}
4747

4848
const StateRoute = (props: StateRouteProps) => {
49-
console.log(`DEBUG >>> State props: ${props}`);
5049
const { snapshot, hierarchy, snapshots, viewIndex, webMetrics, currLocation } = props;
5150
const [{ tabs, currentTab }, dispatch] = useStoreContext();
5251
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];

src/app/containers/ActionContainer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function ActionContainer(props) {
154154
}
155155
// Sort by index.
156156
hierarchyArr.sort((a, b) => a.index - b.index);
157-
// console.log('DEBUG >>> hierarchyArr: ', hierarchyArr);
157+
158158
actionsArr = hierarchyArr.map(
159159
(
160160
snapshot: {
@@ -189,7 +189,6 @@ function ActionContainer(props) {
189189
);
190190
},
191191
);
192-
// console.log('DEBUG >>> actionsArr: ', actionsArr);
193192
useEffect(() => {
194193
setActionView(true);
195194
}, [setActionView]);

src/app/containers/MainContainer.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ function MainContainer(): any {
3535
if (currentPort) return;
3636
// open long-lived connection with background script
3737
const port = chrome.runtime.connect();
38-
console.log('THIS IS THE PORT LINE 37', port);
3938

4039
// listen for a message containing snapshots from the background script
4140
port.onMessage.addListener(
@@ -45,7 +44,6 @@ function MainContainer(): any {
4544
sourceTab: number;
4645
}) => {
4746
const { action, payload, sourceTab } = message;
48-
console.log("DEBUG >>> message: ", message);
4947
let maxTab;
5048
if (!sourceTab) {
5149
const tabsArray: any = Object.keys(payload);
@@ -64,13 +62,11 @@ function MainContainer(): any {
6462
dispatch(setTab(sourceTab));
6563
// set state with the information received from the background script
6664
dispatch(addNewSnapshots(payload));
67-
console.log('this is the payload and this is the sendSnapshorts', sourceTab, payload);
6865
break;
6966
}
7067
case 'initialConnectSnapshots': {
7168
dispatch(setTab(maxTab));
7269
dispatch(initialConnect(payload));
73-
console.log('this is the initial connect and settab', maxTab, payload);
7470
break;
7571
}
7672
case 'setCurrentLocation': {
@@ -149,7 +145,6 @@ function MainContainer(): any {
149145
</div>
150146
);
151147
}
152-
console.log('DEBUG >>> main: ', tabs[currentTab]);
153148
const {
154149
currLocation, viewIndex, sliderIndex, snapshots, hierarchy, webMetrics,
155150
} = tabs[currentTab];

0 commit comments

Comments
 (0)