level navigation

pull/43/head
Alexander Bentkamp 2 years ago
parent 8fd6b3e015
commit 43d671713d

@ -135,10 +135,10 @@ function Level({ leanClient, nbLevels, level, setCurLevel, setLevelTitle, setFin
setHistory(history.slice(0, -1)); setHistory(history.slice(0, -1));
} }
function loadNextLevel() { function loadLevel(index) {
setCompleted(false) setCompleted(false)
setHistory([]) setHistory([])
setCurLevel(index + 1) setCurLevel(index)
} }
function closeMessage() { function closeMessage() {
@ -163,7 +163,8 @@ function Level({ leanClient, nbLevels, level, setCurLevel, setLevelTitle, setFin
</Grid> </Grid>
<Grid xs={4}> <Grid xs={4}>
<div ref={infoviewRef} className="infoview"></div> <div ref={infoviewRef} className="infoview"></div>
<Button onClick={loadNextLevel} sx={{ ml: 3, mt: 2, mb: 2 }} disableFocusRipple>Go to Next Level</Button> {index > 1 ? <Button onClick={() => { loadLevel(index - 1) }} sx={{ ml: 3, mt: 2, mb: 2 }} disableFocusRipple>Previous Level</Button> : null}
{index < nbLevels ? <Button onClick={() => { loadLevel(index + 1) }} sx={{ ml: 3, mt: 2, mb: 2 }} disableFocusRipple>Next Level</Button> : null}
{/* <TacticState goals={leanData.goals} errors={errors} lastTactic={lastTactic} completed={completed} /> */} {/* <TacticState goals={leanData.goals} errors={errors} lastTactic={lastTactic} completed={completed} /> */}
</Grid> </Grid>
</Grid> </Grid>

Loading…
Cancel
Save