Skip to content

Commit 2eb7b73

Browse files
committed
resolve merge
2 parents 235c707 + ed65fc7 commit 2eb7b73

File tree

15 files changed

+515
-564
lines changed

15 files changed

+515
-564
lines changed

src/app/components/BarGraph.tsx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale';
99
import { useTooltip, useTooltipInPortal, defaultStyles } from '@visx/tooltip';
1010
import { Text } from '@visx/text';
1111
import { schemeSet3 } from 'd3-scale-chromatic';
12-
import snapshots from './snapshots';
1312
import { onHover, onHoverExit } from '../actions/actions';
1413
import { useStoreContext } from '../store';
1514
import { save } from '../actions/actions';
@@ -124,17 +123,15 @@ const BarGraph = (props) => {
124123
classname[i].addEventListener('click', animateButton, false);
125124
}
126125
return (
127-
<div className="bargraph">
128-
<div className="series-options-container">
129-
<button
130-
className='save-series-button'
131-
onClick={(e) => {
132-
dispatch(save(toStorage));
133-
}}
134-
>
135-
Save Series
136-
</button>
137-
</div>
126+
<div>
127+
<button
128+
className="save-series-button"
129+
onClick={(e) => {
130+
dispatch(save(toStorage));
131+
}}
132+
>
133+
Save Series
134+
</button>
138135
<svg ref={containerRef} width={width} height={height}>
139136
{}
140137
<rect
@@ -152,7 +149,7 @@ const BarGraph = (props) => {
152149
yScale={renderingScale}
153150
width={xMax}
154151
height={yMax}
155-
stroke='black'
152+
stroke="black"
156153
strokeOpacity={0.1}
157154
xOffset={snapshotIdScale.bandwidth() / 2}
158155
/>
@@ -168,9 +165,7 @@ const BarGraph = (props) => {
168165
{(barStacks) =>
169166
barStacks.map((barStack) =>
170167
barStack.bars.map((bar, idx) => {
171-
console.log('barstacks >>>', barStack);
172-
console.log('bars >>>', bar);
173-
// hides new components if components don't exist in previous snapshots
168+
// Hides new components if components don't exist in previous snapshots.
174169
if (Number.isNaN(bar.bar[1]) || bar.height < 0) {
175170
bar.height = 0;
176171
}
@@ -183,7 +178,7 @@ const BarGraph = (props) => {
183178
width={bar.width}
184179
fill={bar.color}
185180
/* TIP TOOL EVENT HANDLERS */
186-
// Hides tool tip once cursor moves off the current rect
181+
// Hides tool tip once cursor moves off the current rect.
187182
onMouseLeave={() => {
188183
dispatch(
189184
onHoverExit(data.componentData[bar.key].rtid),
@@ -192,7 +187,7 @@ const BarGraph = (props) => {
192187
}, 300))
193188
);
194189
}}
195-
// Cursor position in window updates position of the tool tip
190+
// Cursor position in window updates position of the tool tip.
196191
onMouseMove={(event) => {
197192
dispatch(onHover(data.componentData[bar.key].rtid));
198193
if (tooltipTimeout) clearTimeout(tooltipTimeout);
@@ -240,15 +235,15 @@ const BarGraph = (props) => {
240235
/>
241236
<Text
242237
x={-xMax / 2}
243-
y='15'
244-
transform='rotate(-90)'
238+
y="15"
239+
transform="rotate(-90)"
245240
fontSize={12}
246-
fill='#FFFFFF'
241+
fill="#FFFFFF"
247242
>
248243
Rendering Time (ms)
249244
</Text>
250245
<br />
251-
<Text x={xMax / 2 + 15} y={yMax + 70} fontSize={12} fill='#FFFFFF'>
246+
<Text x={xMax / 2 + 15} y={yMax + 70} fontSize={12} fill="#FFFFFF">
252247
Snapshot ID
253248
</Text>
254249
</svg>

src/app/components/BarGraphComparison.tsx

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-nocheck
2-
import React, { useEffect, useForceUpdate } from 'react';
2+
import React from 'react';
33
import { BarStack } from '@visx/shape';
44
import { SeriesPoint } from '@visx/shape/lib/types';
55
import { Group } from '@visx/group';
@@ -8,15 +8,11 @@ import { AxisBottom, AxisLeft } from '@visx/axis';
88
import { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale';
99
import { useTooltip, useTooltipInPortal, defaultStyles } from '@visx/tooltip';
1010
import { Text } from '@visx/text';
11-
1211
import { schemeSet3 } from 'd3-scale-chromatic';
1312
import { makeStyles } from '@material-ui/core/styles';
1413
import Select from '@material-ui/core/Select';
15-
import InputLabel from '@material-ui/core/InputLabel';
1614
import MenuItem from '@material-ui/core/MenuItem';
1715
import FormControl from '@material-ui/core/FormControl';
18-
import FormHelperText from '@material-ui/core/FormHelperText';
19-
import snapshots from './snapshots';
2016
import { onHover, onHoverExit } from '../actions/actions';
2117
import { useStoreContext } from '../store';
2218
import { deleteSeries } from '../actions/actions';
@@ -105,15 +101,17 @@ const BarGraphComparison = (props) => {
105101
const formatRenderTime = (time) => `${time} ms `;
106102
const getCurrentTab = (storedSeries) => storedSeries.currentTab;
107103
// create visualization SCALES with cleaned data
108-
//const xAxisPoints = [...titleFilter(comparison).map(getTabID), currentTab];
109-
//the domain array elements will place the bars along the x-axis
110-
const xAxisPoints = ['currentTab', 'comparison']; //[1.0.,2.0]
111-
//{ currentTab : 1 }, {currentTab : 2 }
104+
// the domain array/xAxisPoints elements will place the bars along the x-axis
105+
const xAxisPoints = ['currentTab', 'comparison'];
112106
const snapshotIdScale = scaleBand<string>({
113107
domain: xAxisPoints,
114108
padding: 0.2,
115109
});
116-
// calculateMax
110+
// This function will iterate through the snapshots of the series,
111+
// and grab the highest render times (sum of all component times).
112+
// We'll then use it in the renderingScale function and compare
113+
// with the render time of the current tab.
114+
// The max render time will determine the Y-axis's highest number.
117115
const calculateMaxTotalRender = (series) => {
118116
const currentSeriesBarStacks = !comparison[series]
119117
? []
@@ -128,11 +126,13 @@ const BarGraphComparison = (props) => {
128126
return currentMax;
129127
};
130128

129+
// the domain array on rendering scale will set the coordinates for Y-aix points.
131130
const renderingScale = scaleLinear<number>({
132131
domain: [0, Math.max(calculateMaxTotalRender(series), data.maxTotalRender)],
133132
nice: true,
134133
});
135-
134+
// the domain array will assign each key(component on test app) a different color
135+
// and use range to set the color scheme each bar
136136
const colorScale = scaleOrdinal<string>({
137137
domain: keys,
138138
range: schemeSet3,
@@ -144,7 +144,7 @@ const BarGraphComparison = (props) => {
144144
snapshotIdScale.rangeRound([0, xMax]);
145145
renderingScale.range([yMax, 0]);
146146

147-
// Dropdown to select series.
147+
// useStyles will change the styling on save series dropdown feature
148148
const useStyles = makeStyles((theme) => ({
149149
formControl: {
150150
margin: theme.spacing(1),
@@ -198,37 +198,37 @@ const BarGraphComparison = (props) => {
198198
e.target.classList.add('animate');
199199
e.target.innerHTML = 'Deleted!';
200200
setTimeout(function () {
201-
e.target.innerHTML = 'Clear Series';
201+
e.target.innerHTML = 'Clear All Series';
202202
e.target.classList.remove('animate');
203203
}, 1000);
204204
};
205205
const classname = document.getElementsByClassName('delete-button');
206206
for (let i = 0; i < classname.length; i++) {
207207
classname[i].addEventListener('click', animateButton, false);
208208
}
209-
//console.log('set x on current bar', setXpointsCurrentTab());
210209
return (
211210
<div>
212-
<div className='series-options-container'>
213-
<div className='snapshotId-header'>
211+
<div className="series-options-container">
212+
<div className="snapshotId-header">
214213
{' '}
215214
Snapshot ID: {currentIndex + 1}{' '}
216215
</div>
217216

218-
<div className='dropdown-and-delete-series-container'>
217+
<div className="dropdown-and-delete-series-container">
219218
<button
220-
className='delete-button'
219+
className="delete-button"
221220
onClick={(e) => {
222221
dispatch(deleteSeries());
223222
}}
224223
>
225224
Clear All Series
226225
</button>
227-
<FormControl variant='outlined' className={classes.formControl}>
226+
<h4 style={{ padding: '0 1rem' }}>Compare with: </h4>
227+
<FormControl variant="outlined" className={classes.formControl}>
228228
<Select
229229
style={{ color: 'white' }}
230-
labelId='simple-select-outlined-label'
231-
id='simple-select-outlined'
230+
labelId="simple-select-outlined-label"
231+
id="simple-select-outlined"
232232
className={classes.select}
233233
open={open}
234234
onClose={handleClose}
@@ -267,13 +267,13 @@ const BarGraphComparison = (props) => {
267267
yScale={renderingScale}
268268
width={xMax}
269269
height={yMax}
270-
stroke='black'
270+
stroke="black"
271271
strokeOpacity={0.1}
272272
xOffset={snapshotIdScale.bandwidth() / 2}
273273
/>
274274
<Group top={margin.top} left={margin.left}>
275275
<BarStack
276-
// OG Barstack
276+
// Current Tab bar stack.
277277
data={setXpointsCurrentTab()}
278278
keys={keys}
279279
x={getCurrentTab}
@@ -283,6 +283,11 @@ const BarGraphComparison = (props) => {
283283
>
284284
{(barStacks) =>
285285
barStacks.map((barStack, idx) => {
286+
// Uses map method to iterate through all components,
287+
// creating a rect component (from visx) for each iteration.
288+
// height/width/etc. are calculated by visx.
289+
// to set X and Y scale, it will used the passed in function and
290+
// will run it on the array thats outputted by data
286291
const bar = barStack.bars[currentIndex];
287292
if (Number.isNaN(bar.bar[1]) || bar.height < 0) {
288293
bar.height = 0;
@@ -323,7 +328,9 @@ const BarGraphComparison = (props) => {
323328
}
324329
</BarStack>
325330
<BarStack
326-
// Comparison Barstack
331+
// Comparison Barstack (populates based on series selected)
332+
//to set X and Y scale, it will used the passed in function and
333+
// will run it on the array thats outputted by data
327334
data={!comparison[series] ? [] : setXpointsComparison()}
328335
keys={keys}
329336
x={getCurrentTab}
@@ -333,6 +340,9 @@ const BarGraphComparison = (props) => {
333340
>
334341
{(barStacks) =>
335342
barStacks.map((barStack, idx) => {
343+
// Uses map method to iterate through all components,
344+
// creating a rect component (from visx) for each iteration.
345+
// height/width/etc. are calculated by visx.
336346
if (!barStack.bars[currentIndex]) {
337347
return <h1>No Comparison</h1>;
338348
}
@@ -405,14 +415,14 @@ const BarGraphComparison = (props) => {
405415
/>
406416
<Text
407417
x={-xMax / 2}
408-
y='15'
409-
transform='rotate(-90)'
418+
y="15"
419+
transform="rotate(-90)"
410420
fontSize={12}
411-
fill='#FFFFFF'
421+
fill="#FFFFFF"
412422
>
413423
Rendering Time (ms)
414424
</Text>
415-
<Text x={xMax / 2} y={yMax + 65} fontSize={12} fill='#FFFFFF'>
425+
<Text x={xMax / 2} y={yMax + 65} fontSize={12} fill="#FFFFFF">
416426
Series ID
417427
</Text>
418428
</svg>

src/app/components/StateRoute.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const StateRoute = (props: StateRouteProps) => {
5858
y: 250,
5959
k: 1,
6060
});
61-
console.log("webMetrics in StateRoute Props >>>>", webMetrics);
6261
// Map
6362
const renderComponentMap = () => {
6463
if (hierarchy) {
@@ -135,7 +134,7 @@ const StateRoute = (props: StateRouteProps) => {
135134
<WebMetrics
136135
color={LCPColor}
137136
series={(webMetrics.LCP / 2500) * 100}
138-
formatted={(val) => ((val / 100) * 2500).toFixed(2) + " ms"}
137+
formatted={(val) => ((val / 100) * 2500).toFixed(2) + ' ms'}
139138
label="LCP"
140139
/>
141140
<WebMetrics

src/app/components/WebMetrics.tsx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import React, { useState, useEffect, Component } from "react";
2-
import Charts from "react-apexcharts";
3-
import useForceUpdate from "./useForceUpdate";
1+
import React from 'react';
2+
import Charts from 'react-apexcharts';
43

54
const radialGraph = (props) => {
6-
const [hoverView, setHoverView] = useState(false);
75
const state = {
86
series: [props.series],
97
options: {
@@ -22,12 +20,12 @@ const radialGraph = (props) => {
2220
endAngle: 135,
2321
hollow: {
2422
margin: 0,
25-
size: "75%",
26-
background: "#242529",
23+
size: '75%',
24+
background: '#242529',
2725
image: undefined,
2826
imageOffsetX: 0,
2927
imageOffsetY: 0,
30-
position: "front",
28+
position: 'front',
3129
dropShadow: {
3230
enabled: false,
3331
top: 3,
@@ -37,8 +35,8 @@ const radialGraph = (props) => {
3735
},
3836
},
3937
track: {
40-
background: "#fff",
41-
strokeWidth: "3%",
38+
background: '#fff',
39+
strokeWidth: '3%',
4240
margin: 0, // margin is in pixels
4341
dropShadow: {
4442
enabled: true,
@@ -54,23 +52,23 @@ const radialGraph = (props) => {
5452
name: {
5553
offsetY: -10,
5654
show: true,
57-
color: "#fff",
58-
fontSize: "24px",
55+
color: '#fff',
56+
fontSize: '24px',
5957
},
6058
value: {
6159
formatter: props.formatted,
62-
color: "#fff",
63-
fontSize: "16px",
60+
color: '#fff',
61+
fontSize: '16px',
6462
show: true,
6563
},
6664
},
6765
},
6866
},
6967
fill: {
70-
type: "solid",
68+
type: 'solid',
7169
gradient: {
72-
shade: "dark",
73-
type: "horizontal",
70+
shade: 'dark',
71+
type: 'horizontal',
7472
shadeIntensity: 0.1,
7573
gradientToColors: [props.color],
7674
inverseColors: false,
@@ -80,7 +78,7 @@ const radialGraph = (props) => {
8078
},
8179
},
8280
stroke: {
83-
lineCap: "flat",
81+
lineCap: 'flat',
8482
},
8583
labels: [props.label],
8684
},

src/app/containers/ActionContainer.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// @ts-nocheck
22
import React from 'react';
3-
import { diff } from 'jsondiffpatch';
43
import Action from '../components/Action';
54
import SwitchAppDropdown from '../components/SwitchApp';
6-
75
import { emptySnapshots, changeView, changeSlider } from '../actions/actions';
86
import { useStoreContext } from '../store';
97
import { useEffect } from 'react';

src/app/containers/ButtonsContainer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// @ts-nocheck
22
import React from 'react';
3-
43
import { importSnapshots, toggleMode } from '../actions/actions';
54
import { useStoreContext } from '../store';
65
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

0 commit comments

Comments
 (0)