Skip to content

Commit 48cca97

Browse files
yuanjackie1MarkTeetsjasnoominzo-kim
committed
cleeaned out the TS for History.tsx/StateRoute.tsx
Co-authored-by: Mark Teets <[email protected]> Co-authored-by: Jasmine Noor <[email protected]> Co-authored-by: Minzo Kim <[email protected]>
1 parent e84062f commit 48cca97

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

src/app/components/StateRoute/History.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,11 @@ import React, { useEffect } from 'react';
55
// formatting findDiff return data to show the changes with colors, aligns with actions.tsx
66
import { diff, formatters } from 'jsondiffpatch';
77
import * as d3 from 'd3';
8-
8+
import { DefaultMargin } from '../../components/FrontendTypes';
99
import { changeView, changeSlider, setCurrentTabInApp } from '../../actions/actions';
1010
import { useStoreContext } from '../../store';
1111

12-
interface defaultMargin {
13-
top: number;
14-
left: number;
15-
right: number;
16-
bottom: number;
17-
}
18-
19-
const defaultMargin: defaultMargin = {
12+
const defaultMargin: DefaultMargin = {
2013
top: 30,
2114
left: 30,
2215
right: 55,

src/app/components/StateRoute/StateRoute.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,20 @@ import { changeView, changeSlider } from '../../actions/actions';
1414
import { useStoreContext } from '../../store';
1515
import PerformanceVisx from './PerformanceVisx/PerformanceVisx';
1616
import WebMetrics from '../WebMetrics';
17+
import { StateRouteProps } from '../../components/FrontendTypes'
1718

1819
const History = require('./History').default;
1920

2021
const NO_STATE_MSG = 'No state change detected. Trigger an event to change state';
2122

22-
export interface StateRouteProps {
23-
snapshot: {
24-
name?: string;
25-
componentData?: object;
26-
state?: string | object;
27-
stateSnaphot?: object;
28-
children?: any[];
29-
};
30-
hierarchy: any;
31-
snapshots: [];
32-
viewIndex: number;
33-
webMetrics: object;
34-
currLocation: object;
35-
}
3623

3724
const StateRoute = (props: StateRouteProps) => {
3825
const { snapshot, hierarchy, snapshots, viewIndex, webMetrics, currLocation } = props;
3926
const [{ tabs, currentTab }, dispatch] = useStoreContext();
4027
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
4128

4229
// Map
43-
const renderComponentMap = () => {
30+
const renderComponentMap = (): JSX.Element => {
4431
if (hierarchy) {
4532
return (
4633
<ParentSize className='componentMapContainer'>
@@ -63,7 +50,7 @@ const StateRoute = (props: StateRouteProps) => {
6350
// if true, we invoke the D3 render chart with hierarchy
6451
// by invoking History component, and passing in all the props required to render D3 elements and perform timeJump from clicking of node
6552
// otherwise we send an alert to the user that no state was found.
66-
const renderHistory = () => {
53+
const renderHistory = (): JSX.Element => {
6754
if (hierarchy) {
6855
return (
6956
<ParentSize>

0 commit comments

Comments
 (0)