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
+10 -6
View File
@@ -29,9 +29,12 @@
{{$nav := .Nav}}{{$inbox := .Inbox}}
{{range .Modules}}
{{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"}}
<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="/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>
@@ -39,7 +42,7 @@
</div>
{{end}}
{{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/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>
@@ -51,7 +54,7 @@
</div>
{{end}}
{{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/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>
@@ -60,7 +63,7 @@
</div>
{{end}}
{{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/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>
@@ -70,7 +73,7 @@
</div>
{{end}}
{{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="/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>
@@ -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 . "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 . "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"/>
{{- end}}</svg>{{end}}