Skip to content

Commit c9534c6

Browse files
committed
Merge branch 'dev' into brian/feature
2 parents 3a2bf80 + 5d613c3 commit c9534c6

File tree

4 files changed

+31
-23
lines changed

4 files changed

+31
-23
lines changed

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
/* eslint-disable react/no-array-index-key */
2+
/* eslint-disable react/prop-types */
13
/* eslint-disable jsx-a11y/click-events-have-key-events */
24
/* eslint-disable no-nested-ternary */
35
/* eslint-disable no-unused-expressions */
46
/* eslint-disable jsx-a11y/no-static-element-interactions */
57
/* eslint-disable no-restricted-syntax */
68
/* eslint-disable guard-for-in */
79
// @ts-nocheck
10+
811
import React, { useState, useEffect } from 'react';
912
import { Group } from '@visx/group';
1013
import { hierarchy, Tree } from '@visx/hierarchy';
@@ -32,6 +35,7 @@ export type LinkTypesProps = {
3235
height: number;
3336
margin?: { top: number; right: number; bottom: number; left: number };
3437
snapshots: Record<string, unknown>;
38+
currentSnapshot?: Record<string, unknown>
3539
};
3640

3741
export default function ComponentMap({
@@ -55,8 +59,8 @@ export default function ComponentMap({
5559
}, [dispatch]);
5660

5761
// setting the margins for the Map to render in the tab window.
58-
const innerWidth = totalWidth - margin.left - margin.right;
59-
const innerHeight = totalHeight - margin.top - margin.bottom - 60;
62+
const innerWidth: number = totalWidth - margin.left - margin.right;
63+
const innerHeight: number = totalHeight - margin.top - margin.bottom - 60;
6064

6165
let origin: { x: number; y: number };
6266
let sizeWidth: number;
@@ -122,9 +126,9 @@ export default function ComponentMap({
122126
overflowWrap: 'break-word',
123127
};
124128

125-
const formatRenderTime = time => {
126-
time = time.toFixed(3);
127-
return `${time} ms `;
129+
const formatRenderTime = (time: number): string => {
130+
const renderTime = time.toFixed(3);
131+
return `${renderTime} ms `;
128132
};
129133

130134
const formatProps = data => {
@@ -170,9 +174,9 @@ export default function ComponentMap({
170174
}
171175
};
172176
collectNodes(currentSnapshot);
173-
177+
// @ts
174178
// find the node that has been selected and use it as the root
175-
const startNode = null;
179+
let startNode = null;
176180
let rootNode;
177181
const findSelectedNode = () => {
178182
for (const node of nodeList) {
@@ -215,7 +219,7 @@ export default function ComponentMap({
215219
/>
216220
<Group top={margin.top} left={margin.left}>
217221
<Tree
218-
root={hierarchy(startNode || data, d => (d.isExpanded ? d.children : null))}
222+
root={hierarchy(startNode, d => (d.isExpanded ? d.children : null))}
219223
size={[sizeWidth, sizeHeight]}
220224
separation={(a, b) => (a.parent === b.parent ? 1 : 0.5) / a.depth}
221225
>
@@ -332,7 +336,6 @@ export default function ComponentMap({
332336
? 'white'
333337
: '#161521'
334338
}
335-
z
336339
>
337340
{node.data.name}
338341
</text>
@@ -374,7 +377,7 @@ export default function ComponentMap({
374377
State:
375378
{formatState(tooltipData.state)}
376379
</div>
377-
<div style={scrollStyle}>
380+
<div style={React.scrollStyle}>
378381
<div className="props">
379382
Props:
380383
{formatProps(tooltipData.componentData.props)}

src/app/components/StateRoute/ComponentMap/LinkControls.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable jsx-a11y/label-has-associated-control */
12
import React from 'react';
23
// Font size of the Controls label and Dropdowns
34
const controlStyles = {
@@ -28,10 +29,10 @@ type Props = {
2829
setLinkType: (linkType: string) => void;
2930
setStepPercent: (percent: number) => void;
3031
setSelectedNode: (selectedNode: string) => void;
31-
snapShots: [];
32+
snapShots: Record<string, unknown>;
3233
};
3334

34-
//use BFS to put all the nodes under snapShots(which is the tree node) into an array
35+
// use BFS to put all the nodes under snapShots(which is the tree node) into an array
3536
const nodeList = [];
3637

3738
const collectNodes = node => {
@@ -41,10 +42,8 @@ const collectNodes = node => {
4142
nodeList.push(node);
4243
for (let i = 0; i < nodeList.length; i += 1) {
4344
const cur = nodeList[i];
44-
if (cur.children && cur.children.length > 0) {
45-
for (let child of cur.children) {
46-
nodeList.push(child);
47-
}
45+
if (cur.children?.length > 0) {
46+
cur.children.forEach(child => nodeList.push(child));
4847
}
4948
}
5049
};
@@ -59,15 +58,17 @@ export default function LinkControls({
5958
setStepPercent,
6059
setSelectedNode,
6160
snapShots,
62-
}: Props) {
61+
}: Props): JSX.Element {
6362
collectNodes(snapShots);
6463

6564
return (
6665
<div style={controlStyles}>
6766

6867
{/* Controls for the layout selection */}
6968
<label>Layout:</label>
70-
&nbsp; {/*This is a non-breaking space - Prevents an automatic line break at this position */}
69+
&nbsp;
70+
{' '}
71+
{/* This is a non-breaking space - Prevents an automatic line break at this position */}
7172
<select
7273
onClick={e => e.stopPropagation()}
7374
onChange={e => setLayout(e.target.value)}
@@ -108,12 +109,16 @@ export default function LinkControls({
108109

109110
{/* Controls for the select selections. */}
110111
<label> Select:</label>
111-
&nbsp;
112-
<input id='selectInput' list='nodeOptions' type='text' name="nodeOptions"
112+
&nbsp;
113+
<input
114+
id="selectInput"
115+
list="nodeOptions"
116+
type="text"
117+
name="nodeOptions"
113118
onChange={e => setSelectedNode(e.target.value)}
114119
style={dropDownStyle}
115120
/>
116-
<datalist id='nodeOptions'>
121+
<datalist id="nodeOptions">
117122
{nodeList.map(node => (
118123
<option key={node.name} value={node.name}>{node.name}</option>
119124
))}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
202202
for (let i = 0; i < classname.length; i += 1) {
203203
classname[i].addEventListener('click', animateButton, false);
204204
}
205-
const seriesList: ActionObj[][] = comparison.map((series: Series) => series.data.barStack);
205+
const seriesList: ActionObj[][] = comparison.map((action: Series) => action.data.barStack);
206206
const actionsList: ActionObj[] = seriesList.flat();
207207
const testList: string[] = actionsList.map((elem: ActionObj) => elem.name);
208208

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const collectNodes = (snaps, componentName) => {
6767
}
6868
break;
6969
}
70-
if (cur.children && cur.children.length > 0) {
70+
if (cur.children?.length > 0) {
7171
for (const child of cur.children) {
7272
snapshotList.push(child);
7373
}

0 commit comments

Comments
 (0)