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: 5621 - "road to scores" label now depends on OxF #5772

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@
"description": "Button at the end of new product page, that takes you to completed product"
},
"hey_incomplete_product_message": "Tap to answer 3 questions NOW to compute Nutri-Score, Eco-Score & Ultra-processing (NOVA)!",
"hey_incomplete_product_message_beauty": "Tap now to answer 2 questions to help analyze this cosmetic!",
"hey_incomplete_product_message_pet_food": "Tap now to answer 3 questions to help analyze this pet food product!",
"hey_incomplete_product_message_product": "Tap now to help complete this product!",
"nutritional_facts_photo_uploaded": "Nutrition facts photo uploaded",
"@nutritional_facts_photo_uploaded": {},
"recycling_photo_button_label": "Recycling photo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:smooth_app/helpers/analytics_helper.dart';
import 'package:smooth_app/pages/product/add_new_product_page.dart';
import 'package:smooth_app/pages/product/product_field_editor.dart';
import 'package:smooth_app/pages/product/simple_input_page_helpers.dart';
import 'package:smooth_app/query/product_query.dart';

/// "Incomplete product!" card to be displayed in product summary, if relevant.
///
Expand Down Expand Up @@ -99,7 +100,11 @@ class ProductIncompleteCard extends StatelessWidget {
child: ElevatedButton.icon(
label: Padding(
padding: const EdgeInsets.symmetric(vertical: SMALL_SPACE),
child: Text(appLocalizations.hey_incomplete_product_message),
child: Text(
(product.productType ?? ProductType.food).getRoadToScoreLabel(
appLocalizations,
),
),
),
icon: const Icon(
Icons.bolt,
Expand Down
11 changes: 11 additions & 0 deletions packages/smooth_app/lib/query/product_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,15 @@ extension ProductTypeExtension on ProductType {
ProductType.petFood => appLocalizations.product_type_label_pet_food,
ProductType.product => appLocalizations.product_type_label_product,
};

String getRoadToScoreLabel(final AppLocalizations appLocalizations) =>
switch (this) {
ProductType.food => appLocalizations.hey_incomplete_product_message,
ProductType.beauty =>
appLocalizations.hey_incomplete_product_message_beauty,
ProductType.petFood =>
appLocalizations.hey_incomplete_product_message_pet_food,
ProductType.product =>
appLocalizations.hey_incomplete_product_message_product,
};
}