Skip to content

Commit 4a15165

Browse files
authored
Merge pull request #7 from oslabs-beta/brian/feature
Updated LinkControls.tsx, PerformanceVisx.tsx, RenderingFrequency.tsx, StateRoute.tsx, Tutorial.tsx.
2 parents 2bc3c4e + a3fe508 commit 4a15165

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

src/app/components/LinkControls.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { List } from '@material-ui/core';
21
import React from 'react';
3-
import snapshots from './snapshots';
42
// Font size of the Controls label and Dropdowns
53
const controlStyles = {
64
fontSize: '12px',
@@ -53,10 +51,8 @@ const collectNodes = node => {
5351

5452
export default function LinkControls({
5553
layout,
56-
orientation,
5754
linkType,
5855
stepPercent,
59-
selectedNode,
6056
setLayout,
6157
setOrientation,
6258
setLinkType,
@@ -71,7 +67,7 @@ export default function LinkControls({
7167

7268
{/* Controls for the layout selection */}
7369
<label>Layout:</label>
74-
&nbsp;
70+
&nbsp; {/*This is a non-breaking space - Prevents an automatic line break at this position */}
7571
<select
7672
onClick={e => e.stopPropagation()}
7773
onChange={e => setLayout(e.target.value)}
@@ -89,7 +85,6 @@ export default function LinkControls({
8985
<select
9086
onClick={e => e.stopPropagation()}
9187
onChange={e => setOrientation(e.target.value)}
92-
// value={orientation}/
9388
disabled={layout === 'polar'}
9489
style={dropDownStyle}
9590
>
@@ -113,7 +108,7 @@ export default function LinkControls({
113108

114109
{/* Controls for the select selections. */}
115110
<label> Select:</label>
116-
&nbsp; {/*This is a non-breaking space - Prevents an automatic line break at this position */}
111+
&nbsp;
117112
<input id='selectInput' list='nodeOptions' type='text' name="nodeOptions"
118113
onChange={e => setSelectedNode(e.target.value)}
119114
style={dropDownStyle}

src/app/components/PerformanceVisx.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import BarGraphComparisonActions from './BarGraphComparisonActions';
1616
import { useStoreContext } from '../store';
1717
import { setCurrentTabInApp } from '../actions/actions';
1818

19-
// typescript for PROPS from StateRoute.tsx
19+
2020
interface BarStackProps {
2121
width: number;
2222
height: number;
@@ -87,7 +87,7 @@ const traverse = (snapshot, data, snapshots, currTotalRender = 0) => {
8787
if (!snapshot.children[0]) return;
8888

8989
// loop through snapshots
90-
snapshot.children.forEach((child, idx) => {
90+
snapshot.children.forEach((child, idx: number) => {
9191
const componentName = child.name + -[idx + 1];
9292

9393
// Get component Rendering Time
@@ -152,7 +152,7 @@ const getPerfMetrics = (snapshots, snapshotsIds): {} => {
152152
componentData: {},
153153
maxTotalRender: 0,
154154
};
155-
snapshots.forEach((snapshot, i) => {
155+
snapshots.forEach((snapshot, i: number) => {
156156
perfData.barStack.push({ snapshotId: snapshotsIds[i], route: snapshot.route.url });
157157
traverse(snapshot, perfData, snapshots);
158158
});

src/app/components/RenderingFrequency.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/* eslint-disable jsx-a11y/no-static-element-interactions */
33
/* eslint-disable react/prop-types */
44
import React, { useState, useEffect } from 'react';
5-
import { render } from 'react-dom';
65
import { onHover, onHoverExit, setCurrentTabInApp } from '../actions/actions';
76
import { useStoreContext } from '../store';
87

@@ -35,13 +34,12 @@ const RenderingFrequency = props => {
3534
);
3635
};
3736

38-
const ComponentCard = props => {
37+
const ComponentCard = (props): JSX.Element => {
3938
const {
4039
componentName,
4140
stateType,
4241
averageRenderTime,
4342
renderFrequency,
44-
rtid,
4543
information,
4644
} = props;
4745
const [{ tabs, currentTab }, dispatch] = useStoreContext();

src/app/components/StateRoute.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
/* eslint-disable @typescript-eslint/no-var-requires */
66
/* eslint-disable max-len */
77
/* eslint-disable object-curly-newline */
8-
import React, { useState, useEffect } from 'react';
8+
import React from 'react';
99
import {
1010
MemoryRouter as Router,
1111
Route,
1212
NavLink,
1313
Switch,
14-
useLocation,
1514
} from 'react-router-dom';
1615
import { ParentSize } from '@visx/responsive';
1716
import Tree from './Tree';
@@ -24,7 +23,7 @@ import WebMetrics from './WebMetrics';
2423
const History = require('./History').default;
2524

2625
const NO_STATE_MSG = 'No state change detected. Trigger an event to change state';
27-
// eslint-disable-next-line react/prop-types
26+
2827

2928
export interface StateRouteProps {
3029
snapshot: {
@@ -79,7 +78,6 @@ const StateRoute = (props: StateRouteProps) => {
7978
sliderIndex={sliderIndex}
8079
viewIndex={viewIndex}
8180
currLocation={currLocation}
82-
// added snapshots 11/4 Rob
8381
snapshots={snapshots}
8482
/>
8583
)}
@@ -99,8 +97,8 @@ const StateRoute = (props: StateRouteProps) => {
9997
return <div className="noState">{NO_STATE_MSG}</div>;
10098
};
10199
const renderWebMetrics = () => {
102-
let LCPColor; let FIDColor; let FCPColor; let
103-
TTFBColor;
100+
let LCPColor: String; let FIDColor: String; let FCPColor: String; let
101+
TTFBColor: String;
104102

105103
if (webMetrics.LCP <= 2000) LCPColor = '#0bce6b';
106104
if (webMetrics.LCP > 2000 && webMetrics.LCP < 4000) LCPColor = '#E56543';

src/app/components/Tutorial.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'intro.js/introjs.css';
66
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
77
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
88
import { tutorialSaveSeriesToggle, setCurrentTabInApp } from '../actions/actions';
9+
import { element } from 'prop-types';
910

1011
// This is the tutorial displayed when the "How to use" button is clicked
1112
// This needs to be a class component to be compatible with updateStepElement from intro.js
@@ -21,7 +22,7 @@ class Tutorial extends Component {
2122
const { currentTabInApp, dispatch } = this.props;
2223

2324
// This updates the steps so that they can target dynamically rendered elements
24-
const onChangeHandler = currentStepIndex => {
25+
const onChangeHandler = (currentStepIndex: Number) => {
2526
if (currentTabInApp === 'performance' && currentStepIndex === 1) {
2627
dispatch(tutorialSaveSeriesToggle('inputBoxOpen'));
2728
this.steps.updateStepElement(currentStepIndex);
@@ -55,8 +56,17 @@ class Tutorial extends Component {
5556
}
5657
this.setState({ stepsEnabled: true });
5758
};
58-
let steps = [];
5959

60+
interface stepsObj {
61+
title: String,
62+
element?: String,
63+
intro: String,
64+
position: String,
65+
}
66+
67+
let steps: stepsObj[] = [];
68+
69+
6070
switch (currentTabInApp) {
6171
case 'map':
6272
steps = [{
@@ -200,6 +210,9 @@ class Tutorial extends Component {
200210
break;
201211
}
202212

213+
214+
215+
203216
return (
204217
<>
205218
<Steps

0 commit comments

Comments
 (0)