From 90062a217c02f4cba19adf1d831041df681cc6ad Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Thu, 30 Mar 2023 18:56:32 +0200 Subject: [PATCH] do not show empty introductions/conclusions --- client/src/components/Level.tsx | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/client/src/components/Level.tsx b/client/src/components/Level.tsx index 4fa29b3..c4abd1f 100644 --- a/client/src/components/Level.tsx +++ b/client/src/components/Level.tsx @@ -86,6 +86,7 @@ function PlayableLevel({worldId, levelId}) { const theme = useTheme(); + useEffect(() => { // Scroll to top when loading a new level introductionPanelRef.current!.scrollTo(0,0) @@ -180,9 +181,11 @@ function PlayableLevel({worldId, levelId}) {
-
- {level?.data?.introduction} -
+ {level?.data?.introduction && +
+ {level?.data?.introduction} +
+ }
{/*

Aufgabe:

*/} @@ -206,9 +209,11 @@ function PlayableLevel({worldId, levelId}) { {completed &&
-
- {level?.data?.conclusion} -
+ {level?.data?.conclusion && +
+ {level?.data?.conclusion} +
+ } {levelId >= gameInfo.data?.worldSize[worldId] ? :