move next-level-buttons on mobile

pull/118/head
Jon Eugster 3 years ago
parent 1ce68fe7fe
commit 5e4a959c8a

@ -413,63 +413,67 @@ export function CommandLineInterface(props: { world: string, level: number, data
<div className="content" ref={proofPanelRef}> <div className="content" ref={proofPanelRef}>
<ExerciseStatement data={props.data} /> <ExerciseStatement data={props.data} />
<div className="tmp-pusher"></div> <div className="tmp-pusher"></div>
{proof.length ? proof.map((step, i) => { {proof.length ?
if (i == proof.length - 1 && hasInteractiveErrors(step.errors)) { <>
// if the last command contains an error, we only display the errors but not the {proof.map((step, i) => {
// entered command as it is still present in the command line. if (i == proof.length - 1 && hasInteractiveErrors(step.errors)) {
// TODO: Should not use index as key. // if the last command contains an error, we only display the errors but not the
return <div key={`proof-step-${i}`}> // entered command as it is still present in the command line.
<Errors errors={step.errors} commandLineMode={true} /> // TODO: Should not use index as key.
</div> return <div key={`proof-step-${i}`}>
} else { <Errors errors={step.errors} commandLineMode={true} />
return <div key={`proof-step-${i}`} className={`step step-${i}` + (selectedStep == i ? ' selected' : '')} onClick={toggleSelectStep(i)}>
<Command command={step.command} deleteProof={deleteProof(i)} />
<Errors errors={step.errors} commandLineMode={true} />
{mobile && i == 0 && props.data?.introduction &&
<div className={`message information step-0${selectedStep === 0 ? ' selected' : ''}`} onClick={toggleSelectStep(0)}>
<Markdown>{props.data?.introduction}</Markdown>
</div> </div>
} } else {
{mobile && <> return <div key={`proof-step-${i}`} className={`step step-${i}` + (selectedStep == i ? ' selected' : '')} onClick={toggleSelectStep(i)}>
<Hints key={`hints-${i}`} <Command command={step.command} deleteProof={deleteProof(i)} />
hints={step.hints} showHidden={showHelp.has(i)} step={i} <Errors errors={step.errors} commandLineMode={true} />
selected={selectedStep} toggleSelection={toggleSelectStep(i)}/> {mobile && i == 0 && props.data?.introduction &&
{i == proof.length - 1 && hasHiddenHints(proof.length - 1) && !showHelp.has(k - withErr) && <div className={`message information step-0${selectedStep === 0 ? ' selected' : ''}`} onClick={toggleSelectStep(0)}>
<Button className="btn btn-help" to="" onClick={activateHiddenHints}> <Markdown>{props.data?.introduction}</Markdown>
Show more help! </div>
</Button>
}
</>
}
<GoalsTab proofStep={step} />
{/* Show a message that there are no goals left */}
{!step.goals.length && (
<div className="message information">
{completed ?
<p>Level completed! 🎉</p> :
<p>
<b>no goals left</b><br />
<i>This probably means you solved the level with warnings or Lean encountered a parsing error.</i>
</p>
} }
</div> {mobile && <>
)} <Hints key={`hints-${i}`}
{completed && i == proof.length - 1 && hints={step.hints} showHidden={showHelp.has(i)} step={i}
<div className="button-row"> selected={selectedStep} toggleSelection={toggleSelectStep(i)}/>
{props.level >= props.worldSize ? {i == proof.length - 1 && hasHiddenHints(proof.length - 1) && !showHelp.has(k - withErr) &&
<Button to={`/${gameId}`}> <Button className="btn btn-help" to="" onClick={activateHiddenHints}>
<FontAwesomeIcon icon={faHome} />&nbsp;Leave World Show more help!
</Button> </Button>
: }
<Button to={`/${gameId}/world/${props.world}/level/${props.level + 1}`}> </>
Next&nbsp;<FontAwesomeIcon icon={faArrowRight} />
</Button>
} }
<GoalsTab proofStep={step} />
{/* Show a message that there are no goals left */}
{!step.goals.length && (
<div className="message information">
{completed ?
<p>Level completed! 🎉</p> :
<p>
<b>no goals left</b><br />
<i>This probably means you solved the level with warnings or Lean encountered a parsing error.</i>
</p>
}
</div>
)}
</div> </div>
} }
</div> })}
} {mobile && completed &&
}) : <CircularProgress />} <div className="button-row">
{props.level >= props.worldSize ?
<Button to={`/${gameId}`}>
<FontAwesomeIcon icon={faHome} />&nbsp;Leave World
</Button>
:
<Button to={`/${gameId}/world/${props.world}/level/${props.level + 1}`}>
Next&nbsp;<FontAwesomeIcon icon={faArrowRight} />
</Button>
}
</div>
}
</>
: <CircularProgress />}
</div> </div>
<CommandLine proofPanelRef={proofPanelRef} /> <CommandLine proofPanelRef={proofPanelRef} />
</div> </div>

Loading…
Cancel
Save