add hidden hints button
This commit is contained in:
@@ -226,44 +226,54 @@ function PlayableLevel({worldId, levelId}) {
|
|||||||
return <>
|
return <>
|
||||||
<div style={level.isLoading ? null : {display: "none"}} className="app-content loading"><CircularProgress /></div>
|
<div style={level.isLoading ? null : {display: "none"}} className="app-content loading"><CircularProgress /></div>
|
||||||
<InputModeContext.Provider value={{commandLineMode, setCommandLineMode, commandLineInput, setCommandLineInput}}>
|
<InputModeContext.Provider value={{commandLineMode, setCommandLineMode, commandLineInput, setCommandLineInput}}>
|
||||||
|
<HintContext.Provider value={{showHiddenHints, setShowHiddenHints, hints, setHints}}>
|
||||||
<LevelAppBar isLoading={level.isLoading} levelTitle={levelTitle} worldId={worldId} levelId={levelId} />
|
<LevelAppBar isLoading={level.isLoading} levelTitle={levelTitle} worldId={worldId} levelId={levelId} />
|
||||||
<Split minSize={0} snapOffset={200} sizes={[25, 50, 25]} className={`app-content level ${level.isLoading ? 'hidden' : ''}`}>
|
<Split minSize={0} snapOffset={200} sizes={[25, 50, 25]} className={`app-content level ${level.isLoading ? 'hidden' : ''}`}>
|
||||||
<div ref={chatPanelRef} className="chat-panel">
|
<div ref={chatPanelRef} className="chat-panel">
|
||||||
<HintContext.Provider value={{showHiddenHints, setShowHiddenHints, hints, setHints}}>
|
<div className="chat">
|
||||||
{level?.data?.introduction &&
|
{level?.data?.introduction &&
|
||||||
<div className="message info">
|
|
||||||
<Markdown>{level?.data?.introduction}</Markdown>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
{/* {openHints.map(hint => <Hint hint={hint} />)}
|
|
||||||
{hiddenHints.length > 0 &&
|
|
||||||
<FormControlLabel
|
|
||||||
control={<Switch checked={showHints} onChange={() => setShowHints((prev) => !prev)} />}
|
|
||||||
label="I need help!"
|
|
||||||
/>}
|
|
||||||
{showHints && hiddenHints.map(hint => <Hint hint={hint} />)} */}
|
|
||||||
{hints.map(hint =>
|
|
||||||
<div className="message info"><Markdown>{hint.text}</Markdown></div>)
|
|
||||||
}
|
|
||||||
{completed &&
|
|
||||||
<>
|
|
||||||
<div className="message info">
|
<div className="message info">
|
||||||
Level completed! 🎉
|
<Markdown>{level?.data?.introduction}</Markdown>
|
||||||
</div>
|
</div>
|
||||||
{level?.data?.conclusion?.trim() &&
|
}
|
||||||
|
{/* {openHints.map(hint => <Hint hint={hint} />)}
|
||||||
|
{hiddenHints.length > 0 &&
|
||||||
|
<FormControlLabel
|
||||||
|
control={<Switch checked={showHints} onChange={() => setShowHints((prev) => !prev)} />}
|
||||||
|
label="I need help!"
|
||||||
|
/>}
|
||||||
|
{showHints && hiddenHints.map(hint => <Hint hint={hint} />)} */}
|
||||||
|
{hints.map(hint =>
|
||||||
|
<div className="message info"><Markdown>{hint.text}</Markdown></div>)
|
||||||
|
}
|
||||||
|
{completed &&
|
||||||
|
<>
|
||||||
<div className="message info">
|
<div className="message info">
|
||||||
<Markdown>{level?.data?.conclusion}</Markdown>
|
Level completed! 🎉
|
||||||
</div>
|
</div>
|
||||||
}
|
{level?.data?.conclusion?.trim() &&
|
||||||
{/* { hints.map(hint => <div className="message info"><Markdown>{hint.text}</Markdown></div>) } */}
|
<div className="message info">
|
||||||
<Hints hints={hints} showHidden={showHiddenHints}/>
|
<Markdown>{level?.data?.conclusion}</Markdown>
|
||||||
{levelId >= gameInfo.data?.worldSize[worldId] ?
|
</div>
|
||||||
<Button to={`/${gameId}`}><FontAwesomeIcon icon={faHome} /></Button> :
|
}
|
||||||
<Button to={`/${gameId}/world/${worldId}/level/${levelId + 1}`}>
|
{levelId >= gameInfo.data?.worldSize[worldId] ?
|
||||||
Next <FontAwesomeIcon icon={faArrowRight} /></Button>}
|
<Button to={`/${gameId}`}><FontAwesomeIcon icon={faHome} /></Button> :
|
||||||
</>
|
<Button to={`/${gameId}/world/${worldId}/level/${levelId + 1}`}>
|
||||||
}
|
Next <FontAwesomeIcon icon={faArrowRight} /></Button>}
|
||||||
</HintContext.Provider>
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
|
{/* { hints.map(hint => <div className="message info"><Markdown>{hint.text}</Markdown></div>) } */}
|
||||||
|
<Hints hints={hints} showHidden={showHiddenHints}/>
|
||||||
|
{/* TODO: Remove this debugging message: */}
|
||||||
|
{showHiddenHints && <p>Hidden Hints are displayed</p>}
|
||||||
|
</div>
|
||||||
|
<div className="toggle-hidden-hints">
|
||||||
|
<FormControlLabel
|
||||||
|
control={<Switch checked={showHiddenHints} onChange={() => setShowHiddenHints((prev) => !prev)} />}
|
||||||
|
label="Show more help!"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="exercise-panel">
|
<div className="exercise-panel">
|
||||||
<EditorContext.Provider value={editorConnection}>
|
<EditorContext.Provider value={editorConnection}>
|
||||||
@@ -294,6 +304,7 @@ function PlayableLevel({worldId, levelId}) {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</Split>
|
</Split>
|
||||||
|
</HintContext.Provider>
|
||||||
</InputModeContext.Provider>
|
</InputModeContext.Provider>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,3 +171,14 @@ td code {
|
|||||||
border: 1px solid rgb(255, 0, 0);
|
border: 1px solid rgb(255, 0, 0);
|
||||||
margin: 1px;
|
margin: 1px;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
.chat {
|
||||||
|
height: calc(100% - 3.5em);
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-hidden-hints {
|
||||||
|
width:100%;
|
||||||
|
height: 3.5em;
|
||||||
|
border-top: 0.1em solid #aaa;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user