diff --git a/admin.html b/admin.html index 838a9b4..1a18488 100644 --- a/admin.html +++ b/admin.html @@ -799,6 +799,28 @@ } + /* ── view popover ── */ + + .view-opt { + display: block; + width: 100%; + text-align: left; + background: transparent; + border: none; + border-radius: 0; + color: var(--muted); + padding: 9px 14px; + font-size: 13px; + font-weight: 500; + border-bottom: 1px solid var(--border-light); + transition: background .1s, color .1s; + } + + .view-opt:last-child { border-bottom: none; } + .view-opt:hover { background: var(--primary-bg); color: var(--foreground); } + .view-opt.active { color: var(--foreground); background: var(--primary-bg); } + + /* ── signal cards ── */ #intel-signals-wrap { @@ -1050,12 +1072,18 @@ All companies View - - Knowledge - Predictions - Signals - Graph - + + + Knowledge + + + + Knowledge + Predictions + Signals + Graph + + Type @@ -1524,6 +1552,35 @@ document.getElementById('eDeleteBtn').onclick = async () => { // ── intelligence ─────────────────────────────────────────────────────────── let intelOffset = 0; +let currentIntelView = 'knowledge'; + +function toggleViewPopover(ev) { + ev.stopPropagation(); + const pop = document.getElementById('i-view-popover'); + pop.style.display = pop.style.display === 'none' ? 'block' : 'none'; +} + +function selectView(view) { + currentIntelView = view; + + const labels = { knowledge: 'Knowledge', predictions: 'Predictions', signals: 'Signals', graph: 'Graph' }; + document.getElementById('i-view-label').textContent = labels[view] || view; + + document.querySelectorAll('.view-opt').forEach(b => { + b.classList.toggle('active', b.dataset.view === view); + }); + + document.getElementById('i-view-popover').style.display = 'none'; + intelOffset = 0; + loadIntelligence(); +} + +document.addEventListener('click', ev => { + const wrap = document.getElementById('i-view-wrap'); + if (wrap && !wrap.contains(ev.target)) { + document.getElementById('i-view-popover').style.display = 'none'; + } +}); async function loadIntelligenceStats() { const data = await api('/admin/api/intelligence/stats'); @@ -1570,7 +1627,7 @@ async function loadIntelligenceCompanies() { } async function loadIntelligence() { - const view = document.getElementById('i-view').value; + const view = currentIntelView; if (view === 'graph') { showSignalsView(false); @@ -1665,7 +1722,7 @@ async function loadIntelligence() { document.getElementById('iPrevBtn').onclick = () => { intelOffset = Math.max(0, intelOffset - PAGE); loadIntelligence(); }; document.getElementById('iNextBtn').onclick = () => { intelOffset += PAGE; loadIntelligence(); }; -document.getElementById('i-view').onchange = () => { intelOffset = 0; loadIntelligence(); }; +// view switching is handled by selectView() // ── intelligence graph ─────────────────────────────────────────────────────