38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
/**
|
|
* Main Application Module
|
|
* Entry point for the application, initializes all components
|
|
*/
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
// Initialize authentication first
|
|
Auth.init();
|
|
|
|
// Initialize all other modules
|
|
DataManager.init();
|
|
UI.init();
|
|
Charts.init();
|
|
|
|
// Render initial data
|
|
UI.renderWeightTable();
|
|
UI.renderMealTable();
|
|
|
|
// Add logout button to settings tab
|
|
const settingsCard = document.querySelector('#settings-content .card:last-child');
|
|
if (settingsCard) {
|
|
const logoutSection = document.createElement('div');
|
|
logoutSection.className = 'form-group';
|
|
logoutSection.innerHTML = `
|
|
<h3>Security</h3>
|
|
<p>Log out of your weight tracker application</p>
|
|
<button id="logout-button" class="btn secondary-btn">Logout</button>
|
|
`;
|
|
settingsCard.appendChild(logoutSection);
|
|
|
|
// Add logout functionality
|
|
document.getElementById('logout-button').addEventListener('click', () => {
|
|
Auth.logout();
|
|
});
|
|
}
|
|
|
|
console.log('Weight Tracker app initialized successfully');
|
|
});
|