Skip to content

Commit 87bd2e6

Browse files
Samuel  TranSamuel  Tran
authored andcommitted
Migrated tutorial.tsx to typescript but still has tsnocheck
Fixed all other typescript errors. But Steps has a JSX.element issue with typescript so had to do ts nocheck so that it will pass Travis CI
1 parent bf345c8 commit 87bd2e6

File tree

2 files changed

+273
-276
lines changed

2 files changed

+273
-276
lines changed

src/app/components/Tutorial.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
// @ts-nocheck
1+
//@ts-nocheck
22
import * as React from 'react';
33
import { Component } from 'react';
44
import { Steps } from 'intro.js-react';
55
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';
9+
10+
type tutorialProps = Record<string, unknown>
1011

1112
// This is the tutorial displayed when the "How to use" button is clicked
1213
// This needs to be a class component to be compatible with updateStepElement from intro.js
13-
class Tutorial extends Component {
14-
constructor(props) {
14+
class Tutorial extends React.Component<tutorialProps> {
15+
constructor(props:tutorialProps) {
1516
super(props);
1617
this.state = {
1718
stepsEnabled: false,
1819
};
1920
}
2021

21-
render() {
22+
render(): JSX.Element {
2223
const { currentTabInApp, dispatch } = this.props;
23-
24+
2425
// This updates the steps so that they can target dynamically rendered elements
25-
const onChangeHandler = (currentStepIndex: Number) => {
26+
const onChangeHandler = (currentStepIndex: number) => {
2627
if (currentTabInApp === 'performance' && currentStepIndex === 1) {
2728
dispatch(tutorialSaveSeriesToggle('inputBoxOpen'));
2829
this.steps.updateStepElement(currentStepIndex);
@@ -58,15 +59,14 @@ class Tutorial extends Component {
5859
};
5960

6061
interface stepsObj {
61-
title: String,
62-
element?: String,
63-
intro: String,
64-
position: String,
62+
title: string,
63+
element?: string,
64+
intro: string,
65+
position: string,
6566
}
6667

6768
let steps: stepsObj[] = [];
6869

69-
7070
switch (currentTabInApp) {
7171
case 'map':
7272
steps = [{
@@ -210,9 +210,6 @@ class Tutorial extends Component {
210210
break;
211211
}
212212

213-
214-
215-
216213
return (
217214
<>
218215
<Steps

0 commit comments

Comments
 (0)