From 7f602617a4517aabf6cb24dadba5fd7b15455390 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 23 Feb 2023 17:36:08 +0700 Subject: [PATCH 1/2] Remove theme switch modal --- client/my-sites/theme/main.jsx | 2 - .../themes/auto-loading-homepage-modal.jsx | 314 ------------------ .../themes/auto-loading-homepage-modal.scss | 138 -------- client/my-sites/themes/thanks-modal.jsx | 19 +- client/my-sites/themes/theme-showcase.jsx | 2 - client/my-sites/themes/theme-upload/index.jsx | 2 - client/state/themes/action-types.js | 1 - .../accept-auto-loading-homepage-warning.js | 10 - client/state/themes/actions/activate.js | 33 +- .../hide-auto-loading-homepage-warning.js | 9 - client/state/themes/actions/index.js | 3 - .../show-auto-loading-homepage-warning.js | 10 - client/state/themes/reducer.js | 33 -- .../selectors/get-pre-activate-theme-id.js | 15 - ...as-auto-loading-homepage-modal-accepted.js | 17 - client/state/themes/selectors/index.js | 3 - .../selectors/should-show-homepage-warning.js | 16 - .../src/lib/pages/themes-detail-page.ts | 5 - 18 files changed, 2 insertions(+), 630 deletions(-) delete mode 100644 client/my-sites/themes/auto-loading-homepage-modal.jsx delete mode 100644 client/my-sites/themes/auto-loading-homepage-modal.scss delete mode 100644 client/state/themes/actions/accept-auto-loading-homepage-warning.js delete mode 100644 client/state/themes/actions/hide-auto-loading-homepage-warning.js delete mode 100644 client/state/themes/actions/show-auto-loading-homepage-warning.js delete mode 100644 client/state/themes/selectors/get-pre-activate-theme-id.js delete mode 100644 client/state/themes/selectors/has-auto-loading-homepage-modal-accepted.js delete mode 100644 client/state/themes/selectors/should-show-homepage-warning.js diff --git a/client/my-sites/theme/main.jsx b/client/my-sites/theme/main.jsx index 381a2b4106a6e..1bf7c76d7efe2 100644 --- a/client/my-sites/theme/main.jsx +++ b/client/my-sites/theme/main.jsx @@ -39,7 +39,6 @@ import BodySectionCssClass from 'calypso/layout/body-section-css-class'; import PageViewTracker from 'calypso/lib/analytics/page-view-tracker'; import { decodeEntities, preventWidows } from 'calypso/lib/formatting'; import { PerformanceTrackerStop } from 'calypso/lib/performance-tracking'; -import AutoLoadingHomepageModal from 'calypso/my-sites/themes/auto-loading-homepage-modal'; import { localizeThemesPath } from 'calypso/my-sites/themes/helpers'; import ThanksModal from 'calypso/my-sites/themes/thanks-modal'; import { connectOptions } from 'calypso/my-sites/themes/theme-options'; @@ -1212,7 +1211,6 @@ class ThemeSheet extends Component { { ! isNewDetailsAndPreview && this.renderBar() } - { ! isNewDetailsAndPreview && pageUpsellBanner } { ! isNewDetailsAndPreview && ( - this.setState( { isNarrow } ) - ); - } - - componentWillUnmount() { - if ( typeof this.unsubscribe === 'function' ) { - this.unsubscribe(); - } - } - - static getDerivedStateFromProps( nextProps, prevState ) { - // This component doesn't unmount when the dialog closes, so the state - // needs to be reset back to defaults each time it opens. - // Reseting `homepageAction` ensures the default option will be selected. - if ( nextProps.isVisible && ! prevState.wasVisible ) { - return { homepageAction: 'keep_current_homepage', wasVisible: true }; - } else if ( ! nextProps.isVisible && prevState.wasVisible ) { - return { wasVisible: false }; - } - return null; - } - - handleHomepageAction = ( event ) => { - this.setState( { homepageAction: event.currentTarget.value } ); - }; - - closeModalHandler = - ( action = 'dismiss' ) => - () => { - const { installingThemeId, siteId, source } = this.props; - if ( 'activeTheme' === action ) { - this.props.acceptAutoLoadingHomepageWarning( installingThemeId ); - const keepCurrentHomepage = this.state.homepageAction === 'keep_current_homepage'; - recordTracksEvent( 'calypso_theme_autoloading_homepage_modal_activate_click', { - theme: installingThemeId, - keep_current_homepage: keepCurrentHomepage, - } ); - return this.props.activateTheme( - installingThemeId, - siteId, - source, - false, - keepCurrentHomepage - ); - } else if ( 'keepCurrentTheme' === action ) { - recordTracksEvent( 'calypso_theme_autoloading_homepage_modal_dismiss', { - action: 'button', - theme: installingThemeId, - } ); - return this.props.hideAutoLoadingHomepageWarning(); - } else if ( 'dismiss' === action ) { - recordTracksEvent( 'calypso_theme_autoloading_homepage_modal_dismiss', { - action: 'escape', - theme: installingThemeId, - } ); - return this.props.hideAutoLoadingHomepageWarning(); - } - }; - - render() { - const { - theme, - hasActivated, - isActivating, - hasAutoLoadingHomepage, - isCurrentTheme, - isVisible = false, - } = this.props; - const { isNarrow } = this.state; - - // Nothing to do when it's the current theme. - if ( isCurrentTheme ) { - return null; - } - - // Nothing to show if the theme doesn't have auto loading homepage. - if ( ! hasAutoLoadingHomepage ) { - return null; - } - - // Hide while is activating or when it's activated. - if ( isActivating || hasActivated ) { - return null; - } - - if ( ! theme ) { - return null; - } - - const { - name: themeName, - id: themeId, - stylesheet, - screenshot: themeScreenshot, - } = this.props.theme; - - const iframeSrcKeepHomepage = `//${ this.props.siteDomain }?theme=${ encodeURIComponent( - stylesheet - ) }&hide_banners=true&preview_overlay=true`; - - return ( - - - -
-

- { translate( 'How would you like to use %(themeName)s?', { - args: { themeName }, - } ) } -

-
-
- -
- - { ! isNarrow && ( -