Files
HydroFlux/js/app.js
2026-02-04 20:56:57 +11:00

29 lines
1.0 KiB
JavaScript

console.log('HydroFlux Initialized');
// Simple Navigation Logic
document.querySelectorAll('.nav-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
// Toggle Active State
document.querySelectorAll('.nav-btn').forEach(b => b.classList.remove('active'));
e.currentTarget.classList.add('active');
const view = e.currentTarget.dataset.view;
// Hide all sections
document.querySelectorAll('section').forEach(el => el.style.display = 'none');
// Show target section
const target = document.getElementById(`${view}-section`);
if (target) target.style.display = 'block';
});
});
// Initialize Modules
import { WaterTracker } from './modules/water.js?v=2';
import { StreakTracker } from './modules/streak.js?v=2';
import { FitnessDashboard } from './modules/fitness.js?v=2';
const waterTracker = new WaterTracker('water-section');
const streakTracker = new StreakTracker('streak-section');
const fitnessDashboard = new FitnessDashboard('fitness-section');