Skip to content

Commit 1d03904

Browse files
committed
Full TypeScript implementation on Action.tsx
1 parent b20577b commit 1d03904

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/app/components/Action.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import React from 'react';
66
import ReactHover, { Trigger, Hover } from 'react-hover';
77
import { changeView, changeSlider } from '../actions/actions';
8-
import { ActionProps } from '../components/FrontendTypes';
8+
import { ActionProps, OptionsCursorTrueWithMargin } from '../components/FrontendTypes';
99

1010
/**
1111
* @function Action
@@ -41,12 +41,12 @@ const Action = (props: ActionProps): JSX.Element => {
4141
* @function cleanTime: Displays render times for state changes
4242
* @returns render display time in seconds in milliseconds
4343
*/
44-
const cleanTime = ():string => {
44+
const cleanTime = (): string => {
4545
if (!componentData || !componentData.actualDuration) {
4646
return 'NO TIME';
4747
}
4848
let seconds: number | string;
49-
let milliseconds: any = componentData.actualDuration;
49+
let milliseconds: any = componentData.actualDuration;
5050
if (Math.floor(componentData.actualDuration) > 60) {
5151
seconds = Math.floor(componentData.actualDuration / 60);
5252
seconds = JSON.stringify(seconds);
@@ -57,8 +57,8 @@ const Action = (props: ActionProps): JSX.Element => {
5757
} else {
5858
seconds = '00';
5959
}
60-
milliseconds = Number.parseFloat(milliseconds).toFixed(2);
61-
const arrayMilliseconds = milliseconds.split('.');
60+
milliseconds = Number.parseFloat(milliseconds as string).toFixed(2);
61+
const arrayMilliseconds: string | number = milliseconds.split('.');
6262
if (arrayMilliseconds[0].length < 2) {
6363
arrayMilliseconds[0] = '0'.concat(arrayMilliseconds[0]);
6464
}
@@ -69,7 +69,7 @@ const Action = (props: ActionProps): JSX.Element => {
6969
};
7070
const displayTime: string = cleanTime();
7171

72-
const optionsCursorTrueWithMargin: {} = {
72+
const optionsCursorTrueWithMargin: OptionsCursorTrueWithMargin = {
7373
followCursor: true,
7474
shiftX: 20,
7575
shiftY: 0,
@@ -79,7 +79,7 @@ const Action = (props: ActionProps): JSX.Element => {
7979
<div className='individual-action'>
8080
<div
8181
// Invoking keyboard functionality; functionality is in ActionContainer;
82-
onKeyDown={(e) => handleOnkeyDown(e, viewIndex)}
82+
onKeyDown={(e):void => handleOnkeyDown(e, viewIndex)}
8383
className={selected || last ? 'action-component selected' : 'action-component'}
8484
onClick={() => {
8585
dispatch(changeView(index));
@@ -112,7 +112,7 @@ const Action = (props: ActionProps): JSX.Element => {
112112
) : (
113113
<button
114114
className='jump-button'
115-
onClick={(e: any): void => {
115+
onClick={(e): void => {
116116
e.stopPropagation();
117117
dispatch(changeSlider(index));
118118
dispatch(changeView(index));

0 commit comments

Comments
 (0)