Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Convert filter blocks to inner blocks #6978

Merged
merged 66 commits into from
Oct 7, 2022
Merged

Conversation

tjcafferkey
Copy link
Contributor

@tjcafferkey tjcafferkey commented Aug 25, 2022

Fixes #6845
Also closes #6543

In this PR, we convert filter blocks into parent blocks containing a core/heading block and the actual filter block. This makes it easier and clearer for users to style the filter blocks:

  • The woocommerce/filter-wrapper block is a parent block that contains the core/heading block and the actual filter block.
  • By default, the wrapper block is the container of the Active Filter block, other filter blocks are supported by creating variations from woocommerce/filter-wrapper.
  • The actual filter blocks are now hidden from the inserter. Users can only insert the wrapper block instead.
  • The existing filter blocks aren't affected.
  • The wrapper block provides a ref that is passed down to the filter block using context. The visibility of the wrapper block is controlled inside the actual filter block using that ref.
  • We have to use context because the inner filter block isn't the direct child of the wrapper block due to the implementation of the renderInnerBlocks.
  • The number of inner blocks is set to 2 for the heading and inner filter block.

Screenshots

Screen.Recording.2022-09-01.at.11.02.35.mov

Testing

Automated Tests

  • Changes in this PR are covered by Automated Tests.
    • Unit tests
    • E2E tests

User Facing Testing

Insert new blocks:
  1. Check out this PR, built.
  2. Add a new page, add All Products, Active Filters, Filter by Price, Filter by Attribute, and Filter by Stock blocks to the page.
  3. Check the newly inserted filter blocks, for each block, a wrapper block containing the heading and filter control blocks were inserted.
  4. Try changing block settings and style, and see if they're updated on the front end.
  5. See filter blocks work as expected.
Upgrade existing blocks
  1. Check out trunk.
  2. Add a new page, add All Products, Active Filters, Filter by Price, Filter by Attribute, and Filter by Stock blocks to the page.
  3. Try changing block settings and style.
  4. Check out this PR and build.
  5. Edit the page created in step 2nd above.
  6. See the upgrade notices for filter blocks as shown in this comment.
  7. Click the upgrade button, see:
  • The block is replaced by a filter wrapper block contain the heading and the filter block control blocks.
  • The modified title remains.
  1. Save the page, see all filter blocks continue functioning as expected on the front end.
  • Do not include in the Testing Notes

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

Changelog

Separate filter titles and filter controls by converting filter blocks to use Inner Blocks

@github-actions
Copy link
Contributor

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-6978.zip

@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2022

Script Dependencies Report

The compare-assets action has detected some changed script dependencies between this branch and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Removed
filter-wrapper.js wp-block-editor, wp-blocks, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️

This comment was automatically generated by the ./github/compare-assets action.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2022

Size Change: +42.2 kB (+5%) 🔍

Total Size: 958 kB

Filename Size Change
build/active-filters-frontend.js 7.73 kB +112 B (+1%)
build/active-filters.js 7.47 kB -833 B (-10%) 👏
build/all-products-frontend.js 26.5 kB -1 B (0%)
build/all-products.js 33.5 kB -68 B (0%)
build/attribute-filter-frontend.js 22.5 kB +116 B (+1%)
build/attribute-filter.js 12.4 kB -945 B (-7%)
build/blocks-checkout.js 17.5 kB +6 B (0%)
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.38 kB -11 B (-1%)
build/cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 5.64 kB +2 B (0%)
build/cart-blocks/cart-cross-sells-products-frontend.js 4.67 kB +8 B (0%)
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.24 kB +115 B (+2%)
build/cart-blocks/cart-express-payment-frontend.js 786 B -12 B (-2%)
build/cart-blocks/cart-items-frontend.js 298 B -1 B (0%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.31 kB +48 B (+1%)
build/cart-blocks/cart-order-summary-frontend.js 1.11 kB +4 B (0%)
build/cart-blocks/cart-totals-frontend.js 320 B -1 B (0%)
build/cart-blocks/empty-cart-frontend.js 346 B +1 B (0%)
build/cart-blocks/filled-cart-frontend.js 785 B +2 B (0%)
build/cart-blocks/order-summary-coupon-form-frontend.js 2.73 kB +4 B (0%)
build/cart-blocks/order-summary-discount-frontend.js 2.16 kB -3 B (0%)
build/cart-blocks/order-summary-fee-frontend.js 273 B -1 B (0%)
build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js 6.61 kB -123 B (-2%)
build/cart-blocks/order-summary-shipping-frontend.js 430 B +2 B (0%)
build/cart-blocks/order-summary-taxes-frontend.js 435 B +2 B (0%)
build/cart-blocks/proceed-to-checkout-frontend.js 1.19 kB -1 B (0%)
build/cart-frontend.js 50 kB -341 B (-1%)
build/cart.js 46.2 kB -169 B (0%)
build/checkout-blocks/actions-frontend.js 1.79 kB -10 B (-1%)
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.95 kB +13 B (0%)
build/checkout-blocks/contact-information-frontend.js 3 kB +11 B (0%)
build/checkout-blocks/express-payment-frontend.js 1.16 kB -14 B (-1%)
build/checkout-blocks/fields-frontend.js 344 B +1 B (0%)
build/checkout-blocks/order-note-frontend.js 1.14 kB +8 B (+1%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.67 kB +4 B (0%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 2.88 kB +2 B (0%)
build/checkout-blocks/order-summary-discount-frontend.js 2.28 kB +1 B (0%)
build/checkout-blocks/order-summary-fee-frontend.js 276 B +1 B (0%)
build/checkout-blocks/order-summary-frontend.js 1.11 kB +2 B (0%)
build/checkout-blocks/order-summary-shipping-frontend.js 603 B +1 B (0%)
build/checkout-blocks/order-summary-taxes-frontend.js 435 B +2 B (0%)
build/checkout-blocks/payment-frontend.js 8 kB +116 B (+1%)
build/checkout-blocks/shipping-methods-frontend.js 4.86 kB -119 B (-2%)
build/checkout-blocks/terms-frontend.js 1.64 kB -14 B (-1%)
build/checkout-blocks/totals-frontend.js 323 B -1 B (0%)
build/checkout-frontend.js 52.1 kB -383 B (-1%)
build/checkout.js 39.9 kB -243 B (-1%)
build/featured-category.js 13.2 kB +3 B (0%)
build/featured-product.js 13.4 kB +2 B (0%)
build/handpicked-products.js 7.28 kB -1 B (0%)
build/legacy-template.js 2.83 kB -1 B (0%)
build/mini-cart-component-frontend.js 16.8 kB -26 B (0%)
build/mini-cart-contents-block/empty-cart-frontend.js 367 B +1 B (0%)
build/mini-cart-contents-block/filled-cart-frontend.js 230 B +1 B (0%)
build/mini-cart-contents-block/footer-frontend.js 2.97 kB -205 B (-6%)
build/mini-cart-contents-block/title-frontend.js 367 B +1 B (0%)
build/mini-cart-contents.js 16.8 kB -223 B (-1%)
build/mini-cart-frontend.js 1.72 kB +1 B (0%)
build/mini-cart.js 4.57 kB -1 B (0%)
build/price-filter-frontend.js 13.6 kB +67 B (0%)
build/price-filter.js 8.47 kB -931 B (-10%) 👏
build/product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00.js 227 B +2 B (+1%)
build/product-add-to-cart--product-button--product-image--product-title.js 2.66 kB -2 B (0%)
build/product-add-to-cart-frontend.js 1.25 kB +6 B (0%)
build/product-add-to-cart.js 6.47 kB +4 B (0%)
build/product-best-sellers.js 7.62 kB -5 B (0%)
build/product-button--product-image--product-rating--product-sale-badge--product-title.js 303 B +1 B (0%)
build/product-button-frontend.js 1.89 kB +3 B (0%)
build/product-button.js 1.58 kB -1 B (0%)
build/product-categories.js 2.36 kB -3 B (0%)
build/product-category-list-frontend.js 881 B +2 B (0%)
build/product-category-list.js 503 B +2 B (0%)
build/product-image-frontend.js 1.92 kB +5 B (0%)
build/product-new.js 7.63 kB +2 B (0%)
build/product-on-sale.js 7.95 kB +1 B (0%)
build/product-price-frontend.js 1.92 kB +6 B (0%)
build/product-price.js 1.53 kB -1 B (0%)
build/product-rating-frontend.js 1.18 kB +1 B (0%)
build/product-rating.js 774 B +2 B (0%)
build/product-sale-badge-frontend.js 1.15 kB +4 B (0%)
build/product-sale-badge.js 815 B -2 B (0%)
build/product-search.js 2.62 kB +2 B (0%)
build/product-sku-frontend.js 379 B -1 B (0%)
build/product-sku.js 380 B +1 B (0%)
build/product-stock-indicator-frontend.js 996 B +1 B (0%)
build/product-stock-indicator.js 624 B +1 B (0%)
build/product-summary-frontend.js 1.29 kB +2 B (0%)
build/product-summary.js 919 B -1 B (0%)
build/product-tag-list-frontend.js 876 B +1 B (0%)
build/product-tag.js 7.99 kB +2 B (0%)
build/product-title-frontend.js 1.34 kB +6 B (0%)
build/product-title.js 937 B -2 B (0%)
build/product-top-rated.js 7.87 kB +4 B (0%)
build/products-by-attribute.js 8.53 kB +2 B (0%)
build/rating-filter-frontend.js 6.74 kB +5 B (0%)
build/rating-filter.js 5.52 kB -6 B (0%)
build/reviews-by-category.js 11.2 kB -1 B (0%)
build/reviews-frontend.js 7 kB -9 B (0%)
build/single-product-frontend.js 29.2 kB -37 B (0%)
build/single-product.js 10 kB -3 B (0%)
build/stock-filter-frontend.js 7.73 kB +81 B (+1%)
build/stock-filter.js 6.68 kB -918 B (-12%) 👏
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--04fe80d1-frontend.js 0 B -5.26 kB (removed) 🏆
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary-shipping--checkout-blocks--18f9376a-frontend.js 19.1 kB -8 B (0%)
build/vendors--cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 7.53 kB -5 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.85 kB -5 B (0%)
build/vendors--mini-cart-contents-block/footer-frontend.js 0 B -6.86 kB (removed) 🏆
build/wc-blocks-data.js 15.9 kB -60 B (0%)
build/wc-blocks-registry.js 2.92 kB +131 B (+5%) 🔍
build/wc-blocks-vendors.js 62.4 kB +367 B (+1%)
build/active-filters-wrapper-frontend.js 6 kB +6 kB (new file) 🆕
build/attribute-filter-wrapper-frontend.js 7.03 kB +7.03 kB (new file) 🆕
build/filter-wrapper-frontend.js 10.6 kB +10.6 kB (new file) 🆕
build/filter-wrapper.js 1.86 kB +1.86 kB (new file) 🆕
build/price-filter-wrapper-frontend.js 6.95 kB +6.95 kB (new file) 🆕
build/stock-filter-wrapper-frontend.js 5.99 kB +5.99 kB (new file) 🆕
build/vendors--attribute-filter-wrapper--mini-cart-contents-block/footer-frontend.js 6.86 kB +6.86 kB (new file) 🆕
build/vendors--attribute-filter-wrapper-frontend.js 8.21 kB +8.21 kB (new file) 🆕
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--671ca56f-frontend.js 5.26 kB +5.26 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
build/all-reviews.js 7.79 kB
build/cart-blocks/cart-cross-sells-frontend.js 253 B
build/cart-blocks/cart-line-items-frontend.js 1.07 kB
build/cart-blocks/order-summary-heading-frontend.js 454 B
build/cart-blocks/order-summary-subtotal-frontend.js 274 B
build/checkout-blocks/billing-address-frontend.js 925 B
build/checkout-blocks/order-summary-subtotal-frontend.js 273 B
build/checkout-blocks/shipping-address-frontend.js 1.06 kB
build/general-style-rtl.css 1.29 kB
build/general-style.css 1.29 kB
build/mini-cart-contents-block/items-frontend.js 236 B
build/mini-cart-contents-block/products-table-frontend.js 589 B
build/mini-cart-contents-block/shopping-button-frontend.js 287 B
build/price-format.js 1.19 kB
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 433 B
build/product-category.js 8.61 kB
build/product-image.js 1.61 kB
build/product-query.js 648 B
build/product-tag-list.js 497 B
build/reviews-by-product.js 12.3 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB
build/wc-blocks-editor-style-rtl.css 5.24 kB
build/wc-blocks-editor-style.css 5.24 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 932 B
build/wc-blocks-shared-context.js 1.52 kB
build/wc-blocks-shared-hocs.js 1.72 kB
build/wc-blocks-style-rtl.css 24.1 kB
build/wc-blocks-style.css 24 kB
build/wc-blocks-vendors-style-rtl.css 1.95 kB
build/wc-blocks-vendors-style.css 1.95 kB
build/wc-blocks.js 2.62 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-cod.js 909 B
build/wc-payment-method-paypal.js 837 B
build/wc-settings.js 2.6 kB

compressed-size-action

@dinhtungdu
Copy link
Member

dinhtungdu commented Sep 1, 2022

@tjcafferkey @albarin I managed to render the filter wrapper and its inner blocks on the front end. Here is how it works on 49236d8. Active Filters and Price Filters are supported for now only:

  • The woocommerce/filter-wrapper block is a parent block that contains the core/heading block and the actual filter block.
  • By default, the wrapper block is the container of the Active Filter block, other filter blocks are supported by creating variations from woocommerce/filter-wrapper.
  • The actual filter blocks are now hidden from the inserter. Users can only insert the wrapper block instead.
  • The existing filter blocks aren't affected.
  • The wrapper block provides a ref that is passed down to the filter block using context. The visibility of the wrapper block is controlled inside the actual filter block using that ref.
  • We have to use context because the inner filter block isn't the direct child of the wrapper block due to the implementation of the renderInnerBlocks.
Screen.Recording.2022-09-01.at.11.02.35.mov

There is a small blocker now that I'd love to have your feedback on. It's the block naming. In the following picture, I use two different approaches for naming wrapper and inner filter blocks:

  1. We keep the title of the filter blocks as they are, for the wrapper blocks, we prepend Wrapper to the block name. So when users search for Active filters, the only result is the Active Product Filters Wrapper.
  2. Or we prepend the Inner suffix to the filter block title. We use the current filter block title for the wrapper. Eg: When users search for Active filters from the inserter, the result is Active Product Filters as before, but what is inserted is the wrapper block instead.

Which one do you think is better? I lean toward the second one as it introduces fewer changes to the end users.

image

@albarin
Copy link
Contributor

albarin commented Sep 1, 2022

Which one do you think is better? I lean toward the second one as it introduces fewer changes to the end users.

@dinhtungdu I completely agree with you, prefer the second option, having wrapper appended would be weird for the end users.

@dinhtungdu dinhtungdu changed the title Try/filter inner blocks Filter blocks: User inner blocks for easier styling Sep 2, 2022
@dinhtungdu
Copy link
Member

dinhtungdu commented Sep 2, 2022

I completely agree with you, prefer the second option, having wrapper appended would be weird for the end users.

I updated the wrapper block to remove Wrapper from the title.

@albarin @tjcafferkey In 3ba7237 (refactored in c3b9c67), I try a different way to upgrade the block. As the existing filter blocks will continue working without users' action, I think a toolbar button to upgrade the blocks is a better way to convert the old blocks into the new wrapper blocks. Here is how it looks for the Active Filters block (I only updated that block FYI):

image

@dinhtungdu dinhtungdu changed the title Filter blocks: User inner blocks for easier styling Filter blocks: Use inner blocks Sep 2, 2022
@rubikuserbot rubikuserbot requested a review from a team October 4, 2022 10:53
@dinhtungdu
Copy link
Member

@tjcafferkey @gigitux Marking this PR ready for review as all filter blocks e2e tests have been updated. The failed tests are related to checkout and mini cart which is being addressed in #7206.

For the remaining regression in #6978 (comment):

  • I haven't found a good way to refactor block-wrapper.tsx as I commented above.
  • The variation title isn't used in the block menu: I created a PR fixing this upstream: Fix: use active variation as the parent block if available WordPress/gutenberg#44609
  • We can't limit the number of Active Filters, Price Filter, and Stock Filters blocks anymore: I also shared my thought here, but want to add more information about my research fixing it upstream. Currently, Gutenberg only supports multiple at the block level, there is no support for variation or any way to hook into (see example usage).

@tjcafferkey
Copy link
Contributor Author

I have done some user testing on this including with the classic Storefront theme as widgets and it is looking good. I am yet to review the code though as there are a lot of changes, but just to answer some of your comments above:

I haven't found a good way to refactor block-wrapper.tsx as I commented #6978 (comment).

Even though it's not idea, I don't see this as a blocker, or a regression from a users point of view. There is no reason we cannot follow this up as the value this provides to merchants and users is greater than the maintenance overhead we might inherit in my opinion.

The variation title isn't used in the block menu: I created a PR fixing this upstream: WordPress/gutenberg#44609

Nice work!

We can't limit the number of Active Filters, Price Filter, and Stock Filters blocks anymore: I also shared my thought #6978 (comment), but want to add more information about my research fixing it upstream. Currently, Gutenberg only supports multiple at the block level, there is no support for variation or any way to hook into (see example usage).

Again I do not see this as a blocker.

Great work so far @dinhtungdu, I will continue reviewing the code likely tomorrow.

"color": {
"text": true,
"background": false
}
},
"lock": false
Copy link
Contributor Author

@tjcafferkey tjcafferkey Oct 6, 2022

Choose a reason for hiding this comment

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

Just to confirm my assumption: We set the lock status to false initially for users who already have the block inserted, but once they upgrade to the new inner blocks version we set this to true so users cannot remove the inner blocks?

Copy link
Member

Choose a reason for hiding this comment

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

We're disabling the lock support which only disables the ability to toggle the lock UI of the block, not the block locking itself.

When users upgrade or add the new filter block, we lock the remove of control blocks by setting the lock attribute object.

We can skip disabling lock support here, but then users can toggle the filter control blocks locking using the lock UI.

Copy link
Member

@dinhtungdu dinhtungdu Oct 6, 2022

Choose a reason for hiding this comment

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

With lock support disabled: ("lock": false)

image

With lock support enabled: (default)

image

template={ [
[
'core/heading',
{ level: 3, content: attributes.heading || '' },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

level: 3 does this mean that even if the user has the title level heading set to Level 2 before upgrading that after the upgrade this will be changed to 3? If so, is there any reason we settled on level 3 heading?

Copy link
Member

Choose a reason for hiding this comment

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

Right, we should use the current heading level if available.

Copy link
Member

Choose a reason for hiding this comment

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

Right, we should use the current heading level if available.

We're actually doing this in assets/js/blocks/filter-wrapper/upgrade.tsx.

level: 3 does this mean that even if the user has the title level heading set to Level 2 before upgrading that after the upgrade this will be changed to 3? If so, is there any reason we settled on level 3 heading?

We specify level: 3 in the assets/js/blocks/filter-wrapper/edit.tsx as the default level for the heading block. 3 is also the current default heading level of (legacy) filter blocks.

<!-- wp:woocommerce/filter-wrapper -->
<div class="wp-block-woocommerce-filter-wrapper">
<!-- wp:heading {"level":3} -->
<h3>Active Filters</h3>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a blocker, but I wonder if internationalization is handled with these values?

Copy link
Member

Choose a reason for hiding this comment

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

Because it's a PHP file, we can use WP i18n functions here.

@tjcafferkey
Copy link
Contributor Author

The code LGTM, I've asked some questions which are non-blockers but before approving can we check out this failing test please?

Filter Products by Stock Block › attributes › product count can be toggled

Great work @dinhtungdu !

@dinhtungdu
Copy link
Member

Filter Products by Stock Block › attributes › product count can be toggled

That test isn't really failed but passed after 1 failed attempt. I'd classify it as a flaky test instead. I'm updating the PR to preserve the heading level after upgrading, let's see how the tests run then.

@dinhtungdu
Copy link
Member

@tjcafferkey Thanks for the review! fixed the i18n issue for the patterns and replied to your other comments, please take another look at this! Thank you!

@tjcafferkey
Copy link
Contributor Author

@dinhtungdu I cannot approve my own PR but this PR now LGTM! 😄 It tests well, and the code LGTM. Im not sure whether you would like to wait for @gigitux to also look over this seeing as we both worked on this PR so he may spot something we have not.

@dinhtungdu dinhtungdu requested a review from albarin October 6, 2022 13:22
@dinhtungdu
Copy link
Member

Im not sure whether you would like to wait for @gigitux to also look over this seeing as we both worked on this PR so he may spot something we have not.

I agree. Requesting another review from @albarin here because this is a pretty big PR 😄

@albarin
Copy link
Contributor

albarin commented Oct 6, 2022

@dinhtungdu @tjcafferkey Hey, I'm having a look, one thing I found is that if I insert a Filter block on trunk, change the title size (to H5 for example), then move to the PR branch, when I upgrade the block the title always is inserted as an H2. Is that the expected behavior or should it keep the size?

@dinhtungdu
Copy link
Member

@albarin Great catch! I can reproduce the issue. I used the wrong attribute name when creating the heading block 🤦🏽 . I fixed it in 4e91226.

Thank you so much!

Copy link
Contributor

@albarin albarin left a comment

Choose a reason for hiding this comment

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

Great work here, it was a challenging task! I'm approving, haven't found any more issues 🙌

@github-actions github-actions bot added this to the 8.7.0 milestone Oct 7, 2022
@tjcafferkey
Copy link
Contributor Author

Merging this, failing tests are unrelated to this PR as they are Mini Cart related.

@tjcafferkey tjcafferkey merged commit 4b2b6fb into trunk Oct 7, 2022
@tjcafferkey tjcafferkey deleted the try/filter-inner-blocks branch October 7, 2022 15:00
@wavvves wavvves added the type: enhancement The issue is a request for an enhancement. label Oct 10, 2022
senadir pushed a commit to senadir/woocommerce-blocks that referenced this pull request Nov 12, 2022
* register filter wrapper block

* register block variation

* rename the active filters wrapper

* prevent 404 error

* Revert "prevent 404 error"

This reverts commit 8b6cb7c.

* render parent wrapper block

* support price filter block

* hide the active filter block from inserter

* swap the title of wrapper and inner filter block for active filters

* hide the legacy heading for the price filter

* update block title and description for active filters and price filter

* remove heading control for price filter

* remove heading control for active filters

* update pattern

* try: upgrade button

* limit the number of inner block to 2

* prevent removing the inner filter block

* Revert "prevent removing the inner filter block"

This reverts commit 83b7fee.

* convert stock filter to inner block

* refactor block upgrade button to share between filter blocks

* update default heading

* update pattern

* update icon and title

* Fix stock filter error by importing translations package

* Upgrade Active Filters name to Active Filter Controls

* Add upgrade support to price filter

* Convert attribute filter to inner block (woocommerce#7101)

* wip: convert attribute filter to inner block

* fix: render inner attribute filter block on the front end

* refactor: inner block wrapper, extract the attribute parsing logic into a utility

Co-authored-by: Tom Cafferkey <[email protected]>

* Set correct attribute on the new filter blocks when they are upgraded

* Use the Warning component to display the upgrade message so it is consistent with Gutenberg

* address code review

* better detect legacy block to show the upgrade notice

* rename UpgradeToolbarButton to UpgradeNotice

* add upgrade notice to the stock filter block

* rename InnerBlockWrapper to BlockWrapper

* attribute-filter: control wrapper visibility

* passing block attributes down to inner active filters control block

* fix styling of inner attribute filter control block

* passing attribute to inner price filter control block

* passing down the attribute to inner stock filter control block

* remove unneccessary parsing

* use default scope for variations

* fix default attribute values

* use default block appender

* fix: lock control blocks

* remove dynamic title code from attribute filter block

* register active filters as variation and set it to the default that overrides the base block

* fix isActive for default variation

* fix: isActive logic for the active filters block

* register side effect

* fix ts error

* e2e: fix active filters block backend test

* e2e: fix frontend active filters test

* e2e: fix attribute filter test

* e2e: fix price filter test

* e2e: fix stock filter test

* e2e: update fixture

* e2e: fix attribute filter test

* remove invalid test

* e2e: update heading selector for price filter in backend test

* e2e: fixe backend price filter heading test

* fix: patterns i18n

* fix: heading level when upgrading the block

Co-authored-by: Tung Du <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement The issue is a request for an enhancement.
Projects
None yet
6 participants