/* ═══════════════════════════════════════════════════════════ Commander AI Lab — Shared Navigation Component ═══════════════════════════════════════════════════════════ */ (function() { const NAV_ITEMS = [ { href: 'index.html', label: 'Batch Sim', icon: 'beaker' }, { href: 'collection.html', label: 'Collection', icon: 'stack' }, { href: 'deckbuilder.html', label: 'Decks', icon: 'cards' }, { href: 'deckgenerator.html', label: 'Auto Gen', icon: 'sparkle' }, { href: 'simulator.html', label: 'Simulator', icon: 'play' }, { href: 'coach.html', label: 'Coach', icon: 'brain' }, { href: 'training.html', label: 'Training', icon: 'chart' }, { href: 'distillation.html', label: 'Distill', icon: 'loop' }, ]; const ICONS = { beaker: '', stack: '', cards: '', sparkle: '', play: '', brain: '', loop: '', chart: '', }; const BRAND_LOGO = ''; function getCurrentPage() { const path = window.location.pathname; const filename = path.substring(path.lastIndexOf('/') + 1) || 'index.html'; return filename; } function renderNav() { const currentPage = getCurrentPage(); const nav = document.createElement('nav'); nav.className = 'nav'; const brand = document.createElement('a'); brand.className = 'nav-brand'; brand.href = 'index.html'; brand.innerHTML = BRAND_LOGO + ' Commander AI Lab'; nav.appendChild(brand); const links = document.createElement('div'); links.className = 'nav-links'; NAV_ITEMS.forEach(function(item) { const a = document.createElement('a'); a.href = item.href; if (currentPage === item.href) a.className = 'active'; a.innerHTML = '' + ICONS[item.icon] + '' + item.label; links.appendChild(a); }); nav.appendChild(links); document.body.insertBefore(nav, document.body.firstChild); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', renderNav); } else { renderNav(); } })();