improve product details and shopping list guidance
Android Release Build / build-android (push) Failing after 7m11s
Android Release Build / build-android (push) Failing after 7m11s
This commit is contained in:
@@ -156,6 +156,7 @@ export default function App() {
|
||||
onToggleItem={toggleListItem}
|
||||
onChangeItemQuantity={changeListItemQuantity}
|
||||
lastDeletedItem={lastDeletedListItem}
|
||||
preferences={preferences}
|
||||
shoppingList={shoppingList}
|
||||
/>
|
||||
);
|
||||
@@ -273,7 +274,12 @@ export default function App() {
|
||||
setShoppingList((current) => ({
|
||||
...current,
|
||||
items: current.items.map((item) => item.barcode === updated.barcode
|
||||
? { ...item, productName: updated.name, nutrition: updated.nutrition } : item)
|
||||
? {
|
||||
...item,
|
||||
productName: updated.name,
|
||||
nutrition: updated.nutrition,
|
||||
productFacts: listProductFacts(updated)
|
||||
} : item)
|
||||
}));
|
||||
setRoute({ name: 'productDetail', product: updated });
|
||||
}
|
||||
@@ -315,7 +321,8 @@ export default function App() {
|
||||
packageQuantityGrams: item.packageQuantityGrams ?? product.packageQuantityGrams,
|
||||
packageQuantityLabel: item.packageQuantityLabel ?? product.packageQuantityLabel,
|
||||
servingQuantityGrams: item.servingQuantityGrams ?? product.servingQuantityGrams,
|
||||
nutrition: item.nutrition ?? product.nutrition
|
||||
nutrition: { ...(item.nutrition || {}), ...(product.nutrition || {}) },
|
||||
productFacts: listProductFacts(product)
|
||||
}
|
||||
: item
|
||||
)
|
||||
@@ -331,6 +338,7 @@ export default function App() {
|
||||
packageQuantityLabel: product.packageQuantityLabel,
|
||||
servingQuantityGrams: product.servingQuantityGrams,
|
||||
nutrition: product.nutrition,
|
||||
productFacts: listProductFacts(product),
|
||||
checked: false,
|
||||
addedAt: new Date().toISOString()
|
||||
}
|
||||
@@ -544,6 +552,21 @@ function stripLegacyPriceFields(value) {
|
||||
return rest;
|
||||
}
|
||||
|
||||
function listProductFacts(product) {
|
||||
return {
|
||||
brand: product.brand,
|
||||
category: product.category,
|
||||
categoryTags: product.categoryTags,
|
||||
ingredients: product.ingredients,
|
||||
ingredientAnalysis: product.ingredientAnalysis,
|
||||
allergens: product.allergens,
|
||||
allergenTraces: product.allergenTraces,
|
||||
dataCompleteness: product.dataCompleteness,
|
||||
cacheStale: product.cacheStale,
|
||||
dataSource: product.dataSource
|
||||
};
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
backgroundColor: colors.background,
|
||||
|
||||
Reference in New Issue
Block a user