precondition for each tutorial is at least one instruction and one task

This commit is contained in:
Delucse
2020-09-28 15:41:17 +02:00
parent 4a5d24f2d1
commit 8d752e0430
4 changed files with 22 additions and 8 deletions
+8 -1
View File
@@ -19,11 +19,15 @@ import Button from '@material-ui/core/Button';
import Backdrop from '@material-ui/core/Backdrop';
import CircularProgress from '@material-ui/core/CircularProgress';
import Divider from '@material-ui/core/Divider';
import FormHelperText from '@material-ui/core/FormHelperText';
const styles = (theme) => ({
backdrop: {
zIndex: theme.zIndex.drawer + 1,
color: '#fff',
},
errorColor: {
color: theme.palette.error.dark
}
});
@@ -138,9 +142,12 @@ class Builder extends Component {
</label>
<Button style={{marginRight: '10px', marginBottom: '10px'}} variant='contained' color='primary' onClick={() => this.uploadJsonString()}>String laden</Button>
</div>
<Divider variant='fullWidth' style={{margin: '10px 0 30px 0'}}/>
<Divider variant='fullWidth' style={{margin: '10px 0 15px 0'}}/>
{/*Tutorial-Builder-Form*/}
{this.props.error.type ?
<FormHelperText style={{lineHeight: 'initial'}} className={this.props.classes.errorColor}>{`Ein Tutorial muss mindestens jeweils eine Instruktion und eine Aufgabe enthalten.`}</FormHelperText>
: null}
<Id error={this.props.error.id} value={this.props.id}/>
<Textfield value={this.props.title} property={'title'} label={'Titel'} error={this.props.error.title}/>
+1 -1
View File
@@ -58,7 +58,7 @@ class Id extends Component {
render() {
return (
<div style={{display: 'inline-flex'}}>
<div style={{display: 'inline-flex', marginTop: '15px'}}>
<FormControl variant="outlined" style={{marginBottom: '10px', width: '250px'}}>
<InputLabel
htmlFor="id"
+7 -3
View File
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { changeContent, deleteProperty } from '../../../actions/tutorialBuilderActions';
import { changeContent, deleteProperty, deleteError } from '../../../actions/tutorialBuilderActions';
import Radio from '@material-ui/core/Radio';
import RadioGroup from '@material-ui/core/RadioGroup';
@@ -13,6 +13,9 @@ class StepType extends Component {
this.props.changeContent(this.props.index, 'type', value);
// delete property 'xml', so that all used blocks are reset
this.props.deleteProperty(this.props.index, 'xml');
if(value === 'task'){
this.props.deleteError(undefined, 'type');
}
}
render() {
@@ -38,7 +41,8 @@ class StepType extends Component {
StepType.propTypes = {
changeContent: PropTypes.func.isRequired,
deleteProperty: PropTypes.func.isRequired
deleteProperty: PropTypes.func.isRequired,
deleteError: PropTypes.func.isRequired
};
export default connect(null, { changeContent, deleteProperty })(StepType);
export default connect(null, { changeContent, deleteProperty, deleteError })(StepType);