diff --git a/src/components/Navbar.js b/src/components/Navbar.js index 743a245..a7137ed 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -1,4 +1,6 @@ import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import senseboxLogo from './sensebox_logo.svg'; @@ -16,6 +18,7 @@ import IconButton from '@material-ui/core/IconButton'; import ListItem from '@material-ui/core/ListItem'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; +import LinearProgress from '@material-ui/core/LinearProgress'; import { faBars, faChevronLeft, faBuilding, faIdCard, faEnvelope, faCog, faChalkboardTeacher, faFolderPlus, faTools, faLightbulb } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -50,7 +53,7 @@ class Navbar extends Component {
@@ -115,9 +118,20 @@ class Navbar extends Component { ))} */} + {this.props.isLoading ? + + : null}
); } } -export default withStyles(styles, { withTheme: true })(withRouter(Navbar)); +Navbar.propTypes = { + isLoading: PropTypes.bool.isRequired +}; + +const mapStateToProps = state => ({ + isLoading: state.tutorial.progress, +}); + +export default connect(mapStateToProps, null)(withStyles(styles, { withTheme: true })(withRouter(Navbar))); diff --git a/src/components/Tutorial/Tutorial.js b/src/components/Tutorial/Tutorial.js index 81440d3..784d2a4 100644 --- a/src/components/Tutorial/Tutorial.js +++ b/src/components/Tutorial/Tutorial.js @@ -17,7 +17,6 @@ import { detectWhitespacesAndReturnReadableResult } from '../../helpers/whitespa 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 { @@ -49,7 +48,7 @@ class Tutorial extends Component { console.log(this.props.tutorial); return (
- {this.props.isLoading ? : + {this.props.isLoading ? null : !this.props.tutorial ? : (() => { var tutorial = this.props.tutorial; diff --git a/src/components/Tutorial/TutorialHome.js b/src/components/Tutorial/TutorialHome.js index ff6bccd..b010e2f 100644 --- a/src/components/Tutorial/TutorialHome.js +++ b/src/components/Tutorial/TutorialHome.js @@ -15,7 +15,6 @@ import { withStyles } from '@material-ui/core/styles'; import Grid from '@material-ui/core/Grid'; import Paper from '@material-ui/core/Paper'; import Typography from '@material-ui/core/Typography'; -import LinearProgress from '@material-ui/core/LinearProgress'; import { faCheck, faTimes } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -72,7 +71,7 @@ class TutorialHome extends Component { render() { return ( - this.props.isLoading ? : + this.props.isLoading ? null :