feat: implement UI module with tab navigation, form handling and data visualization

This commit is contained in:
Greg 2025-05-31 08:32:50 +02:00
parent 2cb2c10482
commit 5563f7a794

View File

@ -71,9 +71,11 @@ const UI = (() => {
tabs[tabKey].btn.classList.add('active'); tabs[tabKey].btn.classList.add('active');
tabs[tabKey].content.classList.add('active'); tabs[tabKey].content.classList.add('active');
// If switching to meals tab, ensure form is populated for the current meal date // If switching to meals tab, always reset to today and autofill
if (tabKey === 'meals') { if (tabKey === 'meals') {
populateMealFormForDate(document.getElementById('meal-date').value); const todayUIDate = Utils.toUIDate(Utils.getTodayDate());
document.getElementById('meal-date').value = todayUIDate;
populateMealFormForDate(todayUIDate);
} }
}; };