@@ -10,7 +10,7 @@ import Box from '../components/box/box.jsx';
1010import greenFlag from '../components/green-flag/icon--green-flag.svg' ;
1111import { setStartedState } from '../reducers/vm-status.js' ;
1212import { FormattedMessage } from 'react-intl' ;
13- import ProjectAnalyticsHOC from '../lib/project-analytics-hoc.jsx' ; // Import HOC
13+ import ProjectAnalyticsHOC from '../lib/project-analytics-hoc.jsx' ;
1414
1515import styles from '../components/stage/stage.css' ;
1616
@@ -37,31 +37,50 @@ class GreenFlagOverlay extends React.Component {
3737 render ( ) {
3838 // Check if project has cloud vars and user is generic 'player' or empty string (not logged in)
3939 const isGuest = ! this . props . username || this . props . username === 'player' ;
40- const showCloudWarning = this . props . hasCloudVariables && isGuest ;
40+
41+ const showScratchCloudWarning = this . props . hasCloudVariables && this . props . isScratchProject ;
42+ const showGuestCloudWarning = ! showScratchCloudWarning && this . props . hasCloudVariables && isGuest ;
43+
44+ const anyWarning = showScratchCloudWarning || showGuestCloudWarning ;
4145
4246 return (
4347 < Box
4448 className = { classNames (
4549 this . props . wrapperClass ,
46- { [ styles . greenFlagOverlayWithWarning ] : showCloudWarning }
50+ { [ styles . greenFlagOverlayWithWarning ] : anyWarning }
4751 ) }
4852 onClick = { this . handleClick }
4953 >
50- { showCloudWarning && (
54+ { anyWarning && (
5155 < div className = { styles . cloudWarningContent } >
5256 < div className = { styles . cloudWarningText } >
5357 < span className = { styles . cloudWarningTextRed } >
54- < FormattedMessage
55- defaultMessage = "Multiplayer Features: "
56- id = "gui.greenFlagOverlay.cloudTitle"
57- />
58+ { showScratchCloudWarning ? (
59+ < FormattedMessage
60+ defaultMessage = "Scratch Preview: "
61+ id = "gui.greenFlagOverlay.scratchCloudTitle"
62+ />
63+ ) : (
64+ < FormattedMessage
65+ defaultMessage = "Multiplayer Features: "
66+ id = "gui.greenFlagOverlay.cloudTitle"
67+ />
68+ ) }
5869 </ span >
5970 < span >
60- < FormattedMessage
61- // eslint-disable-next-line max-len
62- defaultMessage = "This project uses cloud variables. To play online or interact with others, you must log in."
63- id = "gui.greenFlagOverlay.cloudWarning"
64- />
71+ { showScratchCloudWarning ? (
72+ < FormattedMessage
73+ // eslint-disable-next-line max-len
74+ defaultMessage = "Cloud variables do not work for Scratch Preview Projects. Please remix this project to use multiplayer features."
75+ id = "gui.greenFlagOverlay.scratchCloudWarning"
76+ />
77+ ) : (
78+ < FormattedMessage
79+ // eslint-disable-next-line max-len
80+ defaultMessage = "This project uses cloud variables. To play online or interact with others, you must log in."
81+ id = "gui.greenFlagOverlay.cloudWarning"
82+ />
83+ ) }
6584 </ span >
6685 </ div >
6786 </ div >
@@ -84,13 +103,15 @@ GreenFlagOverlay.propTypes = {
84103 wrapperClass : PropTypes . string ,
85104 onStarted : PropTypes . func ,
86105 hasCloudVariables : PropTypes . bool ,
106+ isScratchProject : PropTypes . bool ,
87107 username : PropTypes . string ,
88108 onGreenFlagClickAnalytics : PropTypes . func . isRequired
89109} ;
90110
91111const mapStateToProps = state => ( {
92112 vm : state . scratchGui . vm ,
93113 hasCloudVariables : state . scratchGui . tw . hasCloudVariables ,
114+ isScratchProject : state . scratchGui . projectState . isScratchProject ,
94115 username : state . scratchGui . tw . username ,
95116 projectRunning : state . scratchGui . vmStatus . running
96117} ) ;
0 commit comments