37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
/**
|
|
* 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 = `
|
|
<h3>Security</h3>
|
|
<p>Your data is protected by Nginx basic authentication.</p>
|
|
<p>To log out, close your browser or clear your browser's authentication cache.</p>
|
|
`;
|
|
settingsCard.appendChild(securitySection);
|
|
}
|
|
|
|
console.log('Weight Tracker app initialized successfully');
|
|
});
|