Skip to content

Commit a337127

Browse files
committed
Merge branch 'reactime19.0-Jackie' into feature-testing-add-ts
2 parents 2021b5b + ce2f1a9 commit a337127

File tree

14 files changed

+251
-120
lines changed

14 files changed

+251
-120
lines changed

src/app/components/Action.tsx

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,7 @@
55
import React from 'react';
66
import ReactHover, { Trigger, Hover } from 'react-hover';
77
import { changeView, changeSlider } from '../actions/actions';
8-
9-
/**
10-
* @template ActionProps Props for the action component
11-
*/
12-
13-
interface ActionProps {
14-
key: string;
15-
selected: boolean;
16-
last: boolean;
17-
index: number;
18-
sliderIndex: number;
19-
dispatch: (a: any) => void;
20-
displayName: string;
21-
componentName: string;
22-
componentData: { actualDuration: number } | undefined;
23-
routePath: any;
24-
state?: Record<string, unknown>;
25-
viewIndex: number | undefined;
26-
isCurrIndex: boolean;
27-
handleOnkeyDown: (e: any, i: number) => any;
28-
}
8+
import { ActionProps } from '../components/FrontendTypes';
299

3010
/**
3111
* @function Action
@@ -66,7 +46,7 @@ const Action = (props: ActionProps): JSX.Element => {
6646
return 'NO TIME';
6747
}
6848
let seconds: number | string;
69-
let milliseconds: any = componentData.actualDuration;
49+
let milliseconds: any = componentData.actualDuration;
7050
if (Math.floor(componentData.actualDuration) > 60) {
7151
seconds = Math.floor(componentData.actualDuration / 60);
7252
seconds = JSON.stringify(seconds);
@@ -89,7 +69,7 @@ const Action = (props: ActionProps): JSX.Element => {
8969
};
9070
const displayTime: string = cleanTime();
9171

92-
const optionsCursorTrueWithMargin = {
72+
const optionsCursorTrueWithMargin: {} = {
9373
followCursor: true,
9474
shiftX: 20,
9575
shiftY: 0,

src/app/components/App.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,13 @@ import { MemoryRouter as Router } from 'react-router-dom';
33
import MainContainer from '../containers/MainContainer';
44
import { StoreContext } from '../store';
55
import mainReducer from '../reducers/mainReducer.js';
6-
6+
import { InitialStateProps } from '../components/FrontendTypes';
77
// currentTab is the current active tab within Google Chrome.
88
// This is used to decide what tab Reactime should be monitoring. This can be "locked"
99
// currentTabInApp is the current active tab within Reactime (Map, Performance, History, etc).
1010
// This is used to determine the proper tutorial to render when How To button is pressed.
1111

12-
const initialState: {
13-
port: null | number;
14-
currentTab: null | number;
15-
currentTitle: null | string;
16-
split: null | boolean;
17-
tabs: unknown;
18-
currentTabInApp: null | string;
19-
} = {
12+
const initialState: InitialStateProps = {
2013
port: null,
2114
currentTab: null,
2215
currentTitle: 'No Target',

src/app/components/Diff.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@ import React from 'react';
22
import { diff, formatters } from 'jsondiffpatch';
33
import ReactHtmlParser from 'react-html-parser';
44
import { useStoreContext } from '../store';
5+
import { DiffProps, StatelessCleanning } from '../components/FrontendTypes';
56

6-
interface DiffProps {
7-
snapshot: { state?: Record<string, unknown> };
8-
show?: boolean | undefined;
9-
}
107
/**
118
* Displays tree showing specific two versions of tree
129
* one with specific state changes, the other the whole tree
1310
* @param props props from maincontainer
1411
* @returns a diff tree or a string stating no state changes have happened
1512
*/
16-
function Diff(props: DiffProps) {
13+
function Diff(props: DiffProps): JSX.Element {
1714
const { snapshot, show } = props;
1815
const [mainState] = useStoreContext();
1916
const { currentTab, tabs } = mainState; // k/v pairs of mainstate store object being created
2017
const { snapshots, viewIndex, sliderIndex } = tabs[currentTab];
21-
let previous;
18+
let previous:unknown;
2219

2320
// previous follows viewIndex or sliderIndex
2421
if (viewIndex !== -1) {
@@ -29,13 +26,7 @@ function Diff(props: DiffProps) {
2926
}
3027

3128
// cleaning preview from stateless data
32-
const statelessCleanning = (obj: {
33-
name?: string;
34-
componentData?: Record<string, unknown>;
35-
state?: string | any;
36-
stateSnaphot?: Record<string, unknown>;
37-
children?: any[];
38-
}) => {
29+
const statelessCleanning = (obj: StatelessCleanning) => {
3930
const newObj = { ...obj };
4031
if (newObj.name === 'nameless') {
4132
delete newObj.name;
@@ -66,13 +57,13 @@ function Diff(props: DiffProps) {
6657
};
6758

6859
// displays stateful data
69-
const previousDisplay = statelessCleanning(previous);
60+
const previousDisplay: StatelessCleanning = statelessCleanning(previous);
7061
// diff function returns a comparison of two objects, one has an updated change
7162
// just displays stateful data
72-
const delta = diff(previousDisplay, snapshot);
63+
const delta: StatelessCleanning = diff(previousDisplay, snapshot);
7364
// returns html in string
7465
// just displays stateful data
75-
const html = formatters.html.format(delta, previousDisplay);
66+
const html: StatelessCleanning = formatters.html.format(delta, previousDisplay);
7667
if (show) formatters.html.showUnchanged();
7768
else formatters.html.hideUnchanged();
7869

src/app/components/DiffRoute.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
import React from 'react';
22
import { MemoryRouter as Router, Route, NavLink, Switch } from 'react-router-dom';
33
import Diff from './Diff';
4-
5-
interface DiffRouteProps {
6-
snapshot: Record<
7-
string,
8-
{
9-
name?: string;
10-
componentData?: Record<string, unknown>;
11-
state?: string | unknown;
12-
stateSnaphot?: Record<string, unknown>;
13-
children?: unknown[];
14-
}
15-
>;
16-
}
4+
import { DiffRouteProps } from '../components/FrontendTypes';
175

186
const DiffRoute = (props: DiffRouteProps): JSX.Element => (
197
<Router>

src/app/components/Dropdown.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import React from 'react';
22
import Select from 'react-select';
3-
4-
interface DropdownProps {
5-
selectedSpeed: { value: number; label: string };
6-
speeds: { value: number; label: string }[];
7-
setSpeed: () => void;
8-
}
3+
import { DropdownProps } from '../components/FrontendTypes'
94

105
const Dropdown = (props: DropdownProps): JSX.Element => {
116
const { speeds, setSpeed, selectedSpeed } = props;

src/app/components/ErrorMsg.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React from 'react';
33

44
// parses loadingArray and status and returns the correct message
5-
function parseError(loadingArray: [], status: any): string {
5+
function parseError(loadingArray: [], status: Record<string, unknown>): string {
66
let stillLoading = true;
77
loadingArray.forEach((e) => {
88
if (e === false) stillLoading = false;

0 commit comments

Comments
 (0)