displaying the status of the tutorial

This commit is contained in:
Delucse
2020-09-07 15:57:09 +02:00
parent b42e466304
commit 4c66ab9173
9 changed files with 229 additions and 54 deletions
+9 -1
View File
@@ -1,4 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { tutorialCheck } from '../../actions/tutorialActions';
import * as Blockly from 'blockly/core';
@@ -49,6 +52,7 @@ class SolutionCheck extends Component {
check = () => {
const workspace = Blockly.getMainWorkspace();
var msg = tutorials[this.props.tutorial].test(workspace);
this.props.tutorialCheck(this.props.tutorial, msg.type);
this.setState({ msg, open: true });
}
@@ -95,4 +99,8 @@ class SolutionCheck extends Component {
};
}
export default withRouter(withStyles(styles, {withTheme: true})(SolutionCheck));
SolutionCheck.propTypes = {
tutorialCheck: PropTypes.func.isRequired
};
export default connect(null, { tutorialCheck })(withRouter(withStyles(styles, {withTheme: true})(SolutionCheck)));