Skip to content

Commit 9a98e6a

Browse files
committed
General cleanup, moved final dispatch from onExit to onChangeHandler
1 parent d63dab8 commit 9a98e6a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/app/components/Tutorial.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// @ts-nocheck
22
import * as React from 'react';
3-
import { useState, useEffect, Component } from 'react';
4-
import { useLocation, Redirect } from 'react-router-dom';
5-
import { Steps, Hints, updateStepElement } from 'intro.js-react';
3+
import { Component } from 'react';
4+
import { Steps } from 'intro.js-react';
65
import 'intro.js/introjs.css';
76
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
87
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
9-
import { useStoreContext } from '../store';
108
import { tutorialSaveSeriesToggle, setCurrentTabInApp } from '../actions/actions';
119

1210
// export default function Tutorial(): JSX.Element {
@@ -201,6 +199,7 @@ import { tutorialSaveSeriesToggle, setCurrentTabInApp } from '../actions/actions
201199
// );
202200
// }
203201

202+
// This needs to be a class component to be compatible with updateStepElement from intro.js
204203
class Tutorial extends Component {
205204
constructor(props) {
206205
super(props);
@@ -216,10 +215,10 @@ class Tutorial extends Component {
216215
if (currentTabInApp === 'performance' && currentStepIndex === 1) {
217216
dispatch(tutorialSaveSeriesToggle('inputBoxOpen'));
218217
this.steps.updateStepElement(currentStepIndex);
219-
};
218+
}
220219
if (currentTabInApp === 'performance' && currentStepIndex === 2) {
221220
this.steps.updateStepElement(currentStepIndex);
222-
};
221+
}
223222
if (currentTabInApp === 'performance' && currentStepIndex === 4) {
224223
dispatch(tutorialSaveSeriesToggle('saved'));
225224
this.steps.updateStepElement(currentStepIndex);
@@ -228,13 +227,13 @@ class Tutorial extends Component {
228227
this.steps.updateStepElement(currentStepIndex);
229228
dispatch(setCurrentTabInApp('performance-comparison'));
230229
}
230+
if (currentTabInApp === 'performance-comparison' && currentStepIndex === 6) {
231+
dispatch(tutorialSaveSeriesToggle(false));
232+
}
231233
};
232234

233235
const onExit = () => {
234236
this.setState({ stepsEnabled: false });
235-
if (currentTabInApp === 'performance' || currentTabInApp === 'performance-comparison' || currentTabInApp === 'performance-component-details') {
236-
dispatch(tutorialSaveSeriesToggle(false));
237-
}
238237
};
239238
const startIntro = () => {
240239
if (currentTabInApp === 'performance' || currentTabInApp === 'performance-comparison' || currentTabInApp === 'performance-component-details') {

0 commit comments

Comments
 (0)