display level conclusion

pull/54/head
Alexander Bentkamp 2 years ago
parent 6644fc6431
commit e8b6770bab

@ -22,7 +22,7 @@ import './level.css'
import { Button } from './Button'
import { ConnectionContext, useLeanClient } from '../connection';
import { useGetGameInfoQuery, useLoadLevelQuery } from '../state/api';
import { codeEdited, selectCode, progressSlice } from '../state/progress';
import { codeEdited, selectCode, progressSlice, selectCompleted } from '../state/progress';
import { useAppDispatch, useAppSelector } from '../hooks';
import { useStore } from 'react-redux';
@ -126,6 +126,7 @@ function Level() {
setCanUndo(code.trim() !== "")
}
const completed = useAppSelector(selectCompleted(worldId, levelId))
const {editor, infoProvider, editorConnection} =
useLevelEditor(worldId, levelId, codeviewRef, initialCode, onDidChangeContent)
@ -179,6 +180,8 @@ function Level() {
</InputModeContext.Provider>
</MonacoEditorContext.Provider>
</EditorContext.Provider>
{completed && <div className="conclusion"><Markdown>{level?.data?.conclusion}</Markdown></div>}
</div>
<div className="doc-panel">
{!level.isLoading && <Inventory tactics={level?.data?.tactics} lemmas={level?.data?.lemmas} definitions={level?.data?.definitions} />}

@ -43,6 +43,10 @@
padding: 1em;
}
.conclusion {
padding: 1em;
}
.exercise {
flex: 1 1 auto;
display: flex;

@ -20,6 +20,7 @@ export interface ComputedInventoryItem {
interface LevelInfo {
title: null|string,
introduction: null|string,
conclusion: null|string,
index: number,
tactics: ComputedInventoryItem[],
lemmas: ComputedInventoryItem[],

@ -46,6 +46,7 @@ structure LevelInfo where
lemmas : Array ComputedInventoryItem
definitions : Array ComputedInventoryItem
introduction : String
conclusion : String
descrText : String := ""
descrFormat : String := ""
deriving ToJson, FromJson
@ -125,7 +126,8 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
definitions := lvl.definitions.computed,
descrText := lvl.descrText,
descrFormat := lvl.descrFormat --toExpr <| format (lvl.goal.raw) --toString <| Syntax.formatStx (lvl.goal.raw) --Syntax.formatStx (lvl.goal.raw) , -- TODO
introduction := lvl.introduction }
introduction := lvl.introduction
conclusion := lvl.conclusion }
c.hOut.writeLspResponse ⟨id, ToJson.toJson levelInfo⟩
return true
| Message.request id "loadDoc" params =>

Loading…
Cancel
Save