Improve pantry view

This commit is contained in:
2026-03-24 23:15:56 +01:00
parent 8672c8da28
commit 21901c6147
3 changed files with 270 additions and 40 deletions

View File

@@ -248,9 +248,10 @@ export function addOrMergeShoppingLines(lines, listId = KITCHEN_LIST_ID) {
}
/**
* Jedna sztuka / domyślna jednostka magazynowa — na listę kuchenną ze spiżarni.
* Na listę kuchenną ze spiżarni (amount w pantryUnit: g, ml lub szt.).
* @param {string} [sourceNote] — nadpisuje domyślne „Ze spiżarni”
*/
export function addIngredientToKitchenList(ingredientId, amount = 1) {
export function addIngredientToKitchenList(ingredientId, amount = 1, sourceNote) {
const def = INGREDIENTS[ingredientId];
if (!def) return;
const unit = displayUnit(def.pantryUnit);
@@ -260,7 +261,7 @@ export function addIngredientToKitchenList(ingredientId, amount = 1) {
unit,
name: def.name,
category: def.category,
sourceNote: 'Ze spiżarni',
sourceNote: sourceNote ?? 'Ze spiżarni',
}], KITCHEN_LIST_ID);
}