+
@@ -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}
+
`).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', () => {