Skip to content

UpgradeNudge: Extract generic BlockNudge component - #13437

Merged
ockham merged 1 commit into
masterfrom
update/extract-generic-block-nudge-from-upgrade-nudge
Sep 6, 2019
Merged

ockham merged 1 commit into
masterfrom
update/extract-generic-block-nudge-from-upgrade-nudge

Conversation

@ockham

@ockham ockham commented Sep 5, 2019

Copy link
Copy Markdown
Contributor

Extracted from #13394, to make that PR smaller.

Changes proposed in this Pull Request:

  • Extract a more generic BlockNudge component from UpgradeNudge, and implement the latter by using it.

Is this a new feature or does it add/remove features to an existing part of Jetpack?

Nope.

Testing instructions:

Use the Simple Payments block to verify that the Upgrade Nudge works as before:

  • Switch to this branch locally, build Jetpack (yarn build), and start Docker (yarn docker:up)
  • Now add the following line to any file in docker/mu-plugins, e.g. a newly created 0-blocks-upgrade.php (needs to start with <?php): add_filter( 'jetpack_block_editor_enable_upgrade_nudge', '__return_true' );
  • Make sure you're connected to WP.com, and on a free plan
  • Start a new post, and insert the 'Simple Payments' block
  • Select the block, and enter some information into its text fields.
  • Click the nudge's "Upgrade" CTA button
  • Pay for the premium plan
  • Verify that you're redirected back to where you came from (the wp-admin block editor) (without any intermediate redirects on WP.com)

Proposed changelog entry for your changes:

  • Extract a more generic BlockNudge component from UpgradeNudge, and implement the latter by using it.

@ockham ockham added [Status] Needs Review This PR is ready for review. Simple Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Sep 5, 2019
@ockham
ockham requested review from a team September 5, 2019 20:02
@ockham ockham self-assigned this Sep 5, 2019
@matticbot

Copy link
Copy Markdown
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello ockham! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D32559-code before merging this PR. Thank you!

@ockham
ockham force-pushed the update/extract-generic-block-nudge-from-upgrade-nudge branch from c37c3d8 to 65aac98 Compare September 5, 2019 20:03
@jetpackbot

jetpackbot commented Sep 5, 2019 •

Copy link
Copy Markdown
Collaborator
Warnings
⚠️

pre-commit hook was skipped for one or more commits

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS against 860a6f8

@matticbot

Copy link
Copy Markdown
Contributor

ockham, Your synced wpcom patch D32559-code has been updated.

@ockham
ockham force-pushed the update/extract-generic-block-nudge-from-upgrade-nudge branch from 839d7ef to 860a6f8 Compare September 5, 2019 22:34

@sirreal sirreal left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 This is nice, thanks for moving it. Tests well. I left a note about some follow ups.

autosaveAndRedirect: async event => {
event.preventDefault(); // Don't follow the href before autosaving
onClick( blockName );
await dispatch( 'core/editor' ).autosave();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One bit of UX I'm missing here is an indication that it's doing something while it autosaves. It's very strange to click a button/link and have the browser not apparently navigating.

We get the save indicator for the editor, but there's nothing that obviously links the actions together.

We can explore that in a future PR, this provides a good base.


Related to the above, we can end up awaiting many promises here… Along with a loading state, we can prevent entering this block repeatedly. Again, this is not a regression and moving this will allow us to iterate on the nudge while other work proceeds in parallel.

}
.jetpack-upgrade-nudge__icon {
align-self: center;
background: var( --color-plan-premium );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interestingly for recurring payments this could be --color-plan-personal but I think we can instead just figure out plan icons later down the road than complicate this too much now.

@jeherve jeherve left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This works well in my tests, and makes sense. 👍

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Sep 6, 2019
@jeherve jeherve added this to the 7.8 milestone Sep 6, 2019
@ockham
ockham merged commit 97ffe1e into master Sep 6, 2019
@ockham
ockham deleted the update/extract-generic-block-nudge-from-upgrade-nudge branch September 6, 2019 11:51
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Sep 6, 2019
@jeherve jeherve added the [Block] Pay With Paypal aka Simple Payments label Feb 12, 2021
@jeherve jeherve added the [Feature] Pay with PayPal aka Simple Payments label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Pay With Paypal aka Simple Payments [Feature] Pay with PayPal aka Simple Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants