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

🚧 Products v3: viewing, searching, filtering & pagination #11163

Conversation

jibees
Copy link
Contributor

@jibees jibees commented Jul 6, 2023

What? Why?

This PR introduce the first bunch of features for the new products V3 page, under the admin_style_v3 feature toggle.

Capture d’écran 2023-07-11 à 09 31 40 Capture d’écran 2023-07-11 à 09 31 44 Capture d’écran 2023-07-11 à 09 31 55 Capture d’écran 2023-07-11 à 09 32 12

Includes:

What should we test?

There are extensive acceptance criteria on each of the issues listed above (although they behave as you'd expect). The first two had been merged already but haven't yet been tested. Please review each of these, and provide any feedback you might have.

Release notes

Changelog Category: User facing changes, under feature toggle

@jibees jibees force-pushed the productsV3-searching-filtering-pagination branch 2 times, most recently from 1f6f60a to 4ab89dc Compare July 6, 2023 08:01
@jibees jibees removed a link to an issue Jul 6, 2023
11 tasks
@jibees jibees self-assigned this Jul 11, 2023
@jibees jibees changed the title Products v3: searching filtering pagination 🚧 Products v3: viewing, searching, filtering & pagination Jul 11, 2023
@jibees jibees force-pushed the productsV3-searching-filtering-pagination branch from 4ab89dc to d9ba104 Compare July 11, 2023 07:30
@jibees jibees marked this pull request as ready for review July 11, 2023 07:39
Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

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

Phew, epic job!
As you're aware, it was hard to review as there's a lot of commits and changes. I've got some suggestions, and various comments. I would have gone ahead and tried these out but I'm afraid I've run out of time today.

I also think it will help to pull out my unrelated commits, particularly because one has an effect outside of the feature toggle that will be worth a quick test (I don't want to break the admin interface again!). I'll go ahead with that, and update this branch (and squash a few fixup commits).

app/webpacker/css/admin_v3/components/navigation.scss Outdated Show resolved Hide resolved
Comment on lines +209 to +211
table + .pagination {
margin-top: -18px;
}
Copy link
Member

Choose a reason for hiding this comment

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

Hmm that's a tricky one.
I think ideally tables should have a wrapper that applies the large margin, and pagination could go inside the wrapper. Let's solve that in a future update.

app/reflexes/products_reflex.rb Show resolved Hide resolved
app/reflexes/products_reflex.rb Outdated Show resolved Hide resolved
app/reflexes/products_reflex.rb Outdated Show resolved Hide resolved
app/reflexes/products_reflex.rb Outdated Show resolved Hide resolved
app/reflexes/products_reflex.rb Show resolved Hide resolved
app/webpacker/css/admin_v3/all.scss Outdated Show resolved Hide resolved
@dacook dacook force-pushed the productsV3-searching-filtering-pagination branch from d9ba104 to 9b92996 Compare July 12, 2023 06:26
@jibees jibees force-pushed the productsV3-searching-filtering-pagination branch from b401a2b to 0620ebe Compare July 12, 2023 08:03
@jibees
Copy link
Contributor Author

jibees commented Jul 12, 2023

Hi @dacook ! Thanks for this deep review. All the thumbs-up-ed comment you've made have been addressed. I let you resolve the one the want to resolve ;)

Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

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

Thanks JB, great work.

I just booted it up in my dev environment and it's so beautiful and fast.. 🤩

I think for a second review, it would be better to have a fresh perspective and look at the overall diff on the Files changed tab, rather than review all the commits.

@dacook
Copy link
Member

dacook commented Jul 12, 2023

I've updated the testing notes to point to the acceptance criteria of each issue. I also re-ordered the list based on the order they were created.

Copy link
Member

@mkllnk mkllnk 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! 💪 ✨

app/reflexes/products_reflex.rb Show resolved Hide resolved
app/reflexes/products_reflex.rb Show resolved Hide resolved
Comment on lines 103 to 105
# rubocop:disable Layout/LineLength
query.merge!(name_or_meta_keywords_or_variants_display_as_or_variants_display_name_or_supplier_name_cont: @search_term)
# rubocop:enable Layout/LineLength
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# rubocop:disable Layout/LineLength
query.merge!(name_or_meta_keywords_or_variants_display_as_or_variants_display_name_or_supplier_name_cont: @search_term)
# rubocop:enable Layout/LineLength
search_key = %w[
name
meta_keywords
# ...
].join("_or_") + "_cont"
query.merge!(search_key => @search_term)

This could also be a constant on the variant model.

Copy link
Contributor Author

@jibees jibees Jul 17, 2023

Choose a reason for hiding this comment

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

👌 75f7e0a

@jibees jibees force-pushed the productsV3-searching-filtering-pagination branch 4 times, most recently from cd95eeb to 59cb086 Compare July 19, 2023 09:35
 - Increase top menu underline height to 3px
 - reduce underline width to same width of label
as they are the same, expect the font-size
content (header, navigation, content) on both left and right
+ change height for border bottom on selected/hovered menu
For `admin_style_v3` use `<` and `>` for next and previous link

instead of `next` and `previous` string

Extract a mixin for a default box-shadow

Maybe this needs to be redefined. Let's see how next things goes.

When a table is followed by a pagination, remove its margin-bottom + border

Finally, design the pagination component

Add sorting/pagination module, on top of table

We use `cablea_ready.replace`, so need to add `#products-content` id

Use a `pagy` partial with reflex action, instead of the legacy one

- revert the legacy one to its previous state
 - in reflex, fetch product with page attribute, 1 by default

Move `pagy` into `admin/shared/v3/` to be reusable

+ use fontawesome icons for next and previous page

Remove useless line
@jibees jibees force-pushed the productsV3-searching-filtering-pagination branch from 23c9286 to 5d4ef5b Compare July 19, 2023 12:58
@jibees
Copy link
Contributor Author

jibees commented Jul 19, 2023

This one has already two approval reviews, but I'd be happy if @mkllnk and @dacook could see my comments and approve (or not). Back in Code Review then.

@jibees jibees mentioned this pull request Jul 21, 2023
@RachL RachL self-assigned this Jul 23, 2023
@RachL RachL added pr-staged-fr staging.coopcircuits.fr blocked and removed pr-staged-fr staging.coopcircuits.fr labels Jul 23, 2023
@jibees jibees removed the blocked label Jul 25, 2023
@jibees
Copy link
Contributor Author

jibees commented Jul 25, 2023

No more blocked since this PR will close #11268 (we cherry picked the commit from #11269 )

@RachL RachL added pr-staged-fr staging.coopcircuits.fr and removed pr-staged-fr staging.coopcircuits.fr labels Jul 25, 2023
And do not apply `a` style to `.button` element.

ie.
```
a:not(.button)
```
@RachL RachL added pr-staged-fr staging.coopcircuits.fr and removed pr-staged-fr staging.coopcircuits.fr labels Jul 25, 2023
@RachL
Copy link
Contributor

RachL commented Jul 25, 2023

OK there are some stuff to fine tune, but as it's behind a feature toggle and this PR is already monstrously huge, let's unblocked this work! @jibees you can merge 💪

@RachL RachL removed the pr-staged-fr staging.coopcircuits.fr label Jul 25, 2023
@jibees jibees merged commit 605cb73 into openfoodfoundation:master Jul 25, 2023
52 checks passed
@dacook
Copy link
Member

dacook commented Jul 25, 2023

Hooray!

Just to confirm, were the eight issues (listed in the description above, now closed) tested to pass?

@RachL
Copy link
Contributor

RachL commented Jul 26, 2023

@dacook yes apart from error page display due to fail in the background which I don't know how to reproduce.
Not everything was working perfectly, but new issues will be open. In the future, it would help testers to have 1PR = 1 issue, this was hard to test and keep track :/

dacook added a commit to dacook/openfoodnetwork that referenced this pull request Mar 7, 2024
dacook added a commit to dacook/openfoodnetwork that referenced this pull request Mar 7, 2024
dacook added a commit to dacook/openfoodnetwork that referenced this pull request Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment