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

feat(memberships): overlay style for content gate #2377

Merged
merged 45 commits into from
Mar 31, 2023

Conversation

miguelpeixe
Copy link
Member

@miguelpeixe miguelpeixe commented Mar 27, 2023

All Submissions:

Changes proposed in this Pull Request:

Implements overlay style options for the content gate page:

image

When selected, the overlay appears once the beginning of the post content reaches half the viewport. The settings for the number of visible paragraphs/more block do not change:

Gravacao.de.Tela.2023-03-29.as.16.47.12.mov

Overlay options are:

  • Placement: center or bottom
  • Size (width): small (400px) , medium (600px), large (800px)

On mobile, the overlay will always be placed at the bottom and full-width.


For later discussions: some ads are rendered behind this overlay and we should probably have a way around this. One possibility, for a separate PR, is to allow the publisher to tweak visible ad placements in gated content, just like it's done for regular pages/posts:

image

How to test the changes in this Pull Request:

  1. Check out this branch and confirm you have the latest newspack-blocks (for this)
  2. Edit the gate and change to "Overlay" and use the presented default settings
  3. Place a donate block in the gate
  4. Visit any restricted content, scroll down and confirm the gate appears as described above, in the center and 800px wide
  5. Visit on mobile, scroll down, and confirm the gate is positioned at the bottom and full-width
  6. Change the placement to "bottom", visit the page, and confirm the change on desktop
  7. Tweak the size and confirm the editor changes as well,save, and confirm the change on the frontend
  8. Click to donate and confirm the checkout takes over the overlay
  9. Close the checkout and confirm the gate is back
  10. Complete the membership flow and confirm the page is refreshed, the content is unlocked and the gate no longer appears

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Base automatically changed from feat/memberships-content-gate-page to master March 29, 2023 18:44
@dkoo dkoo self-requested a review March 31, 2023 17:40
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

This is working great! I ran into one JS error in the editor, and have a few questions below. I also wanted to mention that on a larger screen it's very easy to read the content under the overlay. Wonder if there's anything we can do to mitigate that beyond adding a "full-width" option for the gate and a configurable overlay opacity (both suggested below)?

Could we somehow set the CSS height of html so that the page won't scroll past a certain point beyond where the gate is triggered? Or truncate the content under the overlay like we do with the inline gate?

assets/memberships-gate/editor.js Show resolved Hide resolved
const overlaySizes = [
{ value: 'small', label: __( 'Small', 'newspack' ) },
{ value: 'medium', label: __( 'Medium', 'newspack' ) },
{ value: 'large', label: __( 'Large', 'newspack' ) },
Copy link
Contributor

Choose a reason for hiding this comment

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

What about a full-width option here, too? On a large screen the "large" size still seems quite small.

Screen Shot 2023-03-31 at 12 22 54 PM

Maybe within the full-width container we can still restrict the content to the same bounds as the site content itself, so the blocks aren't flush-left with the viewport.

Copy link
Member Author

Choose a reason for hiding this comment

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

01e1ff7 tweaks the sizes so it reflects the available set in Newspack Campaigns and full width.

Since large is rather large, I set the default to medium now.

assets/memberships-gate/overlay.scss Show resolved Hide resolved
includes/plugins/class-wc-memberships.php Show resolved Hide resolved
@miguelpeixe
Copy link
Member Author

Or truncate the content under the overlay like we do with the inline gate?

The content should be truncated with the same settings as applied to the inline gate. Did it not on your instance?

@miguelpeixe miguelpeixe requested a review from dkoo March 31, 2023 19:55
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

The content should be truncated with the same settings as applied to the inline gate. Did it not on your instance?

Oh, you're right, it is! I just didn't notice because my article content is all lorem ipsum. 😆 Nit: Could we append an ellipsis [...] to the end of the truncated content to indicate that it's truncated?

I also left some small suggestions which would apply a feature from the Campaigns plugin for PositionControl selector when the overlay is full-width. After that, this looks good to go!

assets/memberships-gate/editor.js Outdated Show resolved Hide resolved
assets/memberships-gate/editor.js Show resolved Hide resolved
assets/memberships-gate/editor.scss Outdated Show resolved Hide resolved
miguelpeixe and others added 4 commits March 31, 2023 17:35
Co-authored-by: Derrick Koo <dkoo@users.noreply.github.com>
Co-authored-by: Derrick Koo <dkoo@users.noreply.github.com>
Co-authored-by: Derrick Koo <dkoo@users.noreply.github.com>
@miguelpeixe
Copy link
Member Author

Nice! Thank you for the suggestion!

Did you manage to confirm the the_content filter issue on global post?

@miguelpeixe miguelpeixe requested a review from dkoo March 31, 2023 21:00
@miguelpeixe
Copy link
Member Author

61382e0 adds ellipsis when in overlay and fixes a minor bug. The last paragraph of the truncated content was missing a closing </p>

Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

Thanks for the revisions!

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Mar 31, 2023
@miguelpeixe miguelpeixe merged commit dd2ff5c into master Mar 31, 2023
@miguelpeixe miguelpeixe deleted the feat/memberships-content-gate-overlay branch March 31, 2023 22:16
matticbot pushed a commit that referenced this pull request Apr 4, 2023
# [1.112.0-alpha.3](v1.112.0-alpha.2...v1.112.0-alpha.3) (2023-04-04)

### Bug Fixes

* add pre push hook ([#2395](#2395)) ([04a6e57](04a6e57))
* Avoid falal error on Reader Revenue wizard ([#2382](#2382)) ([646d212](646d212))

### Features

* **memberships:** overlay style for content gate ([#2377](#2377)) ([dd2ff5c](dd2ff5c))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.112.0-alpha.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Apr 10, 2023
# [1.112.0](v1.111.1...v1.112.0) (2023-04-10)

### Bug Fixes

* add pre push hook ([#2395](#2395)) ([04a6e57](04a6e57))
* Avoid falal error on Reader Revenue wizard ([#2382](#2382)) ([646d212](646d212))
* bail silently when recaptcha key is not set ([#2363](#2363)) ([de18369](de18369))
* don't show gate unless attached to a specific post ([#2400](#2400)) ([c45097c](c45097c))
* if My Account is set to shown in RAS, show in Customizer at all breakpoints ([#2379](#2379)) ([1052923](1052923))
* **memberships:** remove content filters from excerpt ([#2398](#2398)) ([987df5b](987df5b))
* **stripe-sync-script:** process only customers with successful transactions ([#2355](#2355)) ([1020663](1020663))

### Features

* **amp-deprecation:** polyfill amp-vimeo tag ([#2372](#2372)) ([4a70b65](4a70b65))
* **amp:** polyfill lightbox effect ([#2324](#2324)) ([b31288c](b31288c))
* **memberships:** content gate page ([#2366](#2366)) ([15026ab](15026ab))
* **memberships:** overlay style for content gate ([#2377](#2377)) ([dd2ff5c](dd2ff5c))
* **popups:** support disabled segments ([#2376](#2376)) ([bfd65b2](bfd65b2))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.112.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants