/** * Main Application Module * Entry point for the application, initializes all components */ document.addEventListener('DOMContentLoaded', async () => { // Initialize all modules try { await DataManager.init(); // Wait for data to be loaded and processed } catch (error) { console.error('Failed to initialize DataManager:', error); // Optionally, display an error message to the user in the UI // For example, by setting some text in a dedicated error div. // For now, we'll log and let the app proceed with potentially empty/default data. } UI.init(); Charts.init(); // Render initial data UI.renderWeightTable(); UI.renderMealTable(); // Add security information to settings tab const settingsCard = document.querySelector('#settings-content .card:last-child'); if (settingsCard) { const securitySection = document.createElement('div'); securitySection.className = 'form-group'; securitySection.innerHTML = `

Security

Your data is protected by Nginx basic authentication.

To log out, close your browser or clear your browser's authentication cache.

`; settingsCard.appendChild(securitySection); } console.log('Weight Tracker app initialized successfully'); });