Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav Redesign: Add "Activate" ability to "Dev Tools" #91141

Merged
merged 11 commits into from
May 28, 2024

Conversation

DustyReagan
Copy link
Member

@DustyReagan DustyReagan commented May 24, 2024

Related to https://github.com/Automattic/dotcom-forge/issues/7348

Proposed Changes

  • This PR adds the ability to "Activate" aka transfer to Atomic a Simple site on a Creator or higher plan from the "Dev Tools" tab in the nav-redesign.
  • It changes the copy and button in Dev Tools if it is a Simple site that can be made Atomic.
  • It shows a modal popup with eligibility warnings before transfer to Atomic
  • On confirmation and during the transfer a loading screen is shown
  • After the transfer is complete, the user is directed to /hosting-config/ for the site.

The video below is cropped off center on purpose.

Screen.Recording.2024-05-24.at.5.43.45.PM.mp4

Why are these changes being made?

  • Improved UX.

Testing Instructions

  • Create a new Creator site but do NOT take it Atomic
  • Go to the new site on /sites
  • Select the "Dev tools" tab
  • You should see an "Activate" button and supporting copy. (You should see the old buttons and copy on Creator and lower plan sites.)
  • Click "Activate"
  • You should see a modal popup asking you to confirm you want to "go Atomic"
  • Confirm and you should see a waiting process screen.
  • When it completes you should be directed to the now functional /hosting-config/ page.
  • Test around this issue
  • Ensure we only show the "Activate" button to eligible sites
  • Test the that you can set your Host location in the modal popup

Regression test:

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot
Copy link
Contributor

matticbot commented May 24, 2024

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • editing-toolkit
  • odyssey-stats

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/activate-atomic-transfer on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented May 24, 2024

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~41 bytes removed 📉 [gzipped])

name                   parsed_size           gzip_size
entry-subscriptions         -122 B  (-0.0%)      -17 B  (-0.0%)
entry-login                 -122 B  (-0.0%)      -17 B  (-0.0%)
entry-main                   -73 B  (-0.0%)      -64 B  (-0.0%)
entry-stepper                +71 B  (+0.0%)      -27 B  (-0.0%)
entry-domains-landing        -61 B  (-0.0%)       -3 B  (-0.0%)
entry-browsehappy            -61 B  (-0.0%)       -3 B  (-0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~8209 bytes removed 📉 [gzipped])

name                             parsed_size            gzip_size
dev-tools                           +47458 B   (+5.1%)   +14022 B   (+4.8%)
transferring-hosted-site-flow       +17547 B  (+36.5%)    +5127 B  (+29.1%)
themes                                +318 B   (+0.0%)      +70 B   (+0.0%)
theme                                 +318 B   (+0.0%)      +65 B   (+0.0%)
plugins                               +318 B   (+0.0%)      +70 B   (+0.0%)
jetpack-cloud-plugin-management       +318 B   (+0.0%)      +70 B   (+0.0%)
import-flow                           +318 B   (+0.0%)       +4 B   (+0.0%)
hosting                               +318 B   (+0.0%)      +70 B   (+0.0%)
update-design-flow                    -305 B   (-0.0%)      -13 B   (-0.0%)
settings-performance                  +257 B   (+0.0%)      -36 B   (-0.0%)
signup                                -244 B   (-0.1%)       -8 B   (-0.0%)
link-in-bio-tld-flow                  -244 B   (-0.0%)       -8 B   (-0.0%)
scan                                  +210 B   (+0.0%)      +65 B   (+0.0%)
marketplace                           +210 B   (+0.0%)      +30 B   (+0.0%)
backup                                +210 B   (+0.0%)      +28 B   (+0.0%)
a8c-for-agencies-sites                +210 B   (+0.0%)      +28 B   (+0.0%)
devdocs                               -108 B   (-0.1%)      -32 B   (-0.1%)
woocommerce-installation               -61 B   (-0.0%)      -34 B   (-0.0%)
with-theme-assembler-flow              -61 B   (-0.1%)       -1 B   (-0.0%)
update-options-flow                    -61 B   (-0.1%)       -1 B   (-0.0%)
trial-wooexpress-flow                  -61 B   (-0.1%)       -1 B   (-0.0%)
site-setup-flow                        -61 B   (-0.1%)       +2 B   (+0.0%)
site-migration-flow                    -61 B   (-0.1%)       +0 B
migration-signup                       -61 B   (-0.1%)       -2 B   (-0.0%)
hosted-site-migration-flow             -61 B   (-0.1%)       +0 B
free-post-setup-flow                   -61 B   (-0.1%)       -1 B   (-0.0%)
free-flow                              -61 B   (-0.1%)       +1 B   (+0.0%)
entrepreneur-flow                      -61 B   (-0.1%)       -2 B   (-0.0%)
assembler-first-flow                   -61 B   (-0.1%)       -1 B   (-0.0%)
ai-assembler-flow                      -61 B   (-0.1%)       -2 B   (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~1061 bytes removed 📉 [gzipped])

name                                                        parsed_size           gzip_size
async-load-design-blocks                                         -196 B  (-0.0%)    -1062 B  (-0.2%)
async-load-signup-steps-woocommerce-install-confirm               -61 B  (-0.1%)      -34 B  (-0.1%)
async-load-calypso-state-lib-automated-transfer-middleware        -61 B  (-0.2%)      -17 B  (-0.2%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@DustyReagan DustyReagan marked this pull request as ready for review May 24, 2024 22:55
@DustyReagan DustyReagan changed the title Add activate atomic transfer in dev-tools Nav Redesign: Add "Activate" ability to "Dev tools" May 24, 2024
@DustyReagan DustyReagan added the [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging label May 24, 2024
@DustyReagan DustyReagan requested a review from a team May 24, 2024 23:00
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 24, 2024
@DustyReagan DustyReagan requested review from a team May 24, 2024 23:00
@DustyReagan DustyReagan self-assigned this May 24, 2024

setTimeout( () => {
window.location.assign( to );
}, timeoutDuration );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the site Atomic transfer is complete, we still need a few moments for "things" to update. Redirecting right away does not work.

I tried to avoid this setTimeout by leveraging requestSite( siteId ) and trying waiting on various "promises" and "states", but ultimately I was only able to get it working consistently with this timeout.

I set a conditional on timeoutDuration so that we don't add unnecessary process time to the original flow. It only waits for our flow as it is.

I believe this method to be adequate, but welcome better alternatives!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the WatiForAtomic support the feature query string?

If it's provided, the step will poll the latest site data and do the redirection only when the feature is ready. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done by 3886a34

@DustyReagan DustyReagan changed the title Nav Redesign: Add "Activate" ability to "Dev tools" Nav Redesign: Add "Activate" ability to "Dev Tools" May 24, 2024
<h1> { translate( 'Unlock all developer tools' ) }</h1>
<h1>
{ showHostingActivationButton
? translate( 'Activate hosting configuration' )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should it be Activate all developer tools?

Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fushar
Copy link
Contributor

fushar commented May 27, 2024

Can we align the modal design with @lucasmendes-design's

I see, from reading the codebase, there could be multiple warnings. But I think at least we should rename / remove hosting access because it's a bit weird in this context.

By activating hosting access the following change will be made to the site:

=>

By activating, the following change will be made to the site:

@arthur791004
Copy link
Contributor

@arthur791004
Copy link
Contributor

The initiateThemeTransfer request may take a long time, so I also update the button status to display the loading state. But it seems to be better to move the request to the transfer flow 🤔

@fushar
Copy link
Contributor

fushar commented May 28, 2024

The initiateThemeTransfer request may take a long time, so I also update the button status to display the loading state. But it seems to be better to move the request to the transfer flow 🤔

I agree 😅 for some people it looks like the feature is broken.

Currently it is also weird to still have a clickable close button in the modal while the button is still loading.

@fushar
Copy link
Contributor

fushar commented May 28, 2024

After the flow finishes, the /dev-tools/:site page still says Unlock developer tools but then a few seconds later it changes to Activate developer tools. I didn't have the chance to take video. Maybe it's because I have a lot of sites 🤔

@miksansegundo
Copy link
Collaborator

I recorded my test, not working because after the activation the URL gets the slug for simple rather than the site ID.

Screen.Recording.2567-05-28.at.12.57.05.mov

@miksansegundo
Copy link
Collaborator

I'm passing the param ?activate to open the activation modal for users coming from the upsell pages in D149752-code WDYT?

@arthur791004
Copy link
Contributor

arthur791004 commented May 28, 2024

I'm passing the param ?activate to open the activation modal for users coming from the upsell pages in D149752-code WDYT?

Sounds good!

@arthur791004
Copy link
Contributor

The main issue was the stepper flow didn't sync the redux store to local storage so the site dashboard got the outdated data and then redirected you back to the dev tool. It should be addressed by adding the persistOnChange to the stepper flow

There was another issue is that the manage_options might become false right after the atomic transfer, so calypso would redirect you to the stats page. As a result, I made changes to wait for the value being true before the redirection.

@arthur791004 arthur791004 force-pushed the add/activate-atomic-transfer branch 2 times, most recently from c9072ee to 75002b9 Compare May 28, 2024 10:56
@miksansegundo miksansegundo self-requested a review May 28, 2024 13:04
Copy link
Collaborator

@miksansegundo miksansegundo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested well for me 🥳

Can we pass a param (&redirect=/wp-admin/options-general.php?page=options-permalink) to redirect to the features from the upsell pages? That would make sense for the upsell flow from those pages. I'll go ahead and propose a PR later.

Screen.Recording.2567-05-28.at.20.02.55.mov

@miksansegundo miksansegundo self-requested a review May 28, 2024 13:11
miksansegundo

This comment was marked as duplicate.

Copy link
Collaborator

@miksansegundo miksansegundo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!! 🚀

@fushar
Copy link
Contributor

fushar commented May 28, 2024

Can we pass a param

Let's do it in a folllow-up PR 😄

@arthur791004 arthur791004 merged commit 73ed6ba into trunk May 28, 2024
12 of 13 checks passed
@arthur791004 arthur791004 deleted the add/activate-atomic-transfer branch May 28, 2024 23:49
@github-actions github-actions bot removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging labels May 28, 2024
@miksansegundo
Copy link
Collaborator

I'll follow up with https://github.com/Automattic/dotcom-forge/issues/7492 to use params to open the activation modal and handle the redirection afterward.

I'll investigate and propose a PR. @arthur791004, do you have any tips about where/how to handle those params?

@arthur791004
Copy link
Contributor

I think you can use the query params to determine the initial state of the showEligibility. If the specific value is provided, the default value would be true and then open the dialog directly.

Next, get the value of the redirect_to from the query params first, and then fall back to the default value (/hosting-config/${ siteId }). There may be an issue related to the domain change when the transfer flow redirects the user back to the WP Admin. If so, we have to check whether the redirect URL starts from the /wp-admin and then add the transferred domain to the prefix before the redirection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants