-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add a GS limit notice in the Global Styles sidebar #74510
Conversation
Just like the other Global Styles limit notices, the new notice is shown only for free and personal plans. The implementation is based on the existing noticed by refactoring the logic we used in the pre-save GS notice.
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/screen-root-notice.tsx
Outdated
Show resolved
Hide resolved
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
There's a TS error because it fails to recognize TypeScript fails me :(. I'll make the adjustments after the code review. |
…rs without using ts-ignore.
This PR modifies the release build for editing-toolkit To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-mMA-p2 |
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Outdated
Show resolved
Hide resolved
This change means that the sidebar will always be taller than the page - we're displaying content above the global styles sidebar which has a css rule of In turn this means that due to an existing GB bug, a horizontal scrollbar will always be displayed for some combinations of browsers and scrollbar settings (see https://github.com/WordPress/ gutenberg/issues/29912#issuecomment-900000689). Here's a video of it in action: It'd be nice if we could so something about this but I don't think it's a blocker. The same thing happens when looking at the global styles block list. |
…the fill component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This work well!
It'd be great if the notice wouldn't have the top margin, so it's right at top the sidebar.
I also consider that the current pre-save notice is no longer relevant, so I'd probably get rid of it (and possibly re-use the same copy in the new permanent notice since it looks a bit clearer).
This change means that the sidebar will always be taller than the page
IMO, I think we should fix this before shipping it, and ensure that the sidebar doesn't have the scrollbar if it is not needed:
Screen.Recording.2023-03-30.at.16.03.05.mov
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Outdated
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Outdated
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/use-global-styles-config.js
Outdated
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/use-global-styles-config.js
Outdated
Show resolved
Hide resolved
- Add dedicated tracking events for the sidebar notice and add a blog_id parameter (which will help to get some stats about the sites that upgrade) - Rename isVisible property to globalStylesInUse - Rename utils.ts to tracks-events.ts for better visibility - Removed a property since from the use function since it's not needed - Fixed CSS margin issues in the sidebar
Fixed it! :)
I think there's still value in showing the notice in the PrePublish panel too. We've seen that upgrade notices in the editor historically don't convert well; one theory we had was that the user might not want to interrupt their work on their site to upgrade to a paid plan.
I've tried again to remove the scrollbar but without much luck (since the changes would require at least overriding the existing styling from Gutenberg core - which will make the implementation less robust). IMO I think this styling should be handled in Core because the slot we are using (which is a public API) doesn't accommodate multiple UI elements in that section. |
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Outdated
Show resolved
Hide resolved
Looks like the tests are failing :( |
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Outdated
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/tracks-events.ts
Outdated
Show resolved
Hide resolved
535f038
to
f3e0d79
Compare
Looks like the merge is not blocked anymore, but I still have two issues:
|
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/index.php
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/index.php
Outdated
Show resolved
Hide resolved
…s/index.php Co-authored-by: Miguel Torres <[email protected]>
I found a regression, not sure if that is related with the test failure. Previously, you could switch between style variations and the GS panel remained open: Screen.Recording.2023-03-31.at.17.09.36.movHowever, with these changes, the GS panel is closed automatically after selecting a style variation: Screen.Recording.2023-03-31.at.17.10.36.movEDIT: The same happens if you try to change any other style such as a color or a typography. |
Yeah, it's a known issue with the approach (more like a limitation)... it was already discussed about it somewhere. The problem is that when the slots change, the slot-fill generic component does a forceUpdate on all fills, which means the local state is reset for all fills and the user is moved back to RootScreen. This happens in two scenarios, as you've noticed:
Sadly I haven't found a solution for this (and I doubt we can do something about it) :( |
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/global-style-sidebar-notice.tsx
Outdated
Show resolved
Hide resolved
apps/editing-toolkit/editing-toolkit-plugin/wpcom-global-styles/notice.js
Outdated
Show resolved
Hide resolved
…s/global-style-sidebar-notice.tsx Co-authored-by: Miguel Torres <[email protected]>
…s/notice.js Co-authored-by: Miguel Torres <[email protected]>
Just like the other Global Styles limit notices, the new notice is shown only for free and personal plans. The implementation is based on the existing noticed by refactoring the logic we used in the pre-save GS notice.
Related to https://github.com/Automattic/dotcom-forge/issues/1233
Proposed Changes
ComplementaryArea/core/edit-site
slot.Testing Instructions
Pre-merge Checklist