import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import clsx from 'clsx'; import tutorials from '../../data/tutorials.json'; import { fade } from '@material-ui/core/styles/colorManipulator'; import { withStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import Tooltip from '@material-ui/core/Tooltip'; import Button from '@material-ui/core/Button'; import { faCheck, faTimes } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; const styles = (theme) => ({ stepper: { width: 'calc(100% - 40px)', height: '40px', borderRadius: '25px', padding: '0 20px', margin: '20px 0', display: 'flex', justifyContent: 'space-between' }, stepperSuccess: { backgroundColor: fade(theme.palette.primary.main, 0.6), }, stepperError: { backgroundColor: fade(theme.palette.error.dark, 0.6), }, stepperOther: { backgroundColor: fade(theme.palette.secondary.main, 0.6), }, color: { backgroundColor: 'transparent ' }, iconDivSuccess: { color: theme.palette.primary.main }, iconDivError: { color: theme.palette.error.dark } }); class StepperHorizontal extends Component { render() { var tutorialId = this.props.currentTutorialId; var status = this.props.status.filter(status => status.id === tutorialId)[0]; var tasks = status.tasks; var error = tasks.filter(task => task.type === 'error').length > 0; var success = tasks.filter(task => task.type === 'success').length / tasks.length; var tutorialStatus = success === 1 ? 'Success' : error ? 'Error' : 'Other'; var title = tutorials.filter(tutorial => tutorial.id === tutorialId)[0].title; return (