You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ Steps }=require('intro.js-react');//Must be required in. This enables compatibility with TS. If imported in, throws ts error of not rendering steps as a class component correctly.
12
+
const{ Steps }=require('intro.js-react');//Must be required in. This enables compatibility with TS. If imported in, throws ts error of not rendering steps as a class component correctly. The package 'intro.js-react' is small React wrapper around Intro.js. The wrapper provides support for both steps and hints. https://introjs.com/docs/
13
13
14
14
/*
15
15
This is the tutorial displayed when the "How to use" button is clicked
constonChangeHandler=(currentStepIndex: number)=>{// takes in the current step and updates the tab[currentTab]'s seriesSavedStatus based on conditions and updates the element associated with the step.
dispatch(setCurrentTabInApp('performance-comparison'));// dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'performance-comparison.' to facilitate render.
dispatch(tutorialSaveSeriesToggle(false));// sends a dispatch that update's tab[currentTab]'s 'seriesSavedStatus' to the boolean 'false'
59
66
}
60
67
};
61
68
62
-
constonExit=()=>{
63
-
this.setState({stepsEnabled: false});
69
+
constonExit=()=>{// This callback is called when the tutorial exits
70
+
this.setState({stepsEnabled: false});// sets stepsEnabled to false in this component's state
64
71
};
65
-
conststartIntro=()=>{
66
-
// If "How to use" is clicked while in the performance tab,
67
-
// we'll navigate to the snapshops view before starting the tutorial
68
-
// This is because the tutorial steps are designed to begin on the snapshots sub-tab
69
-
// Check out the PerformanceVisx component to see the route redirect logic
72
+
73
+
conststartIntro=()=>{// If "How to use" is clicked while in the performance tab, we'll navigate to the snapshops view before starting the tutorial. This is because the tutorial steps are designed to begin on the snapshots sub-tab. Check out the 'PerformanceVisx' component to see the route redirect logic
70
74
if(
71
75
currentTabInApp==='performance'||
72
76
currentTabInApp==='performance-comparison'||
73
77
currentTabInApp==='performance-component-details'
74
78
){
75
79
dispatch(setCurrentTabInApp('performance'));// dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'performance' to facilitate render.
76
80
}
77
-
this.setState({stepsEnabled: true});
81
+
this.setState({stepsEnabled: true});// sets stepsEnabled to false in this component's state
78
82
};
79
83
80
-
letsteps: StepsObj[]=[];
84
+
letsteps: StepsObj[]=[];// the steps array will be populated with tutorial elements based on the 'currentTabInApp' case. This allows for specific tutorials based on the current page the user is viewing.
enabled={this.state.stepsEnabled}// Defines if steps are visible or not, default is false
339
+
steps={steps}// Array of steps
340
+
initialStep={0}// Step index to start with when showing the steps
341
+
onExit={onExit}// Callback called when the steps are disabled. Keeps track of state when steps are dismissed with an Intro.js event and not the enabled prop
338
342
options={{
339
343
tooltipClass: 'customTooltip',
340
-
scrollToElement: false,
341
-
showProgress: true,
342
-
showStepNumbers: true,
343
-
showBullets: false,
344
-
exitOnOverlayClick: false,
345
-
doneLabel: 'Done',
346
-
nextLabel: 'Next',
347
-
hideNext: false,
348
-
skipLabel: 'Skip',
349
-
keyboardNavigation: true,
350
-
overlayOpacity: 0.85,
344
+
scrollToElement: false,// Enables scrolling to hidden elements
345
+
showProgress: true,// Shows progress indicator
346
+
showStepNumbers: true,// Show steps number in a red circle
347
+
showBullets: false,// Show bullets
348
+
exitOnOverlayClick: false,// Exit by clicking on the overlay layer
349
+
doneLabel: 'Done',// Done button label
350
+
nextLabel: 'Next',// Next button label
351
+
hideNext: false,// Hide the Next button in the last step
352
+
skipLabel: 'Skip',// Skip button label
353
+
keyboardNavigation: true,// allows navigation between steps using the keyboard
0 commit comments