Commit 695cb925d1

695cb925d1f99f7735883046e455cdc436602cb1

parent: 545ba0bcde

Verified · cmc ci/build: success ci/quality: success ci/test: success

cmc <hello@cleberg.net> · 2026-11-25 20:31 UTC

web: collapse nav settings, admin, profile, and logout into avatar dropdown

Layout: unified · split

Changed files (3)
internal/web/static/app.js +2 −2 · view
@@ -29,11 +29,11 @@
29 }; 29 };
30 30
31 // ---- 1. Popover hygiene (close others, click outside, Escape) ---- 31 // ---- 1. Popover hygiene (close others, click outside, Escape) ----
32 const popovers = () => document.querySelectorAll('details.popover, details.railpins, details.refmenu'); 32 const popovers = () => document.querySelectorAll('details.popover, details.railpins, details.railusermenu, details.railmore, details.refmenu');
33 document.addEventListener('toggle', (e) => { 33 document.addEventListener('toggle', (e) => {
34 const d = e.target; 34 const d = e.target;
35 if (!(d instanceof HTMLDetailsElement) || !d.open) return; 35 if (!(d instanceof HTMLDetailsElement) || !d.open) return;
36 if (!d.matches('details.popover, details.railpins, details.refmenu')) return; 36 if (!d.matches('details.popover, details.railpins, details.railusermenu, details.railmore, details.refmenu')) return;
37 for (const other of popovers()) { 37 for (const other of popovers()) {
38 if (other !== d && other.open) other.open = false; 38 if (other !== d && other.open) other.open = false;
39 } 39 }
internal/web/static/style.css +26 · view
@@ -2001,6 +2001,32 @@ button.react:hover { background: var(--surface); }
2001button.react.mine { border-color: var(--accent); background: var(--surface); color: var(--fg); } 2001button.react.mine { border-color: var(--accent); background: var(--surface); color: var(--fg); }
2002 2002
2003/* ---- rail pinned switcher ---- */ 2003/* ---- rail pinned switcher ---- */
2004.railusermenu { position: relative; }
2005.railusermenu > summary { list-style: none; cursor: pointer; }
2006.railusermenu > summary::-webkit-details-marker { display: none; }
2007.railavatar {
2008 display: flex;
2009 align-items: center;
2010 justify-content: center;
2011 width: var(--rail-hit);
2012 height: var(--rail-strip-h);
2013}
2014.railavatar:hover, .railusermenu[open] > .railavatar { background: var(--shell-hover); }
2015.railavatar .avatar { width: var(--rail-mark); height: var(--rail-mark); }
2016.raildrop a.railuser {
2017 width: 100%;
2018 height: auto;
2019 justify-content: flex-start;
2020}
2021.raildrop a[aria-current="page"] {
2022 box-shadow: inset 2px 0 0 var(--shell-mark);
2023 font-weight: 600;
2024}
2025.railsep {
2026 border: 0;
2027 border-top: 1px solid var(--shell-line);
2028 margin: var(--sp-1) 0;
2029}
2004.railpins { position: relative; } 2030.railpins { position: relative; }
2005.railpins > summary { list-style: none; } 2031.railpins > summary { list-style: none; }
2006.railpins > summary::-webkit-details-marker { display: none; } 2032.railpins > summary::-webkit-details-marker { display: none; }
internal/web/templates/layout.html +11 −6 · view
@@ -34,10 +34,6 @@
34 <button type="button" class="cmdk-trigger" aria-label="Open command palette" title="Jump to… (⌘K)"><kbd>⌘K</kbd></button> 34 <button type="button" class="cmdk-trigger" aria-label="Open command palette" title="Jump to… (⌘K)"><kbd>⌘K</kbd></button>
35 </form> 35 </form>
36 <span class="railgap"></span> 36 <span class="railgap"></span>
37 <ul class="raillist">
38 {{if .Viewer}}<li class="railopt">{{template "raillink" (index $items 1)}}</li>
39 {{if (index $items 2).Show}}<li class="railopt">{{template "raillink" (index $items 2)}}</li>{{end}}{{end}}
40 </ul>
41 <div class="railfoot"> 37 <div class="railfoot">
42 {{if .Viewer}}<details class="railmore"> 38 {{if .Viewer}}<details class="railmore">
43 <summary class="railicon" aria-label="More" title="More">{{template "icon" "ellipsis"}}<span class="vh">More</span></summary> 39 <summary class="railicon" aria-label="More" title="More">{{template "icon" "ellipsis"}}<span class="vh">More</span></summary>
@@ -45,8 +41,17 @@
45 {{range $items}}{{if .Show}}<a href="{{.Href}}">{{template "icon" .Icon}} {{.Name}}</a>{{end}}{{end}} 41 {{range $items}}{{if .Show}}<a href="{{.Href}}">{{template "icon" .Icon}} {{.Name}}</a>{{end}}{{end}}
46 </div> 42 </div>
47 </details> 43 </details>
48 <a class="railuser" href="/{{.Viewer}}" aria-label="Your profile" title="{{.Viewer}}"><span class="avatar">{{initial .Viewer}}</span></a> 44 <details class="railusermenu">
49 {{$logout := index $items 3}}<a class="railopt railicon" href="{{$logout.Href}}" aria-label="{{$logout.Name}}" title="{{$logout.Name}}">{{template "icon" $logout.Icon}}<span class="vh">{{$logout.Name}}</span></a> 45 <summary class="railavatar" aria-label="Account menu" title="{{.Viewer}}"><span class="avatar">{{initial .Viewer}}</span></summary>
46 <div class="raildrop">
47 <a class="railuser" href="/{{.Viewer}}">{{template "icon" "person"}} <span><strong>{{.Viewer}}</strong></span></a>
48 <hr class="railsep">
49 {{$settings := index $items 1}}<a{{if $settings.Current}} aria-current="page"{{end}} href="{{$settings.Href}}">{{template "icon" $settings.Icon}} {{$settings.Name}}</a>
50 {{$admin := index $items 2}}{{if $admin.Show}}<a{{if $admin.Current}} aria-current="page"{{end}} href="{{$admin.Href}}">{{template "icon" $admin.Icon}} {{$admin.Name}}</a>{{end}}
51 <hr class="railsep">
52 {{$logout := index $items 3}}<a href="{{$logout.Href}}">{{template "icon" $logout.Icon}} {{$logout.Name}}</a>
53 </div>
54 </details>
50 {{else}}<a class="railicon" href="/login" aria-label="Sign in" title="Sign in">{{template "icon" "person"}}<span class="vh">Sign in</span></a>{{end}} 55 {{else}}<a class="railicon" href="/login" aria-label="Sign in" title="Sign in">{{template "icon" "person"}}<span class="vh">Sign in</span></a>{{end}}
51 </div> 56 </div>
52</nav> 57</nav>
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form