Skip to content

Commit 1cf3ab1

Browse files
committed
WIP: Hide menu bar and fix assets
* Use the CCW fork of the scratch-gui project so that we can set the `menuBarHidden` property to hide the menu bar. * Don't set `backpackVisible` or `backpackHost` properties, because we probably don't want to display this. TODO: Check whether CS First displays it. * Don't set `canEditTitle`, `showComingSoon` or `onClickLogo` properties, because they all relate to things that are displayed in the menu bar. * Remove the code relating to `simulateScratchDesktop` - I don't think we need it! TODO: Check this! * Copy the relevant assets from the scratch-gui package so that they are made available at the expected URLs. Note that the location of the assets has changed in newer versions of the scratch-gui package. * Remove files in the `scratch/dist` directory from the git repo and ignore files in that directory.
1 parent a0153b1 commit 1cf3ab1

File tree

7 files changed

+1792
-144
lines changed

7 files changed

+1792
-144
lines changed

scratch/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

scratch/dist/main.js

-2
This file was deleted.

scratch/dist/main.js.LICENSE.txt

-29
This file was deleted.

scratch/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"watch": "webpack --watch"
1010
},
1111
"dependencies": {
12+
"@raspberrypifoundation/scratch-gui": "0.1.0-raspberrypifoundation.20230606092831",
1213
"scratch-gui": "^5.1.27"
1314
},
1415
"devDependencies": {

scratch/src/index.jsx

+33-32
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import React from 'react';
44
import ReactDOM from 'react-dom';
55
import {compose} from 'redux';
66

7-
import { AppStateHOC } from 'scratch-gui';
8-
import GUI from 'scratch-gui';
7+
import { AppStateHOC } from '@raspberrypifoundation/scratch-gui';
8+
import GUI from '@raspberrypifoundation/scratch-gui';
99
// import { HashParserHOC } from 'scratch-gui';
1010
// import log from '../lib/log.js';
1111

@@ -45,21 +45,21 @@ document.body.appendChild(appTarget);
4545
)(GUI);
4646

4747
// TODO a hack for testing the backpack, allow backpack host to be set by url param
48-
const backpackHostMatches = window.location.href.match(/[?&]backpack_host=([^&]*)&?/);
49-
const backpackHost = backpackHostMatches ? backpackHostMatches[1] : null;
48+
// const backpackHostMatches = window.location.href.match(/[?&]backpack_host=([^&]*)&?/);
49+
// const backpackHost = backpackHostMatches ? backpackHostMatches[1] : null;
5050

51-
const scratchDesktopMatches = window.location.href.match(/[?&]isScratchDesktop=([^&]+)/);
52-
let simulateScratchDesktop;
53-
if (scratchDesktopMatches) {
54-
try {
55-
// parse 'true' into `true`, 'false' into `false`, etc.
56-
simulateScratchDesktop = JSON.parse(scratchDesktopMatches[1]);
57-
} catch {
58-
// it's not JSON so just use the string
59-
// note that a typo like "falsy" will be treated as true
60-
simulateScratchDesktop = scratchDesktopMatches[1];
61-
}
62-
}
51+
// const scratchDesktopMatches = window.location.href.match(/[?&]isScratchDesktop=([^&]+)/);
52+
// let simulateScratchDesktop;
53+
// if (scratchDesktopMatches) {
54+
// try {
55+
// // parse 'true' into `true`, 'false' into `false`, etc.
56+
// simulateScratchDesktop = JSON.parse(scratchDesktopMatches[1]);
57+
// } catch {
58+
// // it's not JSON so just use the string
59+
// // note that a typo like "falsy" will be treated as true
60+
// simulateScratchDesktop = scratchDesktopMatches[1];
61+
// }
62+
// }
6363

6464
if (process.env.NODE_ENV === 'production' && typeof window === 'object') {
6565
// Warn before navigating away
@@ -68,23 +68,24 @@ document.body.appendChild(appTarget);
6868

6969
ReactDOM.render(
7070
// important: this is checking whether `simulateScratchDesktop` is truthy, not just defined!
71-
simulateScratchDesktop ?
72-
<WrappedGui
73-
canEditTitle
74-
isScratchDesktop
75-
showTelemetryModal
76-
canSave={false}
77-
onTelemetryModalCancel={handleTelemetryModalCancel}
78-
onTelemetryModalOptIn={handleTelemetryModalOptIn}
79-
onTelemetryModalOptOut={handleTelemetryModalOptOut}
80-
/> :
71+
// simulateScratchDesktop ?
72+
// <WrappedGui
73+
// canEditTitle
74+
// isScratchDesktop
75+
// showTelemetryModal
76+
// canSave={false}
77+
// onTelemetryModalCancel={handleTelemetryModalCancel}
78+
// onTelemetryModalOptIn={handleTelemetryModalOptIn}
79+
// onTelemetryModalOptOut={handleTelemetryModalOptOut}
80+
// /> :
8181
<WrappedGui
82-
canEditTitle
83-
backpackVisible
84-
showComingSoon
85-
backpackHost={backpackHost}
82+
menuBarHidden
83+
// canEditTitle
84+
// backpackVisible
85+
// showComingSoon
86+
// backpackHost={backpackHost}
8687
canSave={false}
87-
onClickLogo={onClickLogo}
88+
// onClickLogo={onClickLogo}
8889
/>,
8990
appTarget);
90-
// };
91+
// };

0 commit comments

Comments
 (0)