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

Update BlockStylesSelector component and implement in Eventbrite #14528

Merged
merged 7 commits into from
Mar 26, 2020

Conversation

scruffian
Copy link
Member

@scruffian scruffian commented Jan 30, 2020

This makes some changes to the BlockStylesSelector component and implements it in the Eventbrite block.

Fixes #14527

Changes proposed in this Pull Request:

  • The preview for the button Embed Type on the EventBrite block will now be a real block preview.
  • The EventBrite block also now allows you to change the Embed Type from the BlockControls.
  • The useModal attribute in the block is now deprecated and replaced with a style attribute.
  • The component now also includes the inspector controls and creates a the block toolbar

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

  • adding to existing features

Testing instructions:

  • Add an Eventbrite block
  • Add an event
  • Check that you can still toggle between a button and an inline embed

Screenshot 2020-01-31 at 13 47 00

  • Check that the Calendly, OpenTable and EventBrite blocks all have a Toolbar which allows you to change the embed style:

Screenshot 2020-01-31 at 14 16 42

  • You also need to test the deprecation for old Eventbrite blocks using the old attributes.
  • Create an Eventbrite block using master
  • Set the Embed type to be "Modal"
  • Save the post
  • Check out this branch
  • Reload the editor
  • Check that the block is still in modal type
  • Open the editor in code view and check you see "style":"modal" in the block attributes.

Proposed changelog entry for your changes:

  • no changelog

@matticbot
Copy link
Contributor

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

@scruffian scruffian force-pushed the update/eventbrite-styles-selector branch from a6ee769 to 4306427 Compare January 30, 2020 14:50
@matticbot
Copy link
Contributor

scruffian, Your synced wpcom patch D38351-code has been updated.

@jetpackbot
Copy link

jetpackbot commented Jan 30, 2020

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: April 7, 2020.
Scheduled code freeze: March 31, 2020

Generated by 🚫 dangerJS against b1d75b0

@matticbot
Copy link
Contributor

scruffian, Your synced wpcom patch D38351-code has been updated.

1 similar comment
@matticbot
Copy link
Contributor

scruffian, Your synced wpcom patch D38351-code has been updated.

@creativecoder
Copy link
Contributor

While I appreciate the code consolidation, I think an image is a better fit for the Eventbrite in page embed preview

  • The preview is small enough that it's hard to read the text, so there's not really a benefit to having "live" updates
  • We don't have to worry about maintaining an external event that could expire or be deleted and break the preview
  • There's a significant delay for the embed to render, long enough that it feels like it might be broken when it first loads

The Button & Modal embed does benefit from a live preview, because it shows the button with the style and color defaults of the active theme.

Two ideas to reconcile this

  • Modify the BlockStylesSelector to accept a customized preview (like an image), OR
  • Expose a more granular component, like BlockStylesSelectorItem, that can be used for just one of the block styles

Then we could keep the image for the In Page preview and have a dynamic preview for the Button & Modal. What do you think?

@scruffian
Copy link
Member Author

We don't have to worry about maintaining an external event that could expire or be deleted and break the preview

I'm not sure what you mean by this, sorry

@creativecoder
Copy link
Contributor

We don't have to worry about maintaining an external event that could expire or be deleted and break the preview

I mean the example url for the block. If the Eventbrite event at that url is in the past, deleted, or otherwise not working, the preview for the In Page embed won't show correctly.

@scruffian
Copy link
Member Author

I mean the example url for the block. If the Eventbrite event at that url is in the past, deleted, or otherwise not working, the preview for the In Page embed won't show correctly.

Ah yes, good point. I'm also not sure why we use the example attributes, rather than previewing with the actual URL the user enters. That's how the core block works, but it doesn't make a lot of sense to me.

I'll think about it some more...

@jeherve jeherve added [Block] Eventbrite [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Jan 31, 2020
@scruffian scruffian added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Jan 31, 2020
@scruffian scruffian changed the title Update/eventbrite styles selector Use the shared BlockStylesSelector component for Eventrbrite Jan 31, 2020
@jeherve jeherve added this to the 8.3 milestone Jan 31, 2020
@Copons Copons self-requested a review January 31, 2020 15:02
@scruffian scruffian changed the title Use the shared BlockStylesSelector component for Eventrbrite Use the shared BlockStylesSelector component for Eventbrite Feb 13, 2020
@scruffian scruffian force-pushed the update/eventbrite-styles-selector branch 2 times, most recently from 4372647 to 44c2489 Compare February 14, 2020 13:38
@scruffian
Copy link
Member Author

The BlockStyleSelector component now renders a preview if one is passed, otherwise it uses the BlockPreview component, so I think this is ready for another review.

@Copons
Copy link
Contributor

Copons commented Feb 14, 2020

I think we have an issue with how we slot-fill the various block controls, that is causing the toolbar controls to never show up.

The way we are using the BlockStylesSelector in the various blocks is inside the InspectorControls slot:

<InspectorControls>
  <PanelBody>
    <BlockStylesSelector />
  </PanelBody>
</InspectorControls>

But then, inside of BlockStylesSelector we also define the Style toolbar button, which is supposed to be rendered inside the BlockControls slot:

<BlockControls>
  <Toolbar />
</BlockControls>

In my tests, the Style button never shows up in the block toolbar.
I've tried moving a bunch of stuff around, and it turns out we could solve the issue and DRY-fy this a bit more.

// block edit.js
<BlockStylesSelector />

// BlockStylesSelector
<BlockControls>
  <Toolbar />
</BlockControls>

<InspectorControls>
  <PanelBody>
    <div className="block-editor-block-styles jetpack-block-styles-selector">
      { /* ... */ }
    </div>
  </PanelBody>
</InspectorControls>

@scruffian
Copy link
Member Author

In my tests, the Style button never shows up in the block toolbar.

Interesting, it shows for me:
Screenshot 2020-02-14 at 15 06 08

If removing the nesting fixes it for you though then we might as well do it. Maybe you're running an older version of Gutenberg?

@Copons
Copy link
Contributor

Copons commented Feb 14, 2020

Maybe you're running an older version of Gutenberg?

That was it.
I was testing with whatever version is included in WP 5.3.2.
I've tried with Guten plugin 7.4, and indeed the button shows up regardless.

If removing the nesting fixes it for you though then we might as well do it.

Yeah, it would be a nice compatibility fix, while also helping to keep things simple. 🙂

pablinos and others added 3 commits March 8, 2020 21:08
When an Eventbrite URL couldn't be embedded the inspectorControls would
still display as the URL prop would have a value. This swaps the check
to the `cannotEmbed` method.
@scruffian scruffian added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Mar 8, 2020
@Copons
Copy link
Contributor

Copons commented Mar 12, 2020

This works fine, but there seems to be some visual inconsistencies with the latest Gutenberg (7.7, but checked out from master right now), that doesn't happen without the Gutenberg plugin.

Block No Plugin Gutenberg 7.7
Calendly Screenshot 2020-03-12 at 12 31 59 Screenshot 2020-03-12 at 12 30 20
Eventbrite Screenshot 2020-03-12 at 12 32 03 Screenshot 2020-03-12 at 12 30 26
OpenTable Screenshot 2020-03-12 at 12 32 10 Screenshot 2020-03-12 at 12 31 13

@scruffian
Copy link
Member Author

Thanks for finding this @Copons. This will be an issue even if we don't merge this PR, so I think we should go ahead and merge and then fix in a different issue.

Copy link
Contributor

@Copons Copons left a comment

Choose a reason for hiding this comment

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

This will be an issue even if we don't merge this PR, so I think we should go ahead and merge and then fix in a different issue.

Makes sense @scruffian, go for it!

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This looks good to me. I agree that the inconsistencies between Gutenberg versions aren't ideal though, but we can address this in a follow-up PR.

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Mar 18, 2020
@apeatling apeatling self-requested a review March 18, 2020 22:22
@creativecoder
Copy link
Contributor

This works fine, but there seems to be some visual inconsistencies with the latest Gutenberg (7.7, but checked out from master right now), that doesn't happen without the Gutenberg plugin.

@Copons Thanks for finding these! Can you please open a Jetpack issue for these (if there isn't one already) and add to our global backlog?

@matticbot
Copy link
Contributor

scruffian, Your synced wpcom patch D38351-code has been updated.

@scruffian scruffian merged commit 60c94f4 into master Mar 26, 2020
@scruffian scruffian deleted the update/eventbrite-styles-selector branch March 26, 2020 14:45
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Mar 26, 2020
@scruffian
Copy link
Member Author

r204888-wpcom

jeherve added a commit that referenced this pull request Mar 31, 2020
jeherve added a commit that referenced this pull request Mar 31, 2020
* Initial changelog entry

* Changelog: add #14904

* Changelog: add #14910

* Changelog: add #14913

* Changelog: add #14916

* Changelog: add #14922

* Changelog: add #14924

* Changelog: add #14925

* Changelog: add #14928

* Changelog: add #14840

* Changelog: add #14841

* Changelog: add #14842

* Changelog: add #14826

* Changelog: add #14835

* Changelog: add #14859

* Changelog: add #14884

* Changelog: add #14888

* Changelog: add #14817

* Changelog: add #14814

* Changelog: add #14819

* Changelog;: add #14797

* Changelog: add #14798

* Changelog: add #14802

* Changelog: add #13676

* Changelog: add #13744

* Changelog: add #13777

* Changelog: add #14446

* Changelog: add #14739

* Changelog: add #14770

* Changelog: add #14784

* Changelog: add #14897

* Changelog: add #14898

* Changelog: add #14968

* Changelog: add #14985

* Changelog: add #15044

* Changelog: add #15052

* Update to remove Podcast since it remains in Beta

* Changelog: add #14803

* Changelog: add #15028

* Changelog: add #15065

* Changelog:add #14886

* Changelog: add #15118

* Changelog: add #14990

* Changelog: add #14528

* Changelog: add #15120

* Changelog: add #15126

* Changelog: add #15049

* Chanegelog: add #14852

* Changelog: add #15090

* Changelog: add #15138

* Changelog: add #15124

* Changelog:add #15055

* Changelog: add #15017

* Changelog: add #15109

* Changelog: add #15145

* Changelog:add #15096

* Changelog:add #15153

* Changelog: add #15133

* Changelog: add #14960

* Changelog: add #15127

* Changelog: add #15056

* Copy current changelog to changelog archive.

* Clarify changelog description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Calendly [Block] Eventbrite [Block] OpenTable [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eventbrite: switch to shared block styles
9 participants