fix vertical stepper bug

This commit is contained in:
Delucse
2020-10-17 09:47:03 +02:00
parent b310d290cf
commit a0fd63a2ca
15 changed files with 39 additions and 106 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ import FormLabel from '@material-ui/core/FormLabel';
const styles = theme => ({
multiGridListTile: {
background: "#4EAF47",
background: theme.palette.primary.main,
opacity: 0.9,
height: '30px'
},
+2 -2
View File
@@ -27,7 +27,7 @@ const styles = theme => ({
color: theme.palette.text.primary
},
multiGridListTile: {
background: "#4EAF47",
background: theme.palette.primary.main,
opacity: 0.9,
height: '30px'
},
@@ -95,7 +95,7 @@ class Hardware extends Component {
>
<div>
<img src={`/media/hardware/${this.state.hardwareInfo.src}`} width="100%" alt={this.state.hardwareInfo.name} />
Weitere Informationen zur Hardware-Komponente findest du <Link href={this.state.hardwareInfo.url} color="primary">hier</Link>.
Weitere Informationen zur Hardware-Komponente findest du <Link rel="noreferrer" target="_blank" href={this.state.hardwareInfo.url} color="primary">hier</Link>.
</div>
</Dialog>
+9 -6
View File
@@ -51,6 +51,7 @@ class StepperHorizontal extends Component {
render() {
var tutorialId = this.props.currentTutorialId;
var tutorialIndex = this.props.currentTutorialIndex;
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;
@@ -69,8 +70,8 @@ class StepperHorizontal extends Component {
: null}
<div className={this.props.classes.stepper}>
<Button
disabled={tutorialId === 1}
onClick={() => { this.props.history.push(`/tutorial/${tutorialId - 1}`) }}
disabled={tutorialIndex === 0}
onClick={() => { this.props.history.push(`/tutorial/${tutorials[tutorialIndex - 1].id}`) }}
>
{'<'}
</Button>
@@ -81,8 +82,8 @@ class StepperHorizontal extends Component {
</div>
</Tooltip>
<Button
disabled={tutorialId + 1 > tutorials.length}
onClick={() => { this.props.history.push(`/tutorial/${tutorialId + 1}`) }}
disabled={tutorialIndex + 1 === tutorials.length}
onClick={() => { this.props.history.push(`/tutorial/${tutorials[tutorialIndex + 1].id}`) }}
>
{'>'}
</Button>
@@ -95,13 +96,15 @@ class StepperHorizontal extends Component {
StepperHorizontal.propTypes = {
status: PropTypes.array.isRequired,
change: PropTypes.number.isRequired,
currentTutorialId: PropTypes.number.isRequired
currentTutorialId: PropTypes.number.isRequired,
currentTutorialIndex: PropTypes.number.isRequired
};
const mapStateToProps = state => ({
change: state.tutorial.change,
status: state.tutorial.status,
currentTutorialId: state.tutorial.currentId
currentTutorialId: state.tutorial.currentId,
currentTutorialIndex: state.tutorial.currentIndex
});
export default connect(mapStateToProps, null)(withRouter(withStyles(styles, { withTheme: true })(StepperHorizontal)));