Refactor profile screen layout and user preference handling
Android Release Build / build-android (push) Successful in 13m44s

This commit is contained in:
2026-10-16 18:02:09 +02:00
parent 42376e61f7
commit 8754430ee1
5 changed files with 80 additions and 14 deletions
+13
View File
@@ -138,6 +138,7 @@ export default function App() {
onStartScan={() => setActiveTab('scan')}
onOpenProfile={() => setActiveTab('profile')}
onToggleItem={toggleListItem}
onChangeItemQuantity={changeListItemQuantity}
onUpdateItemPrice={updateListItemPrice}
preferences={preferences}
lastDeletedItem={lastDeletedListItem}
@@ -269,6 +270,7 @@ export default function App() {
? {
...item,
quantity: item.quantity + 1,
checked: false,
packageQuantityGrams: item.packageQuantityGrams ?? product.packageQuantityGrams,
packageQuantityLabel: item.packageQuantityLabel ?? product.packageQuantityLabel,
servingQuantityGrams: item.servingQuantityGrams ?? product.servingQuantityGrams,
@@ -337,6 +339,17 @@ export default function App() {
}));
}
function changeListItemQuantity(itemId, change) {
setShoppingList((current) => {
const items = current.items.map((item) =>
item.id === itemId
? { ...item, quantity: Math.max(1, (item.quantity || 1) + change) }
: item
);
return { ...current, items, estimatedTotal: calculateEstimatedTotal(items) };
});
}
function deleteListItem(itemId) {
const index = shoppingList.items.findIndex((item) => item.id === itemId);
if (index < 0) return;