updated web interface - v3

This commit is contained in:
2025-08-19 07:09:23 -07:00
parent 07d19cfd7a
commit b77dbdcc23
24 changed files with 2727 additions and 445 deletions

View File

@@ -0,0 +1,52 @@
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();
});