Skip to content

Commit b99d3f7

Browse files
authored
Merge pull request #223 from scratchfoundation/UEPR-176
feat: [UEPR-176] add logic for triggering feedback from editor
2 parents 85cae47 + 80fc4ca commit b99d3f7

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

packages/scratch-gui/src/components/gui/gui.jsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from 'classnames';
22
import omit from 'lodash.omit';
33
import PropTypes from 'prop-types';
4-
import React from 'react';
4+
import React, {useCallback} from 'react';
55
import {defineMessages, FormattedMessage, injectIntl, intlShape} from 'react-intl';
66
import {connect} from 'react-redux';
77
import MediaQuery from 'react-responsive';
@@ -86,6 +86,8 @@ const GUIComponent = props => {
8686
costumeLibraryVisible,
8787
costumesTabVisible,
8888
debugModalVisible,
89+
onDebugModalClose,
90+
onTutorialSelect,
8991
enableCommunity,
9092
intl,
9193
isCreating,
@@ -147,6 +149,13 @@ const GUIComponent = props => {
147149
tabSelected: classNames(tabStyles.reactTabsTabSelected, styles.isSelected)
148150
};
149151

152+
const onCloseDebugModal = useCallback(() => {
153+
if (onDebugModalClose) {
154+
onDebugModalClose();
155+
}
156+
onRequestCloseDebugModal();
157+
}, [onDebugModalClose, onRequestCloseDebugModal]);
158+
150159
if (isRendererSupported === null) {
151160
isRendererSupported = Renderer.isSupported();
152161
}
@@ -194,7 +203,10 @@ const GUIComponent = props => {
194203
<WebGlModal isRtl={isRtl} />
195204
)}
196205
{tipsLibraryVisible ? (
197-
<TipsLibrary hideTutorialProjects={hideTutorialProjects} />
206+
<TipsLibrary
207+
hideTutorialProjects={hideTutorialProjects}
208+
onTutorialSelect={onTutorialSelect}
209+
/>
198210
) : null}
199211
{cardsVisible ? (
200212
<Cards />
@@ -215,7 +227,7 @@ const GUIComponent = props => {
215227
) : null}
216228
{<DebugModal
217229
isOpen={debugModalVisible}
218-
onClose={onRequestCloseDebugModal}
230+
onClose={onCloseDebugModal}
219231
/>}
220232
{backdropLibraryVisible ? (
221233
<BackdropLibrary
@@ -414,6 +426,8 @@ GUIComponent.propTypes = {
414426
costumeLibraryVisible: PropTypes.bool,
415427
costumesTabVisible: PropTypes.bool,
416428
debugModalVisible: PropTypes.bool,
429+
onDebugModalClose: PropTypes.func,
430+
onTutorialSelect: PropTypes.func,
417431
enableCommunity: PropTypes.bool,
418432
intl: intlShape.isRequired,
419433
isCreating: PropTypes.bool,

packages/scratch-gui/src/containers/tips-library.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class TipsLibrary extends React.PureComponent {
5858
return window.open(window.location.origin + urlParams, '_blank');
5959
}
6060

61+
if (this.props.onTutorialSelect) {
62+
this.props.onTutorialSelect();
63+
}
6164
this.props.onActivateDeck(item.id);
6265
}
6366
render () {
@@ -113,6 +116,7 @@ class TipsLibrary extends React.PureComponent {
113116
}
114117

115118
TipsLibrary.propTypes = {
119+
onTutorialSelect: PropTypes.func,
116120
intl: intlShape.isRequired,
117121
onActivateDeck: PropTypes.func.isRequired,
118122
onRequestClose: PropTypes.func,

0 commit comments

Comments
 (0)