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

Add Product Image Gallery #8235

Merged
merged 20 commits into from
Feb 14, 2023
Merged

Add Product Image Gallery #8235

merged 20 commits into from
Feb 14, 2023

Conversation

gigitux
Copy link
Contributor

@gigitux gigitux commented Jan 18, 2023

This PR adds the Product Image Gallery block. It is possible to add this block only on the Single Product Image Gallery thanks to this.

Block Details Preview Editor Side Frontend
image image image

Design Feedback

@vivialice could give me feedback about:

  1. Icon to use.
  2. Description.
  3. Preview on the editor side.

Notes for testing this PR.

Because of #8314, the styles of this block are not loaded. To avoid this issue, add the class product to the main div that wraps the entire page.

Fixes #8233

Testing

User Facing Testing

  1. Via Site Editor, edit the Single Product Template.
  2. Add the Product Image Gallery. Save it.
  3. On the frontend side, open a product page, check that the Product Image Gallery is loaded, and show the right images.
  4. Check that the block can be added only on the Single Product Template
  • Do not include in the Testing Notes

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

Performance Impact

Changelog

Add Product Image Gallery block.

Add Product Image Gallery
@github-actions
Copy link
Contributor

github-actions bot commented Jan 18, 2023

The release ZIP for this PR is accessible via:

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

Script Dependencies Report

There is no changed script dependency between this branch and trunk.

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

TypeScript Errors Report

  • Files with errors: 502
  • Total errors: 2353

🎉 🎉 This PR does not introduce new TS errors.

comments-aggregator

@github-actions
Copy link
Contributor

github-actions bot commented Jan 18, 2023

Size Change: +861 B (0%)

Total Size: 1.1 MB

Filename Size Change
build/active-filters.js 7.33 kB +14 B (0%)
build/all-products-frontend.js 11.7 kB +2 B (0%)
build/all-products.js 34.2 kB +497 B (+1%)
build/all-reviews.js 7.67 kB +4 B (0%)
build/attribute-filter.js 12.3 kB +19 B (0%)
build/cart.js 47 kB +16 B (0%)
build/checkout.js 43.6 kB +14 B (0%)
build/customer-account.js 3.12 kB -1 B (0%)
build/featured-product.js 13.4 kB -4 B (0%)
build/filter-wrapper-frontend.js 14.1 kB +2 B (0%)
build/filter-wrapper.js 2.4 kB +1 B (0%)
build/handpicked-products.js 7.24 kB -1 B (0%)
build/mini-cart-contents.js 17.1 kB +22 B (0%)
build/mini-cart.js 4.3 kB -4 B (0%)
build/price-filter.js 8.39 kB +23 B (0%)
build/product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00.js 253 B +25 B (+11%) ⚠️
build/product-add-to-cart.js 8.61 kB -3 B (0%)
build/product-best-sellers.js 7.6 kB -3 B (0%)
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 496 B +2 B (0%)
build/product-button.js 3.99 kB -4 B (0%)
build/product-categories.js 2.36 kB -1 B (0%)
build/product-category.js 8.58 kB -2 B (0%)
build/product-image.js 4.09 kB +4 B (0%)
build/product-new.js 7.58 kB -2 B (0%)
build/product-on-sale.js 7.91 kB +2 B (0%)
build/product-query.js 5.93 kB -3 B (0%)
build/product-rating.js 920 B +1 B (0%)
build/product-results-count.js 1.65 kB -1 B (0%)
build/product-sale-badge.js 816 B +1 B (0%)
build/product-search.js 2.63 kB -3 B (0%)
build/product-stock-indicator.js 646 B +1 B (0%)
build/product-summary.js 920 B +2 B (0%)
build/product-tag-list.js 497 B -1 B (0%)
build/product-tag.js 8.07 kB -1 B (0%)
build/product-title.js 3.46 kB -4 B (0%)
build/products-by-attribute.js 8.52 kB -1 B (0%)
build/rating-filter.js 7.39 kB +27 B (0%)
build/single-product-frontend.js 17.8 kB +5 B (0%)
build/single-product.js 9.97 kB +4 B (0%)
build/stock-filter.js 8.13 kB +22 B (0%)
build/store-notices.js 1.65 kB -3 B (0%)
build/wc-blocks-editor-style-rtl.css 5.54 kB +41 B (+1%)
build/wc-blocks-editor-style.css 5.54 kB +41 B (+1%)
build/wc-blocks-vendors.js 64.4 kB +110 B (0%)
build/wc-blocks.js 2.65 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
build/active-filters-frontend.js 7.98 kB
build/active-filters-wrapper-frontend.js 6 kB
build/attribute-filter-frontend.js 22.9 kB
build/attribute-filter-wrapper-frontend.js 7.67 kB
build/blocks-checkout.js 41.1 kB
build/breadcrumbs.js 2.05 kB
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.38 kB
build/cart-blocks/cart-cross-sells-frontend.js 253 B
build/cart-blocks/cart-cross-sells-products-frontend.js 9.69 kB
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.08 kB
build/cart-blocks/cart-express-payment-frontend.js 722 B
build/cart-blocks/cart-items-frontend.js 299 B
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.37 kB
build/cart-blocks/cart-line-items-frontend.js 1.07 kB
build/cart-blocks/cart-order-summary-frontend.js 1.24 kB
build/cart-blocks/cart-totals-frontend.js 321 B
build/cart-blocks/empty-cart-frontend.js 345 B
build/cart-blocks/filled-cart-frontend.js 654 B
build/cart-blocks/order-summary-coupon-form-frontend.js 1.64 kB
build/cart-blocks/order-summary-discount-frontend.js 2.13 kB
build/cart-blocks/order-summary-fee-frontend.js 274 B
build/cart-blocks/order-summary-heading-frontend.js 455 B
build/cart-blocks/order-summary-shipping-frontend.js 14.8 kB
build/cart-blocks/order-summary-subtotal-frontend.js 274 B
build/cart-blocks/order-summary-taxes-frontend.js 435 B
build/cart-blocks/proceed-to-checkout-frontend.js 1.24 kB
build/cart-frontend.js 28.8 kB
build/catalog-sorting.js 1.7 kB
build/checkout-blocks/actions-frontend.js 1.86 kB
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 3.92 kB
build/checkout-blocks/billing-address-frontend.js 1.18 kB
build/checkout-blocks/contact-information-frontend.js 2.05 kB
build/checkout-blocks/express-payment-frontend.js 1.13 kB
build/checkout-blocks/fields-frontend.js 344 B
build/checkout-blocks/order-note-frontend.js 1.14 kB
build/checkout-blocks/order-summary-cart-items-frontend.js 3.68 kB
build/checkout-blocks/order-summary-coupon-form-frontend.js 1.79 kB
build/checkout-blocks/order-summary-discount-frontend.js 2.3 kB
build/checkout-blocks/order-summary-fee-frontend.js 277 B
build/checkout-blocks/order-summary-frontend.js 1.25 kB
build/checkout-blocks/order-summary-shipping-frontend.js 14.9 kB
build/checkout-blocks/order-summary-subtotal-frontend.js 275 B
build/checkout-blocks/order-summary-taxes-frontend.js 435 B
build/checkout-blocks/payment-frontend.js 8.33 kB
build/checkout-blocks/pickup-options-frontend.js 2.8 kB
build/checkout-blocks/shipping-address-frontend.js 1.14 kB
build/checkout-blocks/shipping-method-frontend.js 2.27 kB
build/checkout-blocks/shipping-methods-frontend.js 4.78 kB
build/checkout-blocks/terms-frontend.js 1.56 kB
build/checkout-blocks/totals-frontend.js 324 B
build/checkout-frontend.js 30.3 kB
build/featured-category.js 13.1 kB
build/general-style-rtl.css 1.31 kB
build/general-style.css 1.31 kB
build/legacy-template.js 2.85 kB
build/mini-cart-component-frontend.js 27.9 kB
build/mini-cart-contents-block/empty-cart-frontend.js 366 B
build/mini-cart-contents-block/filled-cart-frontend.js 268 B
build/mini-cart-contents-block/footer-frontend.js 2.82 kB
build/mini-cart-contents-block/items-frontend.js 237 B
build/mini-cart-contents-block/products-table-frontend.js 590 B
build/mini-cart-contents-block/shopping-button-frontend.js 313 B
build/mini-cart-contents-block/title-frontend.js 367 B
build/mini-cart-frontend.js 2 kB
build/price-filter-frontend.js 13.9 kB
build/price-filter-wrapper-frontend.js 6.99 kB
build/price-format.js 1.19 kB
build/product-add-to-cart--product-button--product-image--product-rating--product-title.js 151 B
build/product-add-to-cart-frontend.js 6.72 kB
build/product-button--product-image--product-price--product-rating--product-sale-badge--product-title.js 258 B
build/product-button-frontend.js 2.19 kB
build/product-category-list-frontend.js 1.19 kB
build/product-category-list.js 503 B
build/product-image-frontend.js 2.19 kB
build/product-price-frontend.js 2.29 kB
build/product-price.js 1.58 kB
build/product-rating-frontend.js 1.62 kB
build/product-sale-badge-frontend.js 1.42 kB
build/product-sku-frontend.js 629 B
build/product-sku.js 377 B
build/product-stock-indicator-frontend.js 1.32 kB
build/product-summary-frontend.js 1.58 kB
build/product-tag-list-frontend.js 1.18 kB
build/product-title-frontend.js 1.62 kB
build/product-top-rated.js 7.84 kB
build/rating-filter-frontend.js 21.4 kB
build/rating-filter-wrapper-frontend.js 6.19 kB
build/reviews-by-category.js 11.2 kB
build/reviews-by-product.js 12.3 kB
build/reviews-frontend.js 7.14 kB
build/stock-filter-frontend.js 21.1 kB
build/stock-filter-wrapper-frontend.js 5.85 kB
build/vendors--attribute-filter-wrapper--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary--82e4ed06-frontend.js 6.86 kB
build/vendors--attribute-filter-wrapper--rating-filter-wrapper--stock-filter-wrapper-frontend.js 7.7 kB
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--3c5fe802-frontend.js 5.26 kB
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary-shipping--checkout-blocks--18f9376a-frontend.js 19.4 kB
build/vendors--cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 7.53 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.83 kB
build/vendors--checkout-blocks/shipping-method-frontend.js 12 kB
build/vendors--checkout-blocks/shipping-methods-frontend.js 9.48 kB
build/wc-blocks-data.js 22 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 933 B
build/wc-blocks-registry.js 3.16 kB
build/wc-blocks-shared-context.js 1.52 kB
build/wc-blocks-shared-hocs.js 1.73 kB
build/wc-blocks-style-rtl.css 26.5 kB
build/wc-blocks-style.css 26.5 kB
build/wc-blocks-vendors-style-rtl.css 1.96 kB
build/wc-blocks-vendors-style.css 1.96 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
build/wc-shipping-method-pickup-location.js 29.7 kB
build/wp-directives-runtime.js 2.4 kB
build/wp-directives-vendors.js 7.89 kB

compressed-size-action

@github-actions
Copy link
Contributor

This PR has been marked as stale because it has not seen any activity within the past 7 days. Our team uses this tool to help surface pull requests that have slipped through review.

If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label.

@github-actions github-actions bot added the status: stale Stale issues and PRs have had no updates for 60 days. label Jan 28, 2023
@gigitux gigitux removed the status: stale Stale issues and PRs have had no updates for 60 days. label Jan 30, 2023
@gigitux gigitux self-assigned this Jan 30, 2023
@gigitux gigitux force-pushed the add/8233-product-image-gallery-block branch from c768772 to 1dc7baa Compare January 30, 2023 13:51
@gigitux gigitux added type: new block Applied to work that introduces a new block (typically used on an epic issue). type: enhancement The issue is a request for an enhancement. labels Jan 30, 2023
@gigitux gigitux marked this pull request as ready for review January 30, 2023 16:01
@woocommercebot woocommercebot requested review from a team and imanish003 and removed request for a team January 30, 2023 16:01
@gigitux gigitux force-pushed the add/8233-product-image-gallery-block branch from dc64fb3 to 75d00bb Compare January 30, 2023 16:01
Copy link
Contributor

@imanish003 imanish003 left a comment

Choose a reason for hiding this comment

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

Hi @gigitux, I have tested the PR & everything is working as expected after adding product class. Excellent work 🙌🏻 💪🏻

I have left a few minor suggestions, but those shouldn't block this PR. Therefore, I am pre-approving the PR.

@gigitux
Copy link
Contributor Author

gigitux commented Jan 31, 2023

Thanks for the review and feedback! I addressed your comments.
Also, I added the custom class support via bfd2e98 commit.

@gigitux
Copy link
Contributor Author

gigitux commented Jan 31, 2023

Before merging the PR, I prefer to wait for feedback from @vivialice.

@gigitux gigitux force-pushed the add/8233-product-image-gallery-block branch from bfd2e98 to dc48ddf Compare January 31, 2023 13:53
@gigitux
Copy link
Contributor Author

gigitux commented Jan 31, 2023

@imanish003 JFYI I removed the save function because it is not necessary for the server-side blocks 👍 e526eff

} ) => {
let currentTemplateId: string | undefined;

subscribe( () => {
Copy link
Member

Choose a reason for hiding this comment

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

Could we use debounce here to make this trigger less frequent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm, I would avoid a debounce here to avoid any kind of race condition.

Copy link
Member

Choose a reason for hiding this comment

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

I'm curious what can be the race condition and its drawback. The motivation behind my suggestion is to keep the editor performant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm, for example, the user is editing another template, but the function isn't called due to the debounce and the block is still visible in the inserter.

Copy link
Member

@dinhtungdu dinhtungdu Feb 3, 2023

Choose a reason for hiding this comment

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

but the function isn't called due to the debounce

I don't think we will have this issue, as we just want to debounce them (by 100ms, for example), the subscription still triggers, but less frequently. So when the user switches to another template, the subscription may not trigger right away, but still fast enough to register/unregister the block before user interaction.

We don't have to do it now btw, we can go with the current PR and come back to this later when we see it affect the editor performance.

@vivialice
Copy link

Hey @gigitux ! 👋

For the block icon, I think it's best to use the same gallery block as core. It is in line with other feedback we have received, so that works best until we do more with this block.

I took a look at the preview, and we should align with the greys used in wireframe layouts in core. However, I did notice there are two styles being used to represent images:

Screenshot of one of the Wireframe pattern image placeholders:
Screenshot 2023-02-02 at 14 09 56

Screenshot of the Image block placeholder:
Screenshot 2023-02-02 at 14 10 31

I think it's best to align with the Wireframe style. I have created a mockup:

Screenshot 2023-02-02 at 14 12 26

Do you need an image or svg to implement the above?

For the block description, let's use Display a product's images.

@gigitux
Copy link
Contributor Author

gigitux commented Feb 2, 2023

Thanks @vivialice for the feedback! 🙇

Do you need an image or svg to implement the above?

Could you share the SVG?

@vivialice
Copy link

Sure thing! Here you go @gigitux

Download

@gigitux
Copy link
Contributor Author

gigitux commented Feb 3, 2023

Sure thing! Here you go @gigitux

Download

Ops! Sorry, I didn't specify. Could you share only this piece of the image?
image

@gigitux
Copy link
Contributor Author

gigitux commented Feb 13, 2023

Via 8aee841 I updated the package @types/wordpress__data and removed the comment that I added after this discussion.

@gigitux
Copy link
Contributor Author

gigitux commented Feb 13, 2023

@vivialice I updated the image, this is the preview:

image

I'm going to merge the PR, feel free to comment here so that I can create a follow-up PR addressing your feedback! 🙇

@gigitux gigitux force-pushed the add/8233-product-image-gallery-block branch from c9551ab to e3be328 Compare February 13, 2023 11:16
@gigitux gigitux merged commit 7a4006a into trunk Feb 14, 2023
@gigitux gigitux deleted the add/8233-product-image-gallery-block branch February 14, 2023 13:21
@gigitux gigitux added this to the 9.7.0 milestone Feb 16, 2023
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. type: new block Applied to work that introduces a new block (typically used on an epic issue).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Product Image Gallery block
4 participants