Sidebar: fold each module's pages

A chevron beside each module folds or unfolds its pages. The current
module is always open; the others keep the state you left them in; a
folded module shows its pages' counts added up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 15:27:22 -07:00
co-authored by Claude Opus 5.5
parent 9ca09c1ffa
commit 2a605ac265
4 changed files with 59 additions and 6 deletions
+6
View File
@@ -43,6 +43,12 @@ Throughout, also notice:
- [ ] Its Setup list (AI, social accounts, Core, Hermes and so on) matches - [ ] 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. 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 ## 3. Settings
### Profile ### Profile
+10
View File
@@ -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; } .button.small { padding: 0.28rem 0.75rem; font-size: 0.82rem; }
input[type="color"] { height: 2.6rem; padding: 0.25rem; cursor: pointer; } 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; }
+33
View File
@@ -137,4 +137,37 @@
}); });
document.addEventListener("DOMContentLoaded", syncProvider); 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) {}
});
});
})();
})(); })();
+10 -6
View File
@@ -29,9 +29,12 @@
{{$nav := .Nav}}{{$inbox := .Inbox}} {{$nav := .Nav}}{{$inbox := .Inbox}}
{{range .Modules}} {{range .Modules}}
{{if .Link}} {{if .Link}}
<a href="{{.Link}}" {{if eq $nav .ID}}aria-current="page"{{end}} class="{{if hasPrefix $nav .ID}}open{{end}}">{{template "icon" .ID}}<span>{{.Name}}</span></a> <div class="nav-row">
<a href="{{.Link}}" {{if eq $nav .ID}}aria-current="page"{{end}} class="{{if hasPrefix $nav .ID}}open{{end}}">{{template "icon" .ID}}<span>{{.Name}}</span><span class="count-badge nav-sum" hidden></span></a>
<button type="button" class="nav-toggle" aria-controls="subnav-{{.ID}}" aria-expanded="true" aria-label="Show or hide {{.Name}}'s pages" hidden>{{template "icon" "chevron"}}</button>
</div>
{{if eq .ID "content"}} {{if eq .ID "content"}}
<div class="subnav"> <div class="subnav" id="subnav-content" data-subnav="content"{{if hasPrefix $nav "content"}} data-current{{end}}>
<a href="/posts" {{if eq $nav "content/posts"}}aria-current="page"{{end}}>Posts{{if $inbox}} <span class="count-badge" title="{{$inbox}} waiting for review">{{$inbox}}</span>{{end}}</a> <a href="/posts" {{if eq $nav "content/posts"}}aria-current="page"{{end}}>Posts{{if $inbox}} <span class="count-badge" title="{{$inbox}} waiting for review">{{$inbox}}</span>{{end}}</a>
<a href="/content" {{if eq $nav "content/sources"}}aria-current="page"{{end}}>Sources</a> <a href="/content" {{if eq $nav "content/sources"}}aria-current="page"{{end}}>Sources</a>
<a href="/content/scheduled" {{if eq $nav "content/scheduled"}}aria-current="page"{{end}}>Scheduled</a> <a href="/content/scheduled" {{if eq $nav "content/scheduled"}}aria-current="page"{{end}}>Scheduled</a>
@@ -39,7 +42,7 @@
</div> </div>
{{end}} {{end}}
{{if eq .ID "seo"}} {{if eq .ID "seo"}}
<div class="subnav"> <div class="subnav" id="subnav-seo" data-subnav="seo"{{if hasPrefix $nav "seo"}} data-current{{end}}>
<a href="/seo/check" {{if eq $nav "seo/check"}}aria-current="page"{{end}}>Morning check</a> <a href="/seo/check" {{if eq $nav "seo/check"}}aria-current="page"{{end}}>Morning check</a>
<a href="/seo/report" {{if eq $nav "seo/report"}}aria-current="page"{{end}}>Monday report</a> <a href="/seo/report" {{if eq $nav "seo/report"}}aria-current="page"{{end}}>Monday report</a>
<a href="/seo" {{if eq $nav "seo/ranks"}}aria-current="page"{{end}}>What ranks</a> <a href="/seo" {{if eq $nav "seo/ranks"}}aria-current="page"{{end}}>What ranks</a>
@@ -51,7 +54,7 @@
</div> </div>
{{end}} {{end}}
{{if eq .ID "metrics"}} {{if eq .ID "metrics"}}
<div class="subnav"> <div class="subnav" id="subnav-metrics" data-subnav="metrics"{{if hasPrefix $nav "metrics"}} data-current{{end}}>
<a href="/metrics" {{if eq $nav "metrics/overview"}}aria-current="page"{{end}}>MRR and NRR</a> <a href="/metrics" {{if eq $nav "metrics/overview"}}aria-current="page"{{end}}>MRR and NRR</a>
<a href="/metrics/spend" {{if eq $nav "metrics/spend"}}aria-current="page"{{end}}>Spend and CAC</a> <a href="/metrics/spend" {{if eq $nav "metrics/spend"}}aria-current="page"{{end}}>Spend and CAC</a>
<a href="/metrics/clv" {{if eq $nav "metrics/clv"}}aria-current="page"{{end}}>CLV and cohorts</a> <a href="/metrics/clv" {{if eq $nav "metrics/clv"}}aria-current="page"{{end}}>CLV and cohorts</a>
@@ -60,7 +63,7 @@
</div> </div>
{{end}} {{end}}
{{if eq .ID "sites"}} {{if eq .ID "sites"}}
<div class="subnav"> <div class="subnav" id="subnav-sites" data-subnav="sites"{{if hasPrefix $nav "sites"}} data-current{{end}}>
<a href="/sites" {{if eq $nav "sites/site"}}aria-current="page"{{end}}>Sections and pages</a> <a href="/sites" {{if eq $nav "sites/site"}}aria-current="page"{{end}}>Sections and pages</a>
<a href="/sites/pages" {{if hasPrefix $nav "sites/pages"}}aria-current="page"{{end}}>New pages</a> <a href="/sites/pages" {{if hasPrefix $nav "sites/pages"}}aria-current="page"{{end}}>New pages</a>
<a href="/sites/previews" {{if eq $nav "sites/previews"}}aria-current="page"{{end}}>Previews</a> <a href="/sites/previews" {{if eq $nav "sites/previews"}}aria-current="page"{{end}}>Previews</a>
@@ -70,7 +73,7 @@
</div> </div>
{{end}} {{end}}
{{if eq .ID "prospects"}} {{if eq .ID "prospects"}}
<div class="subnav"> <div class="subnav" id="subnav-prospects" data-subnav="prospects"{{if hasPrefix $nav "prospects"}} data-current{{end}}>
<a href="/signals" {{if eq $nav "prospects/signals"}}aria-current="page"{{end}}>Signals</a> <a href="/signals" {{if eq $nav "prospects/signals"}}aria-current="page"{{end}}>Signals</a>
<a href="/prospects" {{if eq $nav "prospects/review"}}aria-current="page"{{end}}>Review{{with $.NewProspects}} <span class="count-badge" title="{{.}} waiting for review">{{.}}</span>{{end}}</a> <a href="/prospects" {{if eq $nav "prospects/review"}}aria-current="page"{{end}}>Review{{with $.NewProspects}} <span class="count-badge" title="{{.}} waiting for review">{{.}}</span>{{end}}</a>
<a href="/outreach" {{if eq $nav "prospects/outreach"}}aria-current="page"{{end}}>Outreach{{with $.Drafts}} <span class="count-badge" title="{{.}} drafts to review">{{.}}</span>{{end}}</a> <a href="/outreach" {{if eq $nav "prospects/outreach"}}aria-current="page"{{end}}>Outreach{{with $.Drafts}} <span class="count-badge" title="{{.}} drafts to review">{{.}}</span>{{end}}</a>
@@ -179,6 +182,7 @@
{{- else if eq . "ai"}}<path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/> {{- else if eq . "ai"}}<path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/>
{{- else if eq . "core"}}<path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"/><path d="m2 22 3-3"/><path d="M7.5 13.5 10 11"/><path d="M10.5 16.5 13 14"/><path d="m18 3-4 4h6l-4 4"/> {{- else if eq . "core"}}<path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"/><path d="m2 22 3-3"/><path d="M7.5 13.5 10 11"/><path d="M10.5 16.5 13 14"/><path d="m18 3-4 4h6l-4 4"/>
{{- else if eq . "backups"}}<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/> {{- else if eq . "backups"}}<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>
{{- else if eq . "chevron"}}<path d="m6 9 6 6 6-6"/>
{{- else if eq . "menu"}}<path d="M4 12h16"/><path d="M4 6h16"/><path d="M4 18h16"/> {{- else if eq . "menu"}}<path d="M4 12h16"/><path d="M4 6h16"/><path d="M4 18h16"/>
{{- end}}</svg>{{end}} {{- end}}</svg>{{end}}