diff --git a/client/src/App.tsx b/client/src/App.tsx index bbdbc11..db553a2 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -44,7 +44,7 @@ function App() { if (finished) { mainComponent = } else if (curLevel > 0) { - mainComponent = + mainComponent = } else { mainComponent = } diff --git a/client/src/components/Level.tsx b/client/src/components/Level.tsx index 57e734a..44a5d3c 100644 --- a/client/src/components/Level.tsx +++ b/client/src/components/Level.tsx @@ -99,6 +99,8 @@ function Level({ nbLevels, level, setCurLevel, setLevelTitle, setFinished }: Lev setEditor(editor) setInfoProvider(infoProvider) setInfoviewApi(infoviewApi) + + return () => { editor.dispose() } }, []) // The next function will be called when the level changes @@ -129,40 +131,12 @@ function Level({ nbLevels, level, setCurLevel, setLevelTitle, setFinished }: Lev } }, [editor, level, leanClient]) - function sendTactic(input) { - leanClient.sendRequest("runTactic", {tactic: input}).then(processResponse); - setLastTactic(input); - setHistory(history.concat([input])); - } - - function undo() { - if (errors.length === 0) { - leanClient.sendRequest('undo', {}).then(processResponse); - } - if (history.length > 1) { - setLastTactic(history[history.length - 1]); - } else { - setLastTactic(""); - }; - setErrors([]); - setHistory(history.slice(0, -1)); - } - function loadLevel(index) { setCompleted(false) setHistory([]) setCurLevel(index) } - function closeMessage() { - setMessageOpen(false) - } - - function finishGame() { - setLevelTitle("") - setFinished(true) - } - return (