From 46d0a41f267099e91ef6819c28540a946ef8dc74 Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Sun, 18 Jun 2023 09:04:57 +0200 Subject: [PATCH] move input context --- client/src/components/Level.tsx | 127 ++++++++++++++++---------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/client/src/components/Level.tsx b/client/src/components/Level.tsx index 1953780..898955a 100644 --- a/client/src/components/Level.tsx +++ b/client/src/components/Level.tsx @@ -192,7 +192,6 @@ function PlayableLevel({worldId, levelId}) { // If this state is set to a pair `(name, type)` then the according doc will be open. const [inventoryDoc, setInventoryDoc] = useState<{name: string, type: string}>(null) - // TODO: This seems like a useless wrapper to me function openInventoryDoc(name, type) { setInventoryDoc({name, type}) } @@ -204,75 +203,75 @@ function PlayableLevel({worldId, levelId}) { return <>
- - -
- {level?.data?.introduction && -
- {level?.data?.introduction} -
- } - {hints.map(hint => -
{hint.text}
) - } - {completed && - <> + + + +
+ {level?.data?.introduction &&
- Level completed! 🎉 + {level?.data?.introduction}
- {level?.data?.conclusion?.trim() && + } + {hints.map(hint => +
{hint.text}
) + } + {completed && + <>
- {level?.data?.conclusion} + Level completed! 🎉
- } - { hints.map(hint =>
{hint.text}
) } - {levelId >= gameInfo.data?.worldSize[worldId] ? - : - } - - } -
-
-
- - {(level?.data?.statementName ? - `**Theorem** \`${level?.data?.statementName}\`: ` - : - level?.data?.descrText && "**Exercise**: ") - + `${level?.data?.descrText}` - } - -
{level?.data?.descrFormat}
-
-
-
- {commandLineMode && } - - { setCommandLineMode(!commandLineMode) }} />} label="Editor mode" /> - + {level?.data?.conclusion?.trim() && +
+ {level?.data?.conclusion} +
+ } + { hints.map(hint =>
{hint.text}
) } + {levelId >= gameInfo.data?.worldSize[worldId] ? + : + } + + }
+
+
+ + {(level?.data?.statementName ? + `**Theorem** \`${level?.data?.statementName}\`: ` + : + level?.data?.descrText && "**Exercise**: ") + + `${level?.data?.descrText}` + } + +
{level?.data?.descrFormat}
+
+
+
+ {commandLineMode && } + + { setCommandLineMode(!commandLineMode) }} />} label="Editor mode" /> + +
- - - - - {editorConnection &&
} - - - - -
-
- {!level.isLoading && - <>{inventoryDoc ? - - : - - } - } -
- + + + + {editorConnection &&
} + + + +
+
+ {!level.isLoading && + <>{inventoryDoc ? + + : + + } + } +
+
+
}