Skip to content

[Grid view] Display product as a grid#14345

Open
rioug wants to merge 36 commits into
openfoodfoundation:masterfrom
rioug:14000-grid-view
Open

[Grid view] Display product as a grid#14345
rioug wants to merge 36 commits into
openfoodfoundation:masterfrom
rioug:14000-grid-view

Conversation

@rioug

@rioug rioug commented May 28, 2026

Copy link
Copy Markdown
Collaborator

⚠️ use clockify code Roadmap 2026: #84 - Grid view when working on this ⚠️

What? Why?

First step of Grid view, this PR show a basic grid view limited to one page and 10 products max. There are now variant information for now. This PR also include some refactor around tooltip, it makes the TooltipComponent available to the frontend.

What should we test?

Make sure to enable the product_grid_view feature

With a shop with one order cycle open:

  • Load the shop page
    -> products should be displayed as a grid
gird_desktop
  • Click on image/text
    -> product overlay should display product information
  • Hover over product or enterprise property
    -> Tool tip shows
desktop-overlay

With a shop with multiple order cycle open:

  • Load the shop page and choose an order cycle
    -> products should be displayed as a grid
  • Change the selected order cycle
    -> product list should update and products should be displayed as a grid

Try with different grid size, mobile examples :

grid_mobile mobile_overlay

Tooltip

This PR includes some changes around tooltip :

  • check they are still displaying as expected in the backoffice (enterprise edit page is a good place to check).

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

rioug added 2 commits May 22, 2026 16:35
It makes product grid view feature flag available to angularJS
@github-project-automation github-project-automation Bot moved this to All the things 💤 in OFN Delivery board May 28, 2026
@rioug rioug added the feature toggled These pull requests' changes are invisible by default and are grouped in release notes label May 28, 2026
@rioug rioug moved this from All the things 💤 to In Progress ⚙ in OFN Delivery board May 28, 2026
@rioug

rioug commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

@mariocarabotta For the product overlay, I reused the template from the product preview in the backoffice, so it's slightly different. The main difference is the close button instead of the X in the corner we have currently.
Current overlay:
current_overlay

@rioug rioug marked this pull request as ready for review May 28, 2026 06:07
@rioug rioug force-pushed the 14000-grid-view branch from 5be52c1 to 6c101f0 Compare May 28, 2026 06:08
@rioug rioug moved this from In Progress ⚙ to Code review 🔎 in OFN Delivery board May 28, 2026
rioug added 14 commits May 28, 2026 16:09
It renders a mostly empty turbo-frame for now. It's going to be used to
wire the product grid view to the frontend
We don't need to load the product, as they will be displayed via the
ProductsController. This is a bit hacky and we might still need to load
products, time will tell.
The turbo-frame will load data automatically, and it will refresh when
the order cycle is changed. It nicely leverage turbo-frame so we don't
have to load data via "manually" adding AJAX request.
Which incidentally makes the spec better, we can now remove the use of
`__send__`
We reuse the ProductsRenderer to keep the same loading logic. For
experimentation purposes, we only load one page with 10 products.
I have tried leveraging modern CSS/Sass
It re uses the template created for the product preview, which is now in
its own partial.
- Make it a bit rounded
- Start at the start of the parent element, so it doesn't disappear when
  parent element next to the modal border. shift() middleware doesn't
  seem to work as expected
I am not exactly sure how to test that product don't load when the
feature is enabled, but I don't want to waste time trying to figure it
out.
@mariocarabotta

mariocarabotta commented May 28, 2026

Copy link
Copy Markdown
Collaborator

@mariocarabotta For the product overlay, I reused the template from the product preview in the backoffice, so it's slightly different. The main difference is the close button instead of the X in the corner we have currently. Current overlay: current_overlay

got it! I will review better when it comes through to testing, for now it sounds good. I didn't realise you would have had to rebuild the overlay too. @chahmedejaz is also touching that part of the code for the multiple images carousel. Is that going to be an issue?

@chahmedejaz

Copy link
Copy Markdown
Collaborator

I think we may have a bit of conflict, @mariocarabotta but it shouldn't be that serious. So we should be able to handle it. 👍🏻

@mkllnk mkllnk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice commit history. And it seems to be a good entry point to choose the product rendering layout on order cycle select. Just one question about caching below.

Comment thread app/helpers/injection_helper.rb Outdated
Comment thread app/views/shop/products/_form.html.haml Outdated
@@ -1,5 +1,5 @@
- # NOTE: make sure that any changes in this template are reflected in app/views/admin/products_v3/product_preview.turbo_stream.haml
= cache_with_locale do
= cache_with_locale(current_order_cycle&.id) do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to cache by feature toggle as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we should, now that I think about it a bit more I am not sure the order cycle is needed but I'll double check that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I reviewed the cache key and made it feature aware, see: 24f3fbe

Comment thread spec/requests/products_spec.rb Outdated
Comment thread app/webpacker/controllers/product_grid_view_controller.js
@rioug rioug moved this from In Progress ⚙ to Code review 🔎 in OFN Delivery board Jun 5, 2026
rioug added 5 commits June 14, 2026 10:47
Do not use a link tag if no link provided
Replace old angular tooltip by the new stimulus based one.
And fix the styling for product preview
Update all "What's this ?" by the new component on the admin enterprise
form.
@rioug rioug force-pushed the 14000-grid-view branch from 405d7cf to b070c3a Compare June 14, 2026 00:48

@dacook dacook left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cool, thanks for continuing the clean up, looks like a good end result! 👍

@dacook dacook moved this from Code review 🔎 to Test Ready 🧪 in OFN Delivery board Jun 15, 2026
@mariocarabotta mariocarabotta added the pr-staged-au staging.openfoodnetwork.org.au label Jun 19, 2026
@mariocarabotta

mariocarabotta commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

thanks for continuing the work on this. Please find below some feedback, I think apart from those 2 things it's pretty much good to go from a visual point of view.

  1. description links in the overlay should be styled as links. See this shop, Shiitake for an example. All the other elements seem to be working well.
  2. when there is a lot of content (see shiitake) scrolling within the overlay doesn't get to the Close button. Maybe there's something related to this fix from Ahmed.

Lastly, search and filters don't work, but I have created a separate issue to address that.
Same for pagination (displaying all products and not just 10) here.

Thank you!

@rioug rioug moved this from Test Ready 🧪 to In Progress ⚙ in OFN Delivery board Jun 19, 2026
@rioug rioug added no-staging-AU A tag which does not trigger deployments, indicating a server is being used and removed pr-staged-au staging.openfoodnetwork.org.au labels Jun 19, 2026
@rioug

rioug commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator Author

2. when there is a lot of content (see shiitake) scrolling within the overlay doesn't get to the Close button. Maybe there's something related to this fix from Ahmed.

It's probably unrelated, as the overlay for the grid uses different code.

It was originally added to fix some issue with the product properties,
but product properties don't use link anymore so we can remove the
styling.
@rioug rioug added pr-staged-au staging.openfoodnetwork.org.au and removed no-staging-AU A tag which does not trigger deployments, indicating a server is being used labels Jun 19, 2026
This is to make sure the close button doesn't get cut off on mobile
devices.
@rioug rioug removed the pr-staged-au staging.openfoodnetwork.org.au label Jun 19, 2026
@rioug

rioug commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator Author

@mariocarabotta I fixed the last 2 design issue, reading for testing.

@rioug rioug moved this from In Progress ⚙ to Code review 🔎 in OFN Delivery board Jun 22, 2026
@dacook dacook moved this from Code review 🔎 to Test Ready 🧪 in OFN Delivery board Jun 22, 2026
@mariocarabotta mariocarabotta added the pr-staged-au staging.openfoodnetwork.org.au label Jun 23, 2026
@mariocarabotta

Copy link
Copy Markdown
Collaborator

@mariocarabotta I fixed the last 2 design issue, reading for testing.

good to go from my side!

something I've noticed in scrolling behaviour in the overlay: the position gets retained as I close and then re-open the overlay. I would say it's not a problem, just letting testers know.

I will still leave testers review this as well.

Thanks!

@mariocarabotta mariocarabotta removed the pr-staged-au staging.openfoodnetwork.org.au label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature toggled These pull requests' changes are invisible by default and are grouped in release notes

Projects

Status: Test Ready 🧪

Development

Successfully merging this pull request may close these issues.

As a shopper I want to see products in shops as a grid

5 participants