do not show empty introductions/conclusions

pull/68/head
Jon Eugster 3 years ago
parent 2e4161ca7a
commit 90062a217c

@ -86,6 +86,7 @@ function PlayableLevel({worldId, levelId}) {
const theme = useTheme(); const theme = useTheme();
useEffect(() => { useEffect(() => {
// Scroll to top when loading a new level // Scroll to top when loading a new level
introductionPanelRef.current!.scrollTo(0,0) introductionPanelRef.current!.scrollTo(0,0)
@ -180,9 +181,11 @@ function PlayableLevel({worldId, levelId}) {
<Split minSize={0} snapOffset={200} sizes={[50, 25, 25]} className={`app-content level ${level.isLoading ? 'hidden' : ''}`}> <Split minSize={0} snapOffset={200} sizes={[50, 25, 25]} className={`app-content level ${level.isLoading ? 'hidden' : ''}`}>
<div className="exercise-panel"> <div className="exercise-panel">
<div ref={introductionPanelRef} className="introduction-panel"> <div ref={introductionPanelRef} className="introduction-panel">
<div className="message info"> {level?.data?.introduction &&
<Markdown>{level?.data?.introduction}</Markdown> <div className="message info">
</div> <Markdown>{level?.data?.introduction}</Markdown>
</div>
}
</div> </div>
<div className="exercise"> <div className="exercise">
{/* <h4>Aufgabe:</h4> */} {/* <h4>Aufgabe:</h4> */}
@ -206,9 +209,11 @@ function PlayableLevel({worldId, levelId}) {
</EditorContext.Provider> </EditorContext.Provider>
{completed && <div className="conclusion"> {completed && <div className="conclusion">
<div className="message info"> {level?.data?.conclusion &&
<Markdown>{level?.data?.conclusion}</Markdown> <div className="message info">
</div> <Markdown>{level?.data?.conclusion}</Markdown>
</div>
}
{levelId >= gameInfo.data?.worldSize[worldId] ? {levelId >= gameInfo.data?.worldSize[worldId] ?
<Button to={`/game/${gameId}`}><FontAwesomeIcon icon={faHome} /></Button> : <Button to={`/game/${gameId}`}><FontAwesomeIcon icon={faHome} /></Button> :
<Button to={`/game/${gameId}/world/${worldId}/level/${levelId + 1}`}> <Button to={`/game/${gameId}/world/${worldId}/level/${levelId + 1}`}>
@ -238,11 +243,13 @@ function Introduction({worldId}) {
<LevelAppBar isLoading={gameInfo.isLoading} levelTitle="Einführung" worldId={worldId} levelId={0} /> <LevelAppBar isLoading={gameInfo.isLoading} levelTitle="Einführung" worldId={worldId} levelId={0} />
<div style={gameInfo.isLoading ? {display: "none"} : null} className="exercise-panel"> <div style={gameInfo.isLoading ? {display: "none"} : null} className="exercise-panel">
<div className="introduction-panel"> <div className="introduction-panel">
<div className="message info"> { gameInfo.data?.worlds.nodes[worldId].introduction &&
<Markdown> <div className="message info">
{gameInfo.data?.worlds.nodes[worldId].introduction} <Markdown>
</Markdown> {gameInfo.data?.worlds.nodes[worldId].introduction}
</div> </Markdown>
</div>
}
</div> </div>
<div className="conclusion"> <div className="conclusion">
{0 == gameInfo.data?.worldSize[worldId] ? {0 == gameInfo.data?.worldSize[worldId] ?

Loading…
Cancel
Save