import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { workspaceName } from '../../actions/workspaceActions'; import { clearMessages } from '../../actions/messageActions'; import { getTutorial, resetTutorial, tutorialStep } from '../../actions/tutorialActions'; import Breadcrumbs from '../Breadcrumbs'; import StepperHorizontal from './StepperHorizontal'; import StepperVertical from './StepperVertical'; import Instruction from './Instruction'; import Assessment from './Assessment'; import NotFound from '../NotFound'; import { detectWhitespacesAndReturnReadableResult } from '../../helpers/whitespace'; // import tutorials from '../../data/tutorials'; import Card from '@material-ui/core/Card'; import Button from '@material-ui/core/Button'; import LinearProgress from '@material-ui/core/LinearProgress'; class Tutorial extends Component { componentDidMount() { this.props.getTutorial(this.props.match.params.tutorialId); // this.props.tutorialId(Number(this.props.match.params.tutorialId)); } componentDidUpdate(props, state) { if (props.tutorial.id && !props.isLoading && Number(props.tutorial.id) !== Number(this.props.match.params.tutorialId)) { this.props.getTutorial(this.props.match.params.tutorialId); // this.props.tutorialId(Number(this.props.match.params.tutorialId)); } if(this.props.message.id === 'GET_TUTORIAL_FAIL'){ alert(this.props.message.msg); this.props.clearMessages(); } } componentWillUnmount() { this.props.resetTutorial(); this.props.workspaceName(null); if(this.props.message.msg){ this.props.clearMessages(); } } render() { return (