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: 4058 - expand/collapse for additional ecoscore fields #4071

Merged
merged 3 commits into from
Jun 4, 2023

Conversation

monsieurtanuki
Copy link
Contributor

What

  • Now we have an expand/collapse button at the bottom of ecoscore for the "new product" page.
  • The expanded version shows 4 new buttons: origins, labels, packaging, ingredients.
  • In the process I refactored most of the access to "edit field" pages, for consistency (e.g. centralized check if logged-in and analytics tracking).

Screenshot

collapsed expanded
Screenshot_2023-06-03-18-50-16 Screenshot_2023-06-03-18-50-27

Fixes bug(s)

Files

New file:

  • product_field_editor.dart: Helper class about product fields.

Impacted files:

  • add_new_product_page.dart: added origins, ingredients, labels and packaging in option with expand/collapse; refactored using new classes around ProductFieldEditor
  • add_ocr_button.dart: refactored using new class ProductFieldOcrEditor
  • add_packaging_button.dart: refactored using new class `ProductFieldPackagingEditor
  • app_en.arb: added one label for "additional ecoscore fields"
  • app_fr.arb: added one label for "additional ecoscore fields"
  • edit_ocr_page.dart: renamed from edit_ingredients_page.dart
  • edit_product_page.dart: refactored using new classes ProductFieldDetailsEditor, ProductFieldOcrIngredientEditor, ProductFieldPackagingEditor and ProductFieldOcrPackagingEditor
  • knowledge_panel_action_card.dart: minor refactoring
  • knowledge_panels_builder.dart: minor refactoring
  • simple_input_page_helpers.dart: added method isPopulated; minor refactoring
  • summary_card.dart: refactored using new class ProductFieldDetailsEditor

New file:
* `product_field_editor.dart`: Helper class about product fields.

Impacted files:
* `add_new_product_page.dart`: added origins, ingredients, labels and packaging in option with expand/collapse; refactored using new classes around `ProductFieldEditor`
* `add_ocr_button.dart`: refactored using new class `ProductFieldOcrEditor`
* `add_packaging_button.dart`: refactored using new class `ProductFieldPackagingEditor
* `app_en.arb`: added one label for "additional ecoscore fields"
* `app_fr.arb`: added one label for "additional ecoscore fields"
* `edit_ocr_page.dart`: renamed from `edit_ingredients_page.dart`
* `edit_product_page.dart`: refactored using new classes `ProductFieldDetailsEditor`, `ProductFieldOcrIngredientEditor`, `ProductFieldPackagingEditor` and `ProductFieldOcrPackagingEditor`
* `knowledge_panel_action_card.dart`: minor refactoring
* `knowledge_panels_builder.dart`: minor refactoring
* `simple_input_page_helpers.dart`: added method `isPopulated`; minor refactoring
* `summary_card.dart`: refactored using new class `ProductFieldDetailsEditor`
@monsieurtanuki monsieurtanuki requested a review from a team as a code owner June 3, 2023 17:03
@github-actions github-actions bot added 🌐 l10n Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 🥫 Product page summary card labels Jun 3, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2023

Codecov Report

Merging #4071 (7443772) into develop (fa570d4) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop    #4071      +/-   ##
===========================================
- Coverage    10.94%   10.93%   -0.02%     
===========================================
  Files          270      271       +1     
  Lines        13434    13453      +19     
===========================================
  Hits          1471     1471              
- Misses       11963    11982      +19     
Impacted Files Coverage Δ
.../knowledge_panels/knowledge_panel_action_card.dart 0.00% <0.00%> (ø)
.../lib/knowledge_panel/knowledge_panels_builder.dart 0.00% <0.00%> (ø)
...th_app/lib/pages/product/add_new_product_page.dart 0.00% <0.00%> (ø)
...s/smooth_app/lib/pages/product/add_ocr_button.dart 0.00% <0.00%> (ø)
...th_app/lib/pages/product/add_packaging_button.dart 0.00% <0.00%> (ø)
...app/lib/pages/product/add_simple_input_button.dart 0.00% <0.00%> (ø)
...es/smooth_app/lib/pages/product/edit_ocr_page.dart 0.00% <ø> (ø)
...mooth_app/lib/pages/product/edit_product_page.dart 0.52% <0.00%> (+0.06%) ⬆️
...th_app/lib/pages/product/product_field_editor.dart 0.00% <0.00%> (ø)
...p/lib/pages/product/simple_input_page_helpers.dart 0.00% <0.00%> (ø)
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@teolemon teolemon left a comment

Choose a reason for hiding this comment

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

This looks good functionality wise 👍

Impacted files:
* `add_simple_input_button.dart`: removed useless parameters; now uses `ProductFieldSimpleEditor`
* `edit_product_page.dart`: now uses `ProductFieldSimpleEditor`
* `product_field_editor.dart`: moved `edit` code from `simple_input_page_helpers.dart`
* `simple_input_page_helpers.dart`: moved code to `product_field_editor.dart`
@monsieurtanuki monsieurtanuki merged commit 30be338 into openfoodfacts:develop Jun 4, 2023
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your review!

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

Successfully merging this pull request may close these issues.

Visual touch up for the product addition Misleading file name
3 participants