From 86855b23e300816a1543d1130c00461f540d4d5d Mon Sep 17 00:00:00 2001 From: MiroslavDionisiev Date: Tue, 25 Mar 2025 11:16:40 +0200 Subject: [PATCH 1/2] feat: [UEPR-176] add logic for triggering feedback from editor --- .../scratch-gui/src/components/gui/gui.jsx | 20 ++++++++++++++++--- .../src/containers/tips-library.jsx | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/scratch-gui/src/components/gui/gui.jsx b/packages/scratch-gui/src/components/gui/gui.jsx index 1b128a0943..5ba97872a4 100644 --- a/packages/scratch-gui/src/components/gui/gui.jsx +++ b/packages/scratch-gui/src/components/gui/gui.jsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import omit from 'lodash.omit'; import PropTypes from 'prop-types'; -import React from 'react'; +import React, {useCallback} from 'react'; import {defineMessages, FormattedMessage, injectIntl, intlShape} from 'react-intl'; import {connect} from 'react-redux'; import MediaQuery from 'react-responsive'; @@ -86,6 +86,8 @@ const GUIComponent = props => { costumeLibraryVisible, costumesTabVisible, debugModalVisible, + displayDebugFeedback, + displayTutorialsFeedback, enableCommunity, intl, isCreating, @@ -147,6 +149,13 @@ const GUIComponent = props => { tabSelected: classNames(tabStyles.reactTabsTabSelected, styles.isSelected) }; + const onDebugModalClose = useCallback(() => { + if (displayDebugFeedback) { + displayDebugFeedback(); + } + onRequestCloseDebugModal(); + }, [displayDebugFeedback, onRequestCloseDebugModal]); + if (isRendererSupported === null) { isRendererSupported = Renderer.isSupported(); } @@ -194,7 +203,10 @@ const GUIComponent = props => { )} {tipsLibraryVisible ? ( - + ) : null} {cardsVisible ? ( @@ -215,7 +227,7 @@ const GUIComponent = props => { ) : null} {} {backdropLibraryVisible ? ( Date: Mon, 31 Mar 2025 15:05:34 +0300 Subject: [PATCH 2/2] refactor: [UEPR-176] change method names --- .../scratch-gui/src/components/gui/gui.jsx | 20 +++++++++---------- .../src/containers/tips-library.jsx | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/scratch-gui/src/components/gui/gui.jsx b/packages/scratch-gui/src/components/gui/gui.jsx index 5ba97872a4..17236abb83 100644 --- a/packages/scratch-gui/src/components/gui/gui.jsx +++ b/packages/scratch-gui/src/components/gui/gui.jsx @@ -86,8 +86,8 @@ const GUIComponent = props => { costumeLibraryVisible, costumesTabVisible, debugModalVisible, - displayDebugFeedback, - displayTutorialsFeedback, + onDebugModalClose, + onTutorialSelect, enableCommunity, intl, isCreating, @@ -149,12 +149,12 @@ const GUIComponent = props => { tabSelected: classNames(tabStyles.reactTabsTabSelected, styles.isSelected) }; - const onDebugModalClose = useCallback(() => { - if (displayDebugFeedback) { - displayDebugFeedback(); + const onCloseDebugModal = useCallback(() => { + if (onDebugModalClose) { + onDebugModalClose(); } onRequestCloseDebugModal(); - }, [displayDebugFeedback, onRequestCloseDebugModal]); + }, [onDebugModalClose, onRequestCloseDebugModal]); if (isRendererSupported === null) { isRendererSupported = Renderer.isSupported(); @@ -205,7 +205,7 @@ const GUIComponent = props => { {tipsLibraryVisible ? ( ) : null} {cardsVisible ? ( @@ -227,7 +227,7 @@ const GUIComponent = props => { ) : null} {} {backdropLibraryVisible ? (