diff --git a/TEST.md b/TEST.md index 580192f..44287fe 100644 --- a/TEST.md +++ b/TEST.md @@ -43,6 +43,12 @@ Throughout, also notice: - [ ] Its Setup list (AI, social accounts, Core, Hermes and so on) matches what you've set up, and each missing step links to where to do it. +- [ ] In the sidebar, each module (Content, Prospects, SEO, Metrics, Sites) + has a chevron that folds or unfolds its pages. The module you're in + is always unfolded; the others stay as you left them, across pages + and restarts of the browser. A folded module shows its pages' counts + added up (e.g. Prospects' Review and Outreach). + ## 3. Settings ### Profile diff --git a/internal/web/static/app.css b/internal/web/static/app.css index f0d4cba..456c604 100644 --- a/internal/web/static/app.css +++ b/internal/web/static/app.css @@ -454,3 +454,13 @@ details.inline-details form { margin-top: 0.5rem; min-width: 18rem; } .button.small { padding: 0.28rem 0.75rem; font-size: 0.82rem; } input[type="color"] { height: 2.6rem; padding: 0.25rem; cursor: pointer; } +/* Collapsible module menus in the sidebar (app.js shows the toggles). */ +.nav-row { display: flex; align-items: center; gap: 2px; } +.nav-row > a { flex: 1; min-width: 0; } +.nav .nav-toggle { background: transparent; border: 0; box-shadow: none; color: hsl(var(--muted-foreground)); padding: 0.3rem 0.35rem; min-height: 0; border-radius: var(--radius); cursor: pointer; line-height: 0; } +.nav .nav-toggle:hover { background: hsl(var(--accent) / 0.6); color: hsl(var(--foreground)); transform: none; } +.nav .nav-toggle .icon { width: 1rem; height: 1rem; transition: transform var(--fast); } +.nav-row.collapsed .nav-toggle .icon { transform: rotate(-90deg); } +.nav-sum { margin-left: auto; } +.nav-row:not(.collapsed) .nav-sum { display: none; } +.nav .nav-toggle:active { transform: none; } diff --git a/internal/web/static/app.js b/internal/web/static/app.js index d7830a1..16fb70e 100644 --- a/internal/web/static/app.js +++ b/internal/web/static/app.js @@ -137,4 +137,37 @@ }); document.addEventListener("DOMContentLoaded", syncProvider); + // Sidebar: each module's pages fold under a toggle. The module you're in + // is always open; the others stay as you last left them (closed at + // first). A folded module shows the sum of its pages' counts. + (function () { + var KEY = "supermarket.nav"; + var state = {}; + try { state = JSON.parse(localStorage.getItem(KEY)) || {}; } catch (e) {} + function set(sub, btn, open) { + sub.hidden = !open; + btn.setAttribute("aria-expanded", open ? "true" : "false"); + btn.closest(".nav-row").classList.toggle("collapsed", !open); + } + document.querySelectorAll(".subnav[data-subnav]").forEach(function (sub) { + var btn = document.querySelector('.nav-toggle[aria-controls="' + sub.id + '"]'); + if (!btn) return; + btn.hidden = false; + var sum = 0; + sub.querySelectorAll(".count-badge").forEach(function (b) { sum += parseInt(b.textContent, 10) || 0; }); + var total = btn.closest(".nav-row").querySelector(".nav-sum"); + if (total && sum > 0) { + total.textContent = sum; + total.title = sum + " waiting"; + total.hidden = false; + } + set(sub, btn, sub.hasAttribute("data-current") || state[sub.dataset.subnav] === true); + btn.addEventListener("click", function () { + var open = sub.hidden; + set(sub, btn, open); + state[sub.dataset.subnav] = open; + try { localStorage.setItem(KEY, JSON.stringify(state)); } catch (e) {} + }); + }); + })(); })(); diff --git a/internal/web/templates/layout.html b/internal/web/templates/layout.html index d3b4693..2ed0eda 100644 --- a/internal/web/templates/layout.html +++ b/internal/web/templates/layout.html @@ -29,9 +29,12 @@ {{$nav := .Nav}}{{$inbox := .Inbox}} {{range .Modules}} {{if .Link}} - {{template "icon" .ID}}{{.Name}} +
{{if eq .ID "content"}} -