Reorganise the views and prepare summary
All checks were successful
Build and Deploy / build-and-push (push) Successful in 23s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 23s
This commit is contained in:
@@ -296,6 +296,20 @@ export function toggleItemInList(listId, itemId) {
|
||||
return s;
|
||||
}
|
||||
|
||||
export function updateKitchenItemAmount(listId, itemId, newAmount) {
|
||||
const s = loadShoppingState();
|
||||
const list = s.lists.find((l) => l.id === listId && l.type === 'kitchen');
|
||||
if (!list) return s;
|
||||
const it = /** @type {KitchenShoppingItem[]} */ (list.items).find((i) => i.id === itemId);
|
||||
if (!it) return s;
|
||||
it.amount = Math.max(0, Math.round(newAmount * 100) / 100);
|
||||
if (it.amount <= 0) {
|
||||
list.items = list.items.filter((i) => i.id !== itemId);
|
||||
}
|
||||
saveShoppingState(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
export function removeItemFromList(listId, itemId) {
|
||||
const s = loadShoppingState();
|
||||
const list = s.lists.find((l) => l.id === listId);
|
||||
|
||||
Reference in New Issue
Block a user