Skip to content

Commit 4f1a6f4

Browse files
committed
Popup to let users know that with Turbowarp's compiler their is no live reload
1 parent 0d154f8 commit 4f1a6f4

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

‎src/components/tw-settings-modal/settings-modal.jsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,16 @@ const DisableCompiler = props => (
305305
{...props}
306306
label={
307307
<FormattedMessage
308-
defaultMessage="Disable Compiler"
308+
defaultMessage="Use Scratch Compiler"
309309
description="Disable Compiler setting"
310310
id="tw.settingsModal.disableCompiler"
311311
/>
312312
}
313313
help={
314314
<FormattedMessage
315315
// eslint-disable-next-line max-len
316-
defaultMessage="Disables the {APP_NAME} compiler. You may want to enable this while editing projects so that scripts update immediately. Otherwise, you should never enable this."
316+
//defaultMessage="Disables the {APP_NAME} compiler. You may want to enable this while editing projects so that scripts update immediately. Otherwise, you should never enable this. (as it will run projects on Scratch's compiler, instead of {APP_NAME}'s making projects run ~50x slower)"
317+
defaultMessage="Uses the Scratch compiler instead of {APP_NAME}'s compiler. The only time you should enable this is when you are editing projects and want scripts to update without having to restart the project. Otherwise, you should never enable this. (As Scratch's compiler runs projects 50x slower)"
317318
description="Disable Compiler help"
318319
id="tw.settingsModal.disableCompilerHelp"
319320
values={{

‎src/containers/controls.jsx‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import React from 'react';
44
import VM from 'scratch-vm';
55
import {connect} from 'react-redux';
66

7+
import {showStandardAlert, showAlertWithTimeout} from '../reducers/alerts';
8+
9+
710
import ControlsComponent from '../components/controls/controls.jsx';
811

912
class Controls extends React.Component {
@@ -13,8 +16,15 @@ class Controls extends React.Component {
1316
'handleGreenFlagClick',
1417
'handleStopAllClick'
1518
]);
19+
this.state = {
20+
showedPopup: false
21+
};
1622
}
1723
handleGreenFlagClick (e) {
24+
if(!this.props.disableCompiler && !this.state.showedPopup) {
25+
this.setState({showedPopup: true});
26+
this.props.onShowSaveErrorAlert();
27+
}
1828
e.preventDefault();
1929
// tw: implement alt+click and right click to toggle FPS
2030
if (e.shiftKey || e.altKey || e.type === 'contextmenu') {
@@ -74,9 +84,12 @@ const mapStateToProps = state => ({
7484
projectRunning: state.scratchGui.vmStatus.running,
7585
framerate: state.scratchGui.tw.framerate,
7686
interpolation: state.scratchGui.tw.interpolation,
77-
turbo: state.scratchGui.vmStatus.turbo
87+
turbo: state.scratchGui.vmStatus.turbo,
88+
disableCompiler: !state.scratchGui.tw.compilerOptions.enabled
7889
});
7990
// no-op function to prevent dispatch prop being passed to component
80-
const mapDispatchToProps = () => ({});
91+
const mapDispatchToProps = dispatch => ({
92+
onShowSaveErrorAlert: () => dispatch(showStandardAlert('LiveReloadDisabledNotice')),
93+
});
8194

8295
export default connect(mapStateToProps, mapDispatchToProps)(Controls);

‎src/lib/alerts/index.jsx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,19 @@ const alerts = [
276276
),
277277
iconSpinner: true,
278278
level: AlertLevels.SUCCESS
279+
},{
280+
alertId: 'LiveReloadDisabledNotice',
281+
alertType: AlertTypes.STANDARD,
282+
clearList: [],
283+
content: (
284+
<FormattedMessage
285+
defaultMessage="Live code editing is disabled (changes take effect only after rerunning the project). To enable it, go to Edit → Advanced Settings → Disable Compiler."
286+
description="Message indicating that Live Reload is disabled in this project."
287+
id="gui.alerts.LiveReloadDisabledNotice"
288+
/>
289+
),
290+
closeButton: true,
291+
level: AlertLevels.WARN
279292
}
280293
];
281294

0 commit comments

Comments
 (0)