move editor mode toggle

pull/118/head
Jon Eugster 3 years ago
parent 46d0a41f26
commit 04b7bb3539

@ -248,9 +248,6 @@ function PlayableLevel({worldId, levelId}) {
</div> </div>
<div className="input-mode-switch"> <div className="input-mode-switch">
{commandLineMode && <button className="btn" onClick={handleUndo} disabled={!canUndo}><FontAwesomeIcon icon={faRotateLeft} /> Undo</button>} {commandLineMode && <button className="btn" onClick={handleUndo} disabled={!canUndo}><FontAwesomeIcon icon={faRotateLeft} /> Undo</button>}
<FormGroup>
<FormControlLabel control={<Switch onChange={(ev) => { setCommandLineMode(!commandLineMode) }} />} label="Editor mode" />
</FormGroup>
</div> </div>
<HintContext.Provider value={{hints, setHints}}> <HintContext.Provider value={{hints, setHints}}>
@ -307,6 +304,8 @@ function LevelAppBar({isLoading, levelId, worldId, levelTitle}) {
const gameId = React.useContext(GameIdContext) const gameId = React.useContext(GameIdContext)
const gameInfo = useGetGameInfoQuery({game: gameId}) const gameInfo = useGetGameInfoQuery({game: gameId})
const { commandLineMode, setCommandLineMode } = React.useContext(InputModeContext)
return <div className="app-bar" style={isLoading ? {display: "none"} : null} > return <div className="app-bar" style={isLoading ? {display: "none"} : null} >
<div> <div>
<Button to={`/${gameId}`}><FontAwesomeIcon icon={faHome} /></Button> <Button to={`/${gameId}`}><FontAwesomeIcon icon={faHome} /></Button>
@ -318,6 +317,8 @@ function LevelAppBar({isLoading, levelId, worldId, levelTitle}) {
<span className="app-bar-title"> <span className="app-bar-title">
{levelTitle} {levelTitle}
</span> </span>
<Button disabled={levelId <= 0} inverted={true} to=""
onClick={(ev) => { setCommandLineMode(!commandLineMode) }}>Editor</Button>
<Button disabled={levelId <= 0} inverted={true} <Button disabled={levelId <= 0} inverted={true}
to={`/${gameId}/world/${worldId}/level/${levelId - 1}`} to={`/${gameId}/world/${worldId}/level/${levelId - 1}`}
><FontAwesomeIcon icon={faArrowLeft} />&nbsp;Previous</Button> ><FontAwesomeIcon icon={faArrowLeft} />&nbsp;Previous</Button>

Loading…
Cancel
Save