Skip to content

Commit 3941189

Browse files
committed
revised typescript, refactored file
1 parent f55d56e commit 3941189

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

src/app/components/FrontendTypes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface PerfData {
2+
barStack: BarStackProp[],
3+
componentData?: Record<string, unknown>,
4+
maxTotalRender: number,
5+
}
6+
7+
interface BarStackProp {
8+
snapshotId: string,
9+
route: URL,
10+
}

src/app/components/StateRoute/PerformanceVisx/BarGraph.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Text } from '@visx/text';
1111
import { schemeSet3 } from 'd3-scale-chromatic';
1212
import { onHover, onHoverExit, save } from '../../../actions/actions';
1313
import { useStoreContext } from '../../../store';
14+
import { PerfData } from '../../FrontendTypes';
1415

1516
/* TYPESCRIPT */
1617

@@ -41,16 +42,16 @@ interface TooltipData {
4142
}
4243

4344
interface BarGraphProps {
44-
width: number,
45-
height: number,
46-
data: Record<string, unknown>,
47-
comparison: unknown,
48-
setRoute: () => void,
49-
allRoutes: unknown,
50-
filteredSnapshots: unknown,
51-
snapshot: unknown,
52-
setSnapshot: () => void
53-
}
45+
width: number,
46+
height: number,
47+
data: PerfData,
48+
comparison: unknown,
49+
setRoute: () => void,
50+
allRoutes: unknown,
51+
filteredSnapshots: unknown,
52+
snapshot: unknown,
53+
setSnapshot: () => void
54+
}
5455

5556
/* DEFAULTS */
5657
const margin = {

src/app/components/StateRoute/PerformanceVisx/BarGraphComparison.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import MenuItem from '@material-ui/core/MenuItem';
1515
import FormControl from '@material-ui/core/FormControl';
1616
import { onHover, onHoverExit, deleteSeries, setCurrentTabInApp } from '../../../actions/actions';
1717
import { useStoreContext } from '../../../store';
18+
import { PerfData } from '../../FrontendTypes';
1819

1920
/* TYPESCRIPT */
2021

@@ -48,7 +49,7 @@ interface TooltipData {
4849
interface BarGraphComparisonProps {
4950
width: number,
5051
height: number,
51-
data: Record<string, unknown>,
52+
data: PerfData,
5253
comparison: string | [],
5354
setSeries: () => void,
5455
series: unknown,

src/app/components/StateRoute/PerformanceVisx/PerformanceVisx.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* eslint-disable no-param-reassign */
22
/* eslint-disable guard-for-in */
33
/* eslint-disable no-restricted-syntax */
4+
/* eslint-disable max-len */
5+
46
import React, { useState, useEffect } from 'react';
57
import {
68
MemoryRouter as Router,
@@ -15,7 +17,7 @@ import BarGraphComparison from './BarGraphComparison';
1517
import BarGraphComparisonActions from './BarGraphComparisonActions';
1618
import { useStoreContext } from '../../../store';
1719
import { setCurrentTabInApp } from '../../../actions/actions';
18-
import { Bar } from '@visx/shape';
20+
import { PerfData } from '../../FrontendTypes';
1921

2022
interface BarStackProps {
2123
width: number;
@@ -146,13 +148,13 @@ const getSnapshotIds = (obj, snapshotIds = []): string[] => {
146148
return snapshotIds;
147149
};
148150

149-
type BarStackProp = Record <string, unknown>
151+
// type BarStackProp = Record <string, unknown | URL | number>
150152

151-
interface PerfData {
152-
barStack: BarStackProp[],
153-
componentData?: Record<string, unknown>,
154-
maxTotalRender: number,
155-
}
153+
// interface PerfData {
154+
// barStack: BarStackProp[],
155+
// componentData?: Record<string, unknown>,
156+
// maxTotalRender: number,
157+
// }
156158

157159
// Returns array of snapshot objs each with components and corresponding render times.
158160
const getPerfMetrics = (snapshots, snapshotsIds): PerfData => {
@@ -294,7 +296,6 @@ const PerformanceVisx = (props: BarStackProps): JSX.Element => {
294296
return (
295297
<div>
296298
<BarGraph
297-
maxHeight={maxHeight}
298299
data={data}
299300
width={width}
300301
height={height}

0 commit comments

Comments
 (0)