diff --git a/index.html b/index.html index 3630708..b73d404 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,9 @@ + + + Recipe App - Modular diff --git a/js/views/RecipeDetailV2.js b/js/views/RecipeDetailV2.js index 12caea4..0372713 100644 --- a/js/views/RecipeDetailV2.js +++ b/js/views/RecipeDetailV2.js @@ -43,6 +43,21 @@ function setTabButtonState(btn, active) { export function getRecipeDetailHTML() { return ` +
-
+

@@ -70,14 +85,10 @@ export function getRecipeDetailHTML() {
-
- - -
-
+
@@ -127,7 +138,6 @@ function populateDetail(recipeId) { } document.getElementById('rd-title').textContent = recipe.title; document.getElementById('rd-time').textContent = `${recipe.minutes} min`; - updateKcalDisplay(); const tagsHtml = []; for (const slotId of recipe.allowedSlots) { @@ -155,15 +165,6 @@ function populateDetail(recipeId) { /* ── helpers ───────────────────────────────────────────── */ -function updateKcalDisplay() { - const el = document.getElementById('rd-kcal'); - if (!el) return; - const recipe = RECIPES[currentRecipeId]; - if (!recipe) return; - const kcal = Math.round(recipe.nutritionPerServing.kcal * currentServings); - el.textContent = `${kcal} kcal`; -} - function nutritionForAmount(ingredientId, amount, unit) { const def = INGREDIENTS[ingredientId]; if (!def?.nutritionPer100g) return null; @@ -315,14 +316,12 @@ function renderIngredients(recipe) { if (currentServings <= 1) return; currentServings--; renderIngredients(recipe); - updateKcalDisplay(); }); container.querySelector('#rd-serv-plus')?.addEventListener('click', () => { if (currentServings >= 12) return; currentServings++; renderIngredients(recipe); - updateKcalDisplay(); }); container.querySelectorAll('.rd-alt-toggle').forEach((btn) => { @@ -369,8 +368,8 @@ function renderSteps(recipe) { container.innerHTML = `
${steps.map((step, i) => ` -
-
${i + 1}
+
+
${i + 1}

${escapeHtml(step)}

`).join('')}
`; @@ -400,6 +399,16 @@ export function setupRecipeDetail() { }); }); + /* ── tab-bar scroll shadow ─────────────────── */ + + const scrollContainer = document.querySelector('#recipe-detail-view .overflow-y-auto'); + const tabBar = document.getElementById('rd-tab-bar'); + if (scrollContainer && tabBar) { + scrollContainer.addEventListener('scroll', () => { + tabBar.classList.toggle('rd-scrolled', scrollContainer.scrollTop > 2); + }); + } + /* ── planner — delegate to MealPlanEditor ─────── */ document.getElementById('rd-add-to-planner-btn')?.addEventListener('click', () => {