From b0602f3e39efbfea26ddf73004f906b2ff2ddde9 Mon Sep 17 00:00:00 2001 From: Seb Jacobs Date: Tue, 8 Jul 2025 15:04:47 +0100 Subject: [PATCH 1/4] refactor: remove duplicate remixProject export The remixProject reducer is already being exported from the `src/exported-reducers.ts` file which makes this export redundant. --- packages/scratch-gui/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/scratch-gui/src/index.ts b/packages/scratch-gui/src/index.ts index 47a926acda..922693bc0f 100644 --- a/packages/scratch-gui/src/index.ts +++ b/packages/scratch-gui/src/index.ts @@ -4,7 +4,6 @@ import {legacyConfig} from './legacy-config'; export {default} from './containers/gui.jsx'; export {default as GUIComponent} from './components/gui/gui.jsx'; export {default as AppStateHOC} from './lib/app-state-hoc.jsx'; -export {remixProject} from './reducers/project-state.js'; export {setAppElement} from 'react-modal'; export {legacyConfig}; From dadc4f1644e0541a4ac30bd915a7dc756250a36a Mon Sep 17 00:00:00 2001 From: Seb Jacobs Date: Mon, 30 Jun 2025 14:59:38 +0100 Subject: [PATCH 2/4] feat: allow MenuBar to be hidden The MenuBar is quite specific to the canonical version of the online Scratch editor [1]. In RaspberryPiFoundation projects we want to make use of the scratch-gui package without displaying the MenuBar. The MenuBar can be hidden by passing in the `menuBarHidden` prop. Since the height of the menu bar is hard-coded as a CSS variable, I've had to override the height calculation for the body wrapper when the menu bar is not visible. Ideally the height of the menu bar wouldn't be hard-coded and this wouldn't be necessary. We were unable to find an existing unit test for the Gui component and so we have not added any test coverage around the new `menuBarHidden` prop. [1]: https://scratch.mit.edu/projects/editor Co-authored-by: James Mead --- packages/scratch-gui/src/components/gui/gui.css | 4 ++++ packages/scratch-gui/src/components/gui/gui.jsx | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/scratch-gui/src/components/gui/gui.css b/packages/scratch-gui/src/components/gui/gui.css index 2002e5bb2a..671ded20cf 100644 --- a/packages/scratch-gui/src/components/gui/gui.css +++ b/packages/scratch-gui/src/components/gui/gui.css @@ -11,6 +11,10 @@ background-color: $ui-primary; } +.body-wrapper-without-menu-bar { + height: 100%; +} + .body-wrapper * { box-sizing: border-box; } diff --git a/packages/scratch-gui/src/components/gui/gui.jsx b/packages/scratch-gui/src/components/gui/gui.jsx index 171ef06cca..f931541a7f 100644 --- a/packages/scratch-gui/src/components/gui/gui.jsx +++ b/packages/scratch-gui/src/components/gui/gui.jsx @@ -102,6 +102,7 @@ const GUIComponent = props => { loading, logo, manuallySaveThumbnails, + menuBarHidden, renderLogin, onClickAbout, onClickAccountNav, @@ -176,6 +177,9 @@ const GUIComponent = props => { return ({isFullSize => { const stageSize = resolveStageSize(stageSizeMode, isFullSize); + const boxStyles = classNames(styles.bodyWrapper, { + [styles.bodyWrapperWithoutMenuBar]: menuBarHidden + }); return isPlayerOnly ? ( { onRequestClose={onRequestCloseBackdropLibrary} /> ) : null} - { userOwnsProject={userOwnsProject} username={username} accountMenuOptions={accountMenuOptions} - /> - + />} + Date: Mon, 30 Jun 2025 15:01:28 +0100 Subject: [PATCH 3/4] feat: export manualUpdateProject reducer action This will allow us to trigger the saving of a project from outside the GUI component. Co-authored-by: James Mead --- packages/scratch-gui/src/exported-reducers.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/scratch-gui/src/exported-reducers.ts b/packages/scratch-gui/src/exported-reducers.ts index 65acf6fc83..151bda1fe5 100644 --- a/packages/scratch-gui/src/exported-reducers.ts +++ b/packages/scratch-gui/src/exported-reducers.ts @@ -8,6 +8,7 @@ import { onFetchedProjectData, onLoadedProject, defaultProjectId, + manualUpdateProject, remixProject, requestNewProject, requestProjectUpload, @@ -30,6 +31,7 @@ export { onFetchedProjectData, onLoadedProject, defaultProjectId, + manualUpdateProject, remixProject, requestNewProject, requestProjectUpload, From 440fcaf8afc37f228b96d5bd5c4d76bb3884e7d3 Mon Sep 17 00:00:00 2001 From: Seb Jacobs Date: Thu, 24 Jul 2025 14:53:34 +0100 Subject: [PATCH 4/4] feat: export setStageSize reducer action This will allow us to override the default stage size or change the stage size from outside of the GUI component. --- packages/scratch-gui/src/exported-reducers.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/scratch-gui/src/exported-reducers.ts b/packages/scratch-gui/src/exported-reducers.ts index 151bda1fe5..767a87e9f5 100644 --- a/packages/scratch-gui/src/exported-reducers.ts +++ b/packages/scratch-gui/src/exported-reducers.ts @@ -19,6 +19,7 @@ import { closeLoadingProject, openTelemetryModal } from './reducers/modals.js'; +import {setStageSize} from './reducers/stage-size'; export const guiReducers = { locales: LocalesReducer, @@ -36,6 +37,7 @@ export { requestNewProject, requestProjectUpload, setProjectId, + setStageSize, openLoadingProject, closeLoadingProject,