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

feat: 4889 - new simplified nutriscore widget #4890

Closed
wants to merge 13 commits into from

Conversation

monsieurtanuki
Copy link
Contributor

What

  • This PR adds a simplified version of the nutriscore display conform to the big redesign, on top of the KP and only if the "reordering KP" flag is set on DEV mode.
  • While coding, several questions:
    • Should we try to be a11n compliant? At least I tried with colors AND icons. Can easily be turned off back to "just the color"
    • We don't have any localizations for "salt", and I don't know if we should expect them from the server or if we should localize them in the app
    • I had to extract the data from the server (e.g. "1.2%") - again, should the server provide us with that raw data?
  • The simplified nutriscore is about 50% less tall than the current version. That goes in the right direction.

Screenshots

test 1 test 2
Screenshot_1702216863 Screenshot_1702217770

Fixes bug(s)

Files

New files:

  • evaluation_extension.dart: a11y helper for Evaluation.
  • knowledge_panel_enum.dart: Helper around knowledge panel ids.
  • knowledge_panel_simplified_row.dart: Row that displays two widgets on same width columns (half max width).
  • knowledge_panel_simplified_title.dart: Full width title for a simplified knowledge panel.
  • knowledge_panel_simplified_widget.dart: Simplified widget for knowledge panel.
  • nutriscore_simplified_widget.dart: Simplified nutriscore widget, with nutriscore and 4 other attributes.

Impacted files:

  • knowledge_panel_title_card.dart: moved code to new class EvaluationExtension
  • new_product_page.dart: added simplified nutriscore widget triggered by dev mode only
  • reorderable_knowledge_panel_page.dart: minor refactoring using new class KnowledgePanelEnum

New files
* `evaluation_extension.dart`: a11y helper for Evaluation.
* `knowledge_panel_enum.dart`: Helper around knowledge panel ids.
* `knowledge_panel_simplified_row.dart`: Row that displays two widgets on same width columns (half max width).
* `knowledge_panel_simplified_title.dart`: Full width title for a simplified knowledge panel.
* `knowledge_panel_simplified_widget.dart`: Simplified widget for knowledge panel.
* `nutriscore_simplified_widget.dart`: Simplified nutriscore widget, with nutriscore and 4 other attributes.

Impacted files:
* `knowledge_panel_title_card.dart`: moved code to new class `EvaluationExtension`
* `new_product_page.dart`: added simplified nutriscore widget triggered by dev mode only
* `reorderable_knowledge_panel_page.dart`: minor refactoring using new class `KnowledgePanelEnum`
@monsieurtanuki monsieurtanuki requested a review from a team as a code owner December 10, 2023 14:17
@github-actions github-actions bot added 🥫 Product page Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 📖 Knowledge panels labels Dec 10, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2023

Codecov Report

Attention: 125 lines in your changes are missing coverage. Please review.

Comparison is base (85784fa) 9.62% compared to head (866fab4) 9.56%.

Files Patch % Lines
...ig_redesign/knowledge_panel_simplified_widget.dart 0.00% 54 Missing ⚠️
...big_redesign/knowledge_panel_simplified_title.dart 0.00% 26 Missing ⚠️
...uct/big_redesign/nutriscore_simplified_widget.dart 0.00% 17 Missing ⚠️
...ges/product/big_redesign/evaluation_extension.dart 0.00% 14 Missing ⚠️
...t/big_redesign/knowledge_panel_simplified_row.dart 0.00% 8 Missing ⚠️
...l/knowledge_panels/knowledge_panel_title_card.dart 0.00% 2 Missing ⚠️
...smooth_app/lib/pages/product/new_product_page.dart 0.00% 2 Missing ⚠️
...ages/product/reorderable_knowledge_panel_page.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #4890      +/-   ##
==========================================
- Coverage     9.62%   9.56%   -0.06%     
==========================================
  Files          323     328       +5     
  Lines        16267   16366      +99     
==========================================
  Hits          1565    1565              
- Misses       14702   14801      +99     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@teolemon
Copy link
Member

Hey @monsieurtanuki :-)

@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your comment!
I started this PR in order to check what was missing (cf. my comments in the OP) and to begin somehow.
If we're waiting for all the stars to align before doing anything we may wait way too long. Another added value of starting a bit early is to fuel the needs for features (instead of saying "btw some day we'll need this and that").
In the same spirit, if this PR is merged, we'll have a good reason to implement the tabs.

@monsieurtanuki
Copy link
Contributor Author

I created this PR one month ago and there's not much activity around it.
Feel free to close it if after all it's not relevant. You may approve it too :)

@teolemon
Copy link
Member

@g123k @monsieurtanuki We discussed the square layout yesterday in the Product Opener call. John is going to work on it, we made the necessary decision, and hopefully it will arrive soon.
We also felt it was necessary to uncouple the a11y decision, although we discussed it along the way. There are several options (smileys, thumbs up and down, or simply unambiguous text) and there's no agreement on it. We also want to bring the website on the same level.

@monsieurtanuki monsieurtanuki marked this pull request as draft January 17, 2024 11:02
@monsieurtanuki
Copy link
Contributor Author

Closing as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 Knowledge panels Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 🥫 Product page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display simplified nutriscore widget
3 participants