From e84b7825c8c1a6ee50c8d3bf51347f43e3a975fb Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Thu, 8 Jan 2026 22:56:56 +0100 Subject: [PATCH 1/2] fix: pass difficulty and inventory to server --- client/src/components/level.tsx | 10 ++++- package-lock.json | 77 ++++++++------------------------- 2 files changed, 26 insertions(+), 61 deletions(-) diff --git a/client/src/components/level.tsx b/client/src/components/level.tsx index e92e4875..d5edcb5d 100644 --- a/client/src/components/level.tsx +++ b/client/src/components/level.tsx @@ -233,6 +233,8 @@ function PlayableLevel() { const gameId = React.useContext(GameIdContext) const {worldId, levelId} = useContext(WorldLevelIdContext) const {mobile} = React.useContext(PreferencesContext) + const inventory: Array = useSelector(selectInventory(gameId)) + const difficulty: number = useSelector(selectDifficulty(gameId)) const dispatch = useAppDispatch() @@ -283,6 +285,12 @@ function PlayableLevel() { htmlElement: undefined, // The wrapper div for monaco vscode: { "editor.wordWrap": true, + }, + clientOptions: { + initializationOptions: { + difficulty: difficulty, + inventory: inventory, + } } }) @@ -433,7 +441,7 @@ function PlayableLevel() { disposed = true leanMonacoEditor.dispose() } - }, [options, infoviewRef, codeviewRef, initialCode, worldId, levelId]) + }, [options, infoviewRef, codeviewRef, initialCode, worldId, levelId, difficulty, inventory]) /** Unused. Was implementing an undo button, which has been replaced by `deleteProof` inside * `TypewriterInterface`. diff --git a/package-lock.json b/package-lock.json index e6166f1c..b9ecf0c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8744,6 +8744,7 @@ "version": "2.30.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dev": true, "dependencies": { "@babel/runtime": "^7.21.0" }, @@ -12434,21 +12435,24 @@ } }, "node_modules/lean4monaco": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/lean4monaco/-/lean4monaco-1.1.5.tgz", - "integrity": "sha512-4zU+HCdKlwe7LYAlkUcSEC2Nk9cpgIxv8yv43/I9h7SMIqG8KIV52O/mrqhzJpdMm6yjn2JuU7WgLGT0DEHhjQ==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lean4monaco/-/lean4monaco-1.1.6.tgz", + "integrity": "sha512-mVVjYlKmFAPJKLV5OsgMdeBQE7m6LtzSYFiYwDK1WigXuSPcQi4JiBbbofyy+1A/CvsxD2HWYBEYTs5O0xLQDg==", "license": "Apache-2.0", "dependencies": { "@leanprover/infoview": "~0.8.5", "@leanprover/infoview-api": "~0.7.0", "@leanprover/unicode-input": "~0.1.4", "@leanprover/unicode-input-component": "~0.1.4", - "concurrently": "^8.2.2", "import-meta-resolve": "^4.1.0", + "lodash": "^4.17.21", "memfs": "^4.9.3", "monaco-editor-wrapper": "^5.3.1", "semver": "^7.6.2", - "zod": "^3.22.4" + "zod": "^4.3.5" + }, + "engines": { + "node": "25.x" } }, "node_modules/lean4monaco/node_modules/@leanprover/infoview": { @@ -12473,42 +12477,6 @@ "integrity": "sha512-2h6c+VWxu9MV1CKternaoFzoaXI6qQAOAzsGiqw/10e3koG5BpX8Rz7N6uQntB1/Y45HQQo6r2ztoODjttjkZg==", "license": "Apache-2.0" }, - "node_modules/lean4monaco/node_modules/concurrently": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", - "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", - "license": "MIT", - "dependencies": { - "chalk": "^4.1.2", - "date-fns": "^2.30.0", - "lodash": "^4.17.21", - "rxjs": "^7.8.1", - "shell-quote": "^1.8.1", - "spawn-command": "0.0.2", - "supports-color": "^8.1.1", - "tree-kill": "^1.2.2", - "yargs": "^17.7.2" - }, - "bin": { - "conc": "dist/bin/concurrently.js", - "concurrently": "dist/bin/concurrently.js" - }, - "engines": { - "node": "^14.13.0 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" - } - }, - "node_modules/lean4monaco/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/lean4monaco/node_modules/semver": { "version": "7.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", @@ -12521,21 +12489,6 @@ "node": ">=10" } }, - "node_modules/lean4monaco/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -17560,6 +17513,7 @@ "version": "7.8.2", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, "license": "Apache-2.0", "dependencies": { "tslib": "^2.1.0" @@ -18084,7 +18038,8 @@ "node_modules/spawn-command": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", - "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==" + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", + "dev": true }, "node_modules/speech-rule-engine": { "version": "4.1.2", @@ -18771,6 +18726,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, "bin": { "tree-kill": "cli.js" } @@ -20278,9 +20234,10 @@ } }, "node_modules/zod": { - "version": "3.22.4", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", - "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.5.tgz", + "integrity": "sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } From c911b84ae7008ed6cd8a917ae547613233c7a860 Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Thu, 8 Jan 2026 23:17:48 +0100 Subject: [PATCH 2/2] fix --- client/src/components/level.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/level.tsx b/client/src/components/level.tsx index d5edcb5d..a2d364ff 100644 --- a/client/src/components/level.tsx +++ b/client/src/components/level.tsx @@ -441,7 +441,7 @@ function PlayableLevel() { disposed = true leanMonacoEditor.dispose() } - }, [options, infoviewRef, codeviewRef, initialCode, worldId, levelId, difficulty, inventory]) + }, [options, infoviewRef, codeviewRef, initialCode, worldId, levelId]) /** Unused. Was implementing an undo button, which has been replaced by `deleteProof` inside * `TypewriterInterface`.