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

Fix transient notices overlapping product editor footer (take 2) #38698

Merged
merged 10 commits into from Jun 14, 2023

Conversation

mattsherman
Copy link
Contributor

@mattsherman mattsherman commented Jun 13, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

In #38599, the product editor footer was introduced.

Transient notices overlapped this new footer.

This PR updates the the transient notices to not overlap the WooCommerce Admin footer.

To support this change, the TransientNotices component was changed to use the WooFooterItem fill. The CSS was updated to account for this change. No visible changes should be introduced to the use of TransientNotices anywhere in WooCommerce except for the case this PR is addressing (not overlapping the footer).

Closes #38651.

Before (overlapping transient notices)

Screenshot 2023-06-05 at 19 36 54

After (transient notices above footer)

Screenshot 2023-06-09 at 15 11 31

How to test the changes in this Pull Request:

Note: To reset the state of the system so that the feedback footer will be shown, delete the following options:

  • woocommerce_product_editor_show_feedback_bar
  • woocommerce_ces_shown_for_actions
  1. Enable experimental "new product editor" (beta) in WooCommerce > Settings > Advanced > Features
  2. Go to Products > Add New
  3. Verify no feedback footer is shown.
  4. Fill out some fields and save draft (or publish).
  5. Verify feedback footer is shown and transient notice is shown correctly above it.
  6. Dismiss the footer.
  7. Make a change to the product and save draft.
  8. Verify the transient notice is shown correct at the bottom of the screen.

@github-actions github-actions bot added focus: react admin [team:Ghidorah] plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Jun 13, 2023
@mattsherman mattsherman self-assigned this Jun 13, 2023
@mattsherman mattsherman added focus: product Issues related to product or product page. focus: product management Related to product creation and editing. focus: new product ux revamped product management experience labels Jun 13, 2023
@mattsherman mattsherman changed the title Fix/notices overlapping footer 2 Fix transient notices overlapping product editor footer (take 2!) Jun 13, 2023
@mattsherman mattsherman changed the title Fix transient notices overlapping product editor footer (take 2!) Fix transient notices overlapping product editor footer (take 2) Jun 13, 2023
@mattsherman mattsherman marked this pull request as ready for review June 13, 2023 18:16
@mattsherman mattsherman requested review from joshuatf and a team June 13, 2023 18:16
@github-actions
Copy link
Contributor

Hi @joshuatf, @woocommerce/mothra

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Comment on lines +95 to +99
{ /* We put Footer here instead of in InterfaceSkeleton because Footer uses
WooFooterItem to actually render in the WooFooterItem.Slot defined by
WooCommerce Admin. And, we need to put it outside of the SlotFillProvider
we create in this component. */ }
<Footer product={ product } />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joshuatf Do you think we should remove the SlotFillProvider from this component and require the consumer of it to make sure it is in a SlotFillProvider?

Otherwise, any blocks/components in in the product editor won't be able to use fill slots in WooCommerce Admin (since the slot don't be in the context of this SlotFillProvider). Or, is that actually a good thing?

Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely! Good call. Do you want to tackle here or in a follow up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll handle this in a follow-up, in case there are any details that cause that to blow things up a bit.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 13, 2023

Test Results Summary

Commit SHA: 4a45848

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 49s
E2E Tests1950010020520m 32s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@mattsherman
Copy link
Contributor Author

Oops, failing test -- probably due to lack of SlotFillProvider (so notices are not rendered). I'll update the tests later and put it back up for review!

@mattsherman
Copy link
Contributor Author

Fixed failing unit tests... mocking was a little tricky to figure out, due to slot-fill. In the end, mocking WooFooterItem itself worked and made the most sense.

Copy link
Contributor

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

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

Nicely done, Matt! Love how clean this implementation is now.

Left one optional comment and agree with your suggestion on the SlotFillProvider. Pre-approving pending whether or not you want to add those changes here. If so, feel free to re-ping me and I can re-approve.

@@ -93,42 +92,40 @@ export function FeedbackBar( { product }: FeedbackBarProps ) {
return (
<>
{ shouldShowFeedbackBar && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional and obviously not a part of this PR, but since this code is being touched: I really like the following pattern for readability and reducing indentation.

if ( ! shouldShowFeedbackBar ) {
  return null;
}

return <>{/* Feedbackbar render */}</>;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Will try to do this on future code.

return {
__esModule: true, // Use it when dealing with esModules
...originalModule,
WooFooterItem: jest.fn( ( { children } ) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! This is always a little of a pain to mock. Would be nice to get some utils around slot fills to make this easier on us in the future.

Comment on lines +95 to +99
{ /* We put Footer here instead of in InterfaceSkeleton because Footer uses
WooFooterItem to actually render in the WooFooterItem.Slot defined by
WooCommerce Admin. And, we need to put it outside of the SlotFillProvider
we create in this component. */ }
<Footer product={ product } />
Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely! Good call. Do you want to tackle here or in a follow up?

@mattsherman mattsherman merged commit de6f77d into trunk Jun 14, 2023
16 of 17 checks passed
@mattsherman mattsherman deleted the fix/notices-overlapping-footer-2 branch June 14, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: new product ux revamped product management experience focus: product management Related to product creation and editing. focus: product Issues related to product or product page. plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Product Block Editor: Notices should not overlap feedback footer
2 participants