From 75f356f4b28288a4e3fbe9a7efe1141a1a43bdaf Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Mon, 6 Mar 2023 18:07:09 +0100 Subject: [PATCH] Add World introduction and change layout --- client/src/components/Level.tsx | 60 ++++++++++++++++++- client/src/components/Welcome.tsx | 2 +- client/src/components/infoview/info.tsx | 6 +- client/src/components/infoview/infoview.css | 4 ++ client/src/components/level.css | 19 +++--- client/src/state/api.ts | 2 +- .../leanserver/GameServer/EnvExtensions.lean | 5 +- 7 files changed, 77 insertions(+), 21 deletions(-) diff --git a/client/src/components/Level.tsx b/client/src/components/Level.tsx index 0df2125..8adcc80 100644 --- a/client/src/components/Level.tsx +++ b/client/src/components/Level.tsx @@ -39,6 +39,7 @@ import { styled, useTheme, Theme, CSSObject } from '@mui/material/styles'; import Markdown from './Markdown'; import Split from 'react-split' +import { Alert } from '@mui/material'; export const MonacoEditorContext = React.createContext(null as any); @@ -129,7 +130,50 @@ function Level() { const completed = useAppSelector(selectCompleted(worldId, levelId)) const {editor, infoProvider, editorConnection} = - useLevelEditor(worldId, levelId, codeviewRef, initialCode, onDidChangeContent) + useLevelEditor(worldId, levelId, codeviewRef, initialCode, onDidChangeContent) + + // TODO: This is a hack for having an introduction (i.e. level 0) + // for each world. + if (levelId == 0) { + return <> +
+
+ + + {gameInfo.data?.worlds.nodes[worldId].title && `World: ${gameInfo.data?.worlds.nodes[worldId].title}`} + +
+
+ + {`Einführung`} + + + +
+
+
+
+ + + {gameInfo.data?.worlds.nodes[worldId].introduction} + + +
+
+
+ {levelId >= gameInfo.data?.worldSize[worldId] ? + : + } +
+
+ + } return <>
@@ -144,7 +188,7 @@ function Level() { {levelId && `Level ${levelId}`}{level?.data?.title && `: ${level?.data?.title}`} -