Files
FitTrack_ReportGenerator/examples/GarminSync/garminsync/web/static/navigation.js
sstent 9e0bd322d3 feat: Initial implementation of FitTrack Report Generator
This commit introduces the initial version of the FitTrack Report Generator, a FastAPI application for analyzing workout files.

Key features include:
- Parsing of FIT, TCX, and GPX workout files.
- Analysis of power, heart rate, speed, and elevation data.
- Generation of summary reports and charts.
- REST API for single and batch workout analysis.

The project structure has been set up with a `src` directory for core logic, an `api` directory for the FastAPI application, and a `tests` directory for unit, integration, and contract tests.

The development workflow is configured to use Docker and modern Python tooling.
2025-10-11 09:54:13 -07:00

53 lines
1.5 KiB
JavaScript

class Navigation {
constructor() {
this.currentPage = this.getCurrentPage();
this.render();
}
getCurrentPage() {
return window.location.pathname === '/activities' ? 'activities' : 'home';
}
render() {
const nav = document.querySelector('.navigation');
if (nav) {
nav.innerHTML = this.getNavigationHTML();
this.attachEventListeners();
}
}
getNavigationHTML() {
return `
<nav class="nav-tabs">
<button class="nav-tab ${this.currentPage === 'home' ? 'active' : ''}"
data-page="home">Home</button>
<button class="nav-tab ${this.currentPage === 'activities' ? 'active' : ''}"
data-page="activities">Activities</button>
</nav>
`;
}
attachEventListeners() {
const tabs = document.querySelectorAll('.nav-tab');
tabs.forEach(tab => {
tab.addEventListener('click', (e) => {
const page = e.target.getAttribute('data-page');
this.navigateToPage(page);
});
});
}
navigateToPage(page) {
if (page === 'home') {
window.location.href = '/';
} else if (page === 'activities') {
window.location.href = '/activities';
}
}
}
// Initialize navigation when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
new Navigation();
});