From 53319570d96a2a058045a4dbc11b34fa87a0505e Mon Sep 17 00:00:00 2001 From: Piotr Delawski Date: Wed, 18 Aug 2021 15:23:53 +0200 Subject: [PATCH 01/68] Update "Welcome" step copy --- .../src/onboarding-wizard/pages/welcome/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/assets/src/onboarding-wizard/pages/welcome/index.js b/assets/src/onboarding-wizard/pages/welcome/index.js index 7f751909804..f32b6363175 100644 --- a/assets/src/onboarding-wizard/pages/welcome/index.js +++ b/assets/src/onboarding-wizard/pages/welcome/index.js @@ -47,7 +47,7 @@ export function Welcome() {

- { __( 'Welcome to the Official AMP Plugin for WordPress', 'amp' ) } + { __( 'AMP for WordPress', 'amp' ) }

@@ -72,9 +72,11 @@ export function Welcome() { { __( 'AMP and WordPress', 'amp' ) }

- { __( 'AMP is a web framework designed to make it easier to build user-first sites, which are beautiful, fast, engaging, secure, and accessible.', 'amp' ) } + { __( 'AMP provides support for building beautiful, fast, engaging, secure, and accessible sites, and the AMP plugin makes it easy for you to take advantage of AMP on WordPress.', 'amp' ) } { ' ' } - { __( 'The Official AMP plugin for WordPress enables you to incorporate AMP into your site.', 'amp' ) } + + { __( 'Learn more.', 'amp' ) } +

@@ -107,7 +109,7 @@ export function Welcome() { { __( 'Configure your site with AMP', 'amp' ) }

- { __( 'There are different ways in which you can incorporate AMP content into your site, depending on its configuration (e.g. which theme and/or plugins you are using), your technical expertise and the level of resources you may have for addressing AMP compatibility issues as your site evolves.', 'amp' ) } + { __( 'Regardless of technical expertise, the onboarding flow guides you through the configuration of the plugin in a few easy steps.', 'amp' ) }

@@ -132,10 +134,10 @@ export function Welcome() {

- { __( 'Onboarding flow', 'amp' ) } + { __( 'Site review', 'amp' ) }

- { __( 'This onboarding flow will guide you through the plugin configuration and getting started with AMP on your site.', 'amp' ) } + { __( 'At the end of the onboarding flow, the AMP plugin is fully set up and configured, and your site is ready to serve great experiences to your users.', 'amp' ) }

From 9e51bb09c60fdf92ad5a56de77a88e5472522336 Mon Sep 17 00:00:00 2001 From: Piotr Delawski Date: Wed, 18 Aug 2021 15:24:26 +0200 Subject: [PATCH 02/68] Update plugin name copy and color --- assets/src/css/variables.css | 1 + assets/src/onboarding-wizard/setup-wizard.js | 2 +- assets/src/onboarding-wizard/style.css | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/src/css/variables.css b/assets/src/css/variables.css index 622c7f64818..b76e22f717e 100644 --- a/assets/src/css/variables.css +++ b/assets/src/css/variables.css @@ -6,6 +6,7 @@ :root { --amp-settings-color-black: #212121; --amp-settings-color-brand: #2459e7; + --amp-settings-color-muted: #48525c; --gray: #6c7781; --amp-settings-color-border: #e8e8e8; --very-light-gray: #fafafc; diff --git a/assets/src/onboarding-wizard/setup-wizard.js b/assets/src/onboarding-wizard/setup-wizard.js index 5674e0534b7..ef0e4b342ac 100644 --- a/assets/src/onboarding-wizard/setup-wizard.js +++ b/assets/src/onboarding-wizard/setup-wizard.js @@ -71,7 +71,7 @@ export function SetupWizard( { closeLink, finishLink, appRoot } ) {
- { __( 'Official WordPress Plugin', 'amp' ) } + { __( 'Official AMP Plugin for WordPress', 'amp' ) }
Date: Wed, 18 Aug 2021 18:56:31 +0200 Subject: [PATCH 03/68] Determine active page index based on current page kept in state The list of Onboarding Wizard pages can be dynamically changed depending on the theme mode. The actual pages list is memoized in the `adaptedPages` array. The `adaptedPages` list should be used as a source of truth (after all, the `activePageIndex` references the `adaptedPages` array). In some cases the `activePageIndex` can get out of sync with the `adaptedPages` array. For instance, when viewing the last page and one of the previous pages gets removed the `activePageIndex` references a non-existent item. With this commit, we're stop keeping active page index in the state and instead track current page itself. Based on the `currentPage` object and the `adaptedPages` array we can determine the `activePageIndex`. This eliminates a risk of referencing a non-existent array item. --- .../components/navigation-context-provider.js | 9 ++++----- .../template-mode-override-context-provider.js | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/assets/src/onboarding-wizard/components/navigation-context-provider.js b/assets/src/onboarding-wizard/components/navigation-context-provider.js index 8bad19582d1..51ba502f9f1 100644 --- a/assets/src/onboarding-wizard/components/navigation-context-provider.js +++ b/assets/src/onboarding-wizard/components/navigation-context-provider.js @@ -23,7 +23,7 @@ export const Navigation = createContext(); * @param {Array} props.pages Pages in the app. */ export function NavigationContextProvider( { children, pages } ) { - const [ activePageIndex, setActivePageIndex ] = useState( 0 ); + const [ currentPage, setCurrentPage ] = useState( pages[ 0 ] ); const [ canGoForward, setCanGoForward ] = useState( true ); // Allow immediately moving forward on first page. @todo This may need to change in 2.1. const { editedOptions } = useContext( Options ); @@ -37,7 +37,7 @@ export function NavigationContextProvider( { children, pages } ) { return pages.filter( ( page ) => 'theme-selection' !== page.slug ); }, [ pages, themeSupport ] ); - const currentPage = adaptedPages[ activePageIndex ]; + const activePageIndex = adaptedPages.findIndex( ( adaptedPage ) => adaptedPage.slug === currentPage.slug ); const isLastPage = activePageIndex === adaptedPages.length - 1; @@ -45,7 +45,7 @@ export function NavigationContextProvider( { children, pages } ) { * Navigates back to the previous page. */ const moveBack = () => { - setActivePageIndex( activePageIndex - 1 ); + setCurrentPage( adaptedPages[ activePageIndex - 1 ] ); setCanGoForward( true ); }; @@ -57,7 +57,7 @@ export function NavigationContextProvider( { children, pages } ) { return; } - setActivePageIndex( activePageIndex + 1 ); + setCurrentPage( adaptedPages[ activePageIndex + 1 ] ); setCanGoForward( false ); // Each page is responsible for setting this to true. }; @@ -72,7 +72,6 @@ export function NavigationContextProvider( { children, pages } ) { moveBack, moveForward, pages: adaptedPages, - setActivePageIndex, setCanGoForward, } } diff --git a/assets/src/onboarding-wizard/components/template-mode-override-context-provider.js b/assets/src/onboarding-wizard/components/template-mode-override-context-provider.js index c20d3c8fa7e..8a0f023d59c 100644 --- a/assets/src/onboarding-wizard/components/template-mode-override-context-provider.js +++ b/assets/src/onboarding-wizard/components/template-mode-override-context-provider.js @@ -26,13 +26,14 @@ export const TemplateModeOverride = createContext(); */ export function TemplateModeOverrideContextProvider( { children } ) { const { editedOptions, originalOptions, updateOptions, readerModeWasOverridden, setReaderModeWasOverridden } = useContext( Options ); - const { activePageIndex, currentPage: { slug: currentPageSlug }, setActivePageIndex } = useContext( Navigation ); + const { activePageIndex, currentPage } = useContext( Navigation ); const { selectedTheme, currentTheme } = useContext( ReaderThemes ); const { developerToolsOption, fetchingUser, originalDeveloperToolsOption } = useContext( User ); const [ respondedToDeveloperToolsOptionChange, setRespondedToDeveloperToolsOptionChange ] = useState( false ); const [ mostRecentlySelectedThemeSupport, setMostRecentlySelectedThemeSupport ] = useState( null ); const [ technicalQuestionChangedAtLeastOnce, setTechnicalQuestionChangedAtLeastOnce ] = useState( false ); + const { slug: currentPageSlug } = currentPage || {}; const { theme_support: themeSupport } = editedOptions || {}; const { theme_support: originalThemeSupport } = originalOptions || {}; @@ -60,11 +61,10 @@ export function TemplateModeOverrideContextProvider( { children } ) { * Override with transitional if the user has selected reader mode and their currently active theme is the same as the selected reader theme. */ useEffect( () => { - if ( 'summary' === currentPageSlug && 'reader' === themeSupport && selectedTheme.name === currentTheme.name ) { + if ( 'review' === currentPageSlug && 'reader' === themeSupport && selectedTheme.name === currentTheme.name ) { if ( ! readerModeWasOverridden ) { updateOptions( { theme_support: 'transitional' } ); setReaderModeWasOverridden( true ); - setActivePageIndex( activePageIndex - 1 ); } else { setReaderModeWasOverridden( false ); } @@ -78,7 +78,6 @@ export function TemplateModeOverrideContextProvider( { children } ) { readerModeWasOverridden, updateOptions, setReaderModeWasOverridden, - setActivePageIndex, ] ); /** From a01a728478e4b0c75fedda9a71f8d48d709455f5 Mon Sep 17 00:00:00 2001 From: Piotr Delawski Date: Wed, 18 Aug 2021 18:58:41 +0200 Subject: [PATCH 04/68] Combine Summary and Done steps of Wizard into single step --- assets/src/components/svg/done.js | 38 ----- assets/src/css/elements.css | 2 +- assets/src/css/variables.css | 1 + assets/src/onboarding-wizard/pages/index.js | 8 +- .../src/onboarding-wizard/pages/save/index.js | 133 ++++++++--------- .../onboarding-wizard/pages/save/style.css | 30 ++-- .../pages/summary/desktop-screenshot.js | 60 -------- .../onboarding-wizard/pages/summary/index.js | 60 -------- .../onboarding-wizard/pages/summary/reader.js | 135 ------------------ .../pages/summary/standard.js | 45 ------ .../onboarding-wizard/pages/summary/style.css | 101 ------------- .../pages/summary/summary-header.js | 32 ----- .../pages/summary/transitional.js | 55 ------- tests/e2e/specs/amp-onboarding/done.js | 12 +- .../e2e/specs/amp-onboarding/reader-themes.js | 2 +- tests/e2e/specs/amp-onboarding/summary.js | 39 ----- .../e2e/specs/amp-onboarding/template-mode.js | 4 +- .../transitional-recommendation.js | 13 +- tests/e2e/utils/onboarding-wizard-utils.js | 12 +- 19 files changed, 97 insertions(+), 685 deletions(-) delete mode 100644 assets/src/components/svg/done.js delete mode 100644 assets/src/onboarding-wizard/pages/summary/desktop-screenshot.js delete mode 100644 assets/src/onboarding-wizard/pages/summary/index.js delete mode 100644 assets/src/onboarding-wizard/pages/summary/standard.js delete mode 100644 assets/src/onboarding-wizard/pages/summary/style.css delete mode 100644 assets/src/onboarding-wizard/pages/summary/summary-header.js diff --git a/assets/src/components/svg/done.js b/assets/src/components/svg/done.js deleted file mode 100644 index 5b308c7f228..00000000000 --- a/assets/src/components/svg/done.js +++ /dev/null @@ -1,38 +0,0 @@ -export function Done() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/assets/src/css/elements.css b/assets/src/css/elements.css index 7b331556050..332f6e989c2 100644 --- a/assets/src/css/elements.css +++ b/assets/src/css/elements.css @@ -28,7 +28,7 @@ } .amp p { - font-size: 16px; + font-size: var(--amp-settings-font-size); } .amp, diff --git a/assets/src/css/variables.css b/assets/src/css/variables.css index b76e22f717e..caa23643cf2 100644 --- a/assets/src/css/variables.css +++ b/assets/src/css/variables.css @@ -17,4 +17,5 @@ --color-valid: #46b450; --amp-settings-color-danger: #dc3232; --color-gray-medium: rgba(0, 0, 0, 0.54); + --amp-settings-font-size: 16px; } diff --git a/assets/src/onboarding-wizard/pages/index.js b/assets/src/onboarding-wizard/pages/index.js index 0a6592bd60d..24cdea4f15d 100644 --- a/assets/src/onboarding-wizard/pages/index.js +++ b/assets/src/onboarding-wizard/pages/index.js @@ -9,7 +9,6 @@ import { __ } from '@wordpress/i18n'; import { TechnicalBackground } from './technical-background'; import { TemplateMode } from './template-mode'; import { ChooseReaderTheme } from './choose-reader-theme'; -import { Summary } from './summary'; import { Save } from './save'; import { Welcome } from './welcome'; @@ -40,13 +39,8 @@ export const PAGES = [ PageComponent: ChooseReaderTheme, }, { - slug: 'summary', + slug: 'review', title: __( 'Review', 'amp' ), - PageComponent: Summary, - }, - { - slug: 'done', - title: __( 'Done', 'amp' ), PageComponent: Save, showTitle: false, }, diff --git a/assets/src/onboarding-wizard/pages/save/index.js b/assets/src/onboarding-wizard/pages/save/index.js index c4379d6792d..b9659fc7358 100644 --- a/assets/src/onboarding-wizard/pages/save/index.js +++ b/assets/src/onboarding-wizard/pages/save/index.js @@ -3,7 +3,6 @@ */ import { __ } from '@wordpress/i18n'; import { useContext, useEffect } from '@wordpress/element'; -import { Button } from '@wordpress/components'; /** * Internal dependencies @@ -12,31 +11,14 @@ import { User } from '../../../components/user-context-provider'; import { Phone } from '../../../components/phone'; import './style.css'; import { ReaderThemes } from '../../../components/reader-themes-context-provider'; -import { AMPNotice, NOTICE_SIZE_LARGE, NOTICE_TYPE_SUCCESS, NOTICE_TYPE_INFO } from '../../../components/amp-notice'; +import { + AMPNotice, + NOTICE_SIZE_LARGE, + NOTICE_TYPE_SUCCESS, + NOTICE_TYPE_INFO, +} from '../../../components/amp-notice'; import { Navigation } from '../../components/navigation-context-provider'; import { Options } from '../../../components/options-context-provider'; -import { Done } from '../../../components/svg/done'; - -/** - * Provides the description for the done screen. - * - * @param {string} mode The selected mode. - * @return {string} The text. - */ -function getDescription( mode ) { - switch ( mode ) { - case 'standard': - return __( 'Your site is ready to serve AMP pages to your users! In Standard mode (AMP-first) all canonical URLs are AMP by default. You can still opt out of AMP for specific content types and templates from the AMP settings screen. Depending on the theme and plugins you are using, development work may be required to maintain your site’s AMP compatibility.', 'amp' ); - - case 'transitional': - return __( 'Your site is ready to serve AMP pages to your users! In Transitional mode both the AMP and non-AMP versions of your site will be served using your currently active theme. With further development work to address AMP-compatibility issues in your themes and plugins, your site can be made fully AMP-first.', 'amp' ); - - case 'reader': - return __( 'Your site is ready to serve AMP pages to your users! In Reader mode the AMP version of your site will be served using the Reader theme you have selected (shown to the right), while pages for the non-AMP version of your site will be served using your primary theme. As a last step, make sure you tailor the Reader theme as needed using the Customizer.', 'amp' ); - default: - return ''; - } -} /** * UI for a saving state. @@ -76,28 +58,14 @@ function Preview() { } = useContext( Options ); return ( - <> - -