From bac9485e4e357f61d4fdca77c8c57bde7b5e14a3 Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Mon, 25 May 2026 10:20:17 +0000 Subject: [PATCH] fix: hide ingredients panel in cooking mode Ingredients are already shown (with use buttons) in the recipe result screen. In cooking mode only steps should appear. --- assets/js/app.js | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index d2aad53..afb56d7 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -13619,40 +13619,9 @@ function renderCookingStep() { }).join(''); } - // Show ALL unused from_pantry ingredients only on the first step. - // On subsequent steps the ingredient panel stays hidden to avoid distraction. - const ings = _cookingStep === 0 - ? (_cookingRecipe.ingredients || []) - .map((ing, idx) => ({ ...ing, _idx: idx })) - .filter(ing => ing.from_pantry && ing.product_id && ing.used !== true) - : []; - + // Ingredients are shown in the recipe view only, not in cooking mode. const ingsEl = document.getElementById('cooking-step-ings'); - if (ings.length > 0) { - const cookingLocLabels = Object.fromEntries(Object.entries(LOCATIONS).map(([k,v]) => [k, `${v.icon} ${v.label}`])); - ingsEl.innerHTML = ings.map(ing => { - const loc = (ing.location || 'dispensa').replace(/'/g, "\\'"); - const qtyNum = Math.round((ing.qty_number || 0) * 10) / 10; - // Build info chips: brand, location, expiry - const chips = []; - if (ing.brand) chips.push(`${escapeHtml(ing.brand)}`); - const locLabel = cookingLocLabels[ing.location] || (ing.location ? `📍 ${ing.location}` : `${LOCATIONS.dispensa.icon} ${LOCATIONS.dispensa.label}`); - chips.push(`${locLabel}`); - if (ing.expiry_date) { - const daysLeft = Math.round((new Date(ing.expiry_date) - new Date()) / 86400000); - const expClass = daysLeft <= 3 ? 'exp-soon' : daysLeft <= 7 ? 'exp-close' : ''; - chips.push(`📅 ${t('cooking.expires_chip').replace('{date}', formatDate(ing.expiry_date))}`); - } - return `
-
- 📦 ${escapeHtml(ing.name)}: ${escapeHtml(ing.qty)} -
${chips.join('')}
-
- -
`; - }).join(''); - ingsEl.style.display = 'flex'; - } else { + if (ingsEl) { ingsEl.innerHTML = ''; ingsEl.style.display = 'none'; }