Commit 727e977359

727e9773591679858f7e89e6a9b2942db20cc2d2

parent: 695cb925d1

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

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

web: redesign top nav bar with balanced zones, desktop labels, and dropdowns

Layout: unified · split

Changed files (3)
internal/web/static/app.js +2 −2 · view
@@ -29,11 +29,11 @@
2929 };
3030
3131 // ---- 1. Popover hygiene (close others, click outside, Escape) ----
32 const popovers = () => document.querySelectorAll('details.popover, details.railpins, details.railusermenu, details.railmore, details.refmenu');
32 const popovers = () => document.querySelectorAll('details.popover, details.railpins, details.railcreate, details.railusermenu, details.refmenu');
3333 document.addEventListener('toggle', (e) => {
3434 const d = e.target;
3535 if (!(d instanceof HTMLDetailsElement) || !d.open) return;
36 if (!d.matches('details.popover, details.railpins, details.railusermenu, details.railmore, details.refmenu')) return;
36 if (!d.matches('details.popover, details.railpins, details.railcreate, details.railusermenu, details.refmenu')) return;
3737 for (const other of popovers()) {
3838 if (other !== d && other.open) other.open = false;
3939 }
internal/web/static/style.css +57 −23 · view
@@ -280,26 +280,37 @@ a.skip:focus { top: var(--sp-3); text-decoration: none; }
280280 inline svg, its name in an aria-label and in a visually hidden span, so
281281 the nav reads the same to a screen reader as the old text list did. */
282282.rail {
283 height: var(--rail-strip-h);
283 height: 48px;
284284 background: var(--shell-bg);
285285 color: var(--shell-fg);
286286 border-bottom: 1px solid var(--shell-line);
287287 display: flex;
288288 flex-direction: row;
289289 align-items: center;
290 padding: 0 var(--sp-1);
290 gap: var(--sp-1);
291 padding: 0 var(--sp-3);
291292}
292293a.brand {
293 display: flex;
294 display: inline-flex;
294295 align-items: center;
295296 justify-content: center;
297 gap: var(--sp-2);
296298 flex: none;
297 width: var(--rail-mark-box);
298 height: var(--rail-strip-h);
299 height: 32px;
300 padding: 0 var(--sp-2);
301 border-radius: var(--r-ctl);
299302 color: var(--shell-fg);
303 font-size: var(--fs-2);
304 font-weight: 600;
305 letter-spacing: -0.01em;
300306}
301a.brand:hover { text-decoration: none; }
307a.brand:hover { background: var(--shell-hover); text-decoration: none; }
308a.brand[aria-current="page"] { background: var(--shell-hover); }
302309a.brand svg.mark { display: block; flex: none; width: var(--rail-mark); height: var(--rail-mark); }
310.brandname { display: inline; }
311@media (max-width: 44rem) {
312 .brandname { display: none; }
313}
303314
304315ul.raillist {
305316 list-style: none;
@@ -307,23 +318,26 @@ ul.raillist {
307318 padding: 0;
308319 display: flex;
309320 align-items: center;
321 gap: var(--sp-1);
310322 min-width: 0;
311323}
312/* the spacer that holds settings, admin and the account cell at the far
313 end of the row */
314324.railgap { flex: 1; }
315325.railicon {
316326 position: relative;
317 display: flex;
327 display: inline-flex;
318328 align-items: center;
319329 justify-content: center;
330 gap: 6px;
320331 flex: none;
321 width: var(--rail-hit);
322 height: var(--rail-strip-h);
323 padding: 0;
332 min-width: 32px;
333 height: 32px;
334 padding: 0 var(--sp-2);
324335 border: 0;
336 border-radius: var(--r-ctl);
325337 background: none;
326338 color: var(--shell-fg);
339 font-size: var(--fs-2);
340 font-weight: 500;
327341 cursor: pointer;
328342}
329343.railicon:hover { background: var(--shell-hover); text-decoration: none; }
@@ -332,6 +346,20 @@ ul.raillist {
332346 background: var(--shell-hover);
333347 box-shadow: inset 0 -2px 0 var(--shell-mark);
334348}
349.raillabel { display: none; }
350@media (min-width: 64rem) {
351 .raillabel { display: inline; }
352}
353.railcaret {
354 font-size: 10px;
355 color: var(--shell-muted);
356 line-height: 1;
357}
358.raildrop-trigger { list-style: none; }
359.railpins-item { display: list-item; }
360@media (max-width: 44rem) {
361 .railpins-item { display: none; }
362}
335363.count {
336364 font-size: var(--fs-0);
337365 font-weight: 600;
@@ -345,16 +373,17 @@ ul.raillist {
345373/* the unread count is a badge on the bell's corner, not a trailing number */
346374.railicon .count {
347375 position: absolute;
348 top: 2px;
349 right: 2px;
376 top: 0;
377 right: 0;
350378 margin: 0;
351 padding: 0 3px;
379 padding: 0 4px;
352380 line-height: 1.35;
353381}
354382.railfoot {
355383 flex: none;
356384 display: flex;
357385 align-items: center;
386 gap: var(--sp-1);
358387 min-width: 0;
359388}
360389.railfoot a { color: var(--shell-fg); }
@@ -2001,18 +2030,22 @@ button.react:hover { background: var(--surface); }
20012030button.react.mine { border-color: var(--accent); background: var(--surface); color: var(--fg); }
20022031
20032032/* ---- rail pinned switcher ---- */
2004.railusermenu { position: relative; }
2005.railusermenu > summary { list-style: none; cursor: pointer; }
2006.railusermenu > summary::-webkit-details-marker { display: none; }
2033.railusermenu, .railcreate { position: relative; }
2034.railusermenu > summary, .railcreate > summary { list-style: none; cursor: pointer; }
2035.railusermenu > summary::-webkit-details-marker, .railcreate > summary::-webkit-details-marker { display: none; }
2036.railcreate[open] > summary, .railpins[open] > summary { background: var(--shell-hover); }
20072037.railavatar {
2008 display: flex;
2038 display: inline-flex;
20092039 align-items: center;
20102040 justify-content: center;
2011 width: var(--rail-hit);
2012 height: var(--rail-strip-h);
2041 gap: 5px;
2042 height: 32px;
2043 padding: 0 var(--sp-2);
2044 border-radius: var(--r-ctl);
20132045}
20142046.railavatar:hover, .railusermenu[open] > .railavatar { background: var(--shell-hover); }
20152047.railavatar .avatar { width: var(--rail-mark); height: var(--rail-mark); }
2048.raildrop { top: calc(100% + 6px); }
20162049.raildrop a.railuser {
20172050 width: 100%;
20182051 height: auto;
@@ -2031,8 +2064,9 @@ button.react.mine { border-color: var(--accent); background: var(--surface); col
20312064.railpins > summary { list-style: none; }
20322065.railpins > summary::-webkit-details-marker { display: none; }
20332066.railpins .raildrop {
2034 left: calc(100% + var(--sp-1));
2035 top: 0;
2067 left: 0;
2068 right: auto;
2069 top: calc(100% + 6px);
20362070 bottom: auto;
20372071 min-width: 14rem;
20382072}
internal/web/templates/layout.html +22 −16 · view
@@ -15,19 +15,19 @@
1515<div class="shell">
1616
1717<nav class="rail" aria-label="Site">
18 <a class="brand" href="/" aria-label="{{.Site}} home">{{template "mark"}}<span class="vh">{{.Site}}</span></a>
18 <a class="brand" href="/" aria-label="{{.Site}} home"{{if eq (str . "Tab") "dashboard"}} aria-current="page"{{end}}>{{template "mark"}}<span class="brandname" aria-hidden="true">{{.Site}}</span><span class="vh">{{.Site}}</span></a>
1919 {{$items := railOptItems .}}
20 {{/* A square is .railopt when the phone rail drops it into the More
21 menu below. Every one of those destinations — strip, menu and
22 the foot's own Log out link — renders off $items, so the strip
23 and the menu can never drift out of step. */}}
2420 <ul class="raillist">
25 {{if .Viewer}}<li>{{template "raillink" dict "Href" "/" "Icon" "home" "Name" "Dashboard" "Current" (eq (str . "Tab") "dashboard")}}</li>{{end}}
26 <li>{{template "raillink" dict "Href" "/explore" "Icon" "compass" "Name" "Explore" "Current" (eq (str . "Tab") "explore")}}</li>
21 <li>{{template "raillink" dict "Href" "/explore" "Icon" "compass" "Name" "Explore" "Label" "Explore" "Current" (eq (str . "Tab") "explore")}}</li>
22 {{if .Viewer}}<li class="railpins-item"><details class="railpins">
23 <summary class="railicon raildrop-trigger" aria-label="Pinned repositories" title="Pinned repositories">{{template "icon" "bookmark"}}<span class="raillabel" aria-hidden="true">Pinned</span><span class="railcaret" aria-hidden="true">▾</span><span class="vh">Pinned repositories</span></summary>
24 <div class="raildrop">
25 {{range .Rail.Pins}}<a href="/{{.Owner}}/{{.Name}}">{{.Owner}}/{{.Name}}</a>{{else}}<span class="none">No pinned repos</span>{{end}}
26 <hr class="railsep">
27 <a href="/{{.Viewer}}/-/repositories">All repositories →</a>
28 </div>
29 </details></li>{{end}}
2730 <li class="railsearch-mob">{{template "raillink" dict "Href" "/search" "Icon" "search" "Name" "Search" "Current" (eq (str . "Tab") "sitesearch")}}</li>
28 {{if .Viewer}}<li>{{template "raillink" dict "Href" "/notifications" "Icon" "bell" "Name" "Notifications" "Current" (eq (str . "Tab") "notifications") "Count" .Rail.Unread}}</li>
29 <li class="railopt"><details class="railpins"><summary class="railicon" aria-label="Pinned repositories" title="Pinned repositories">{{template "icon" "bookmark"}}<span class="vh">Pinned repositories</span></summary><div class="raildrop">{{range .Rail.Pins}}<a href="/{{.Owner}}/{{.Name}}">{{.Owner}}/{{.Name}}</a>{{else}}<span class="none">No pinned repos</span>{{end}}<a href="/{{.Viewer}}/-/repositories">All repositories →</a></div></details></li>
30 <li class="railopt">{{template "raillink" (index $items 0)}}</li>{{end}}
3131 </ul>
3232 <form method="get" action="/search" class="railsearch" role="search">
3333 <input type="search" name="q" aria-label="Search repositories, issues, and merge requests" placeholder="Search repositories, issues, MRs…">
@@ -35,16 +35,22 @@
3535 </form>
3636 <span class="railgap"></span>
3737 <div class="railfoot">
38 {{if .Viewer}}<details class="railmore">
39 <summary class="railicon" aria-label="More" title="More">{{template "icon" "ellipsis"}}<span class="vh">More</span></summary>
38 {{if .Viewer}}
39 <details class="railcreate">
40 <summary class="railicon raildrop-trigger" aria-label="Create new" title="Create new">{{template "icon" "plus"}}<span class="railcaret" aria-hidden="true">▾</span><span class="vh">Create new</span></summary>
4041 <div class="raildrop">
41 {{range $items}}{{if .Show}}<a href="{{.Href}}">{{template "icon" .Icon}} {{.Name}}</a>{{end}}{{end}}
42 <a href="/new#create">{{template "icon" "plus"}} New repository</a>
43 <a href="/new#import">{{template "icon" "file"}} Import repository</a>
44 <a href="/new#org">{{template "icon" "person"}} New organization</a>
4245 </div>
4346 </details>
47 {{template "raillink" dict "Href" "/notifications" "Icon" "bell" "Name" "Notifications" "Current" (eq (str . "Tab") "notifications") "Count" .Rail.Unread}}
4448 <details class="railusermenu">
45 <summary class="railavatar" aria-label="Account menu" title="{{.Viewer}}"><span class="avatar">{{initial .Viewer}}</span></summary>
49 <summary class="railavatar" aria-label="Account menu" title="{{.Viewer}}"><span class="avatar">{{initial .Viewer}}</span><span class="railcaret" aria-hidden="true">▾</span></summary>
4650 <div class="raildrop">
4751 <a class="railuser" href="/{{.Viewer}}">{{template "icon" "person"}} <span><strong>{{.Viewer}}</strong></span></a>
52 <a href="/{{.Viewer}}/-/repositories">{{template "icon" "folder"}} Your repositories</a>
53 <a href="/{{.Viewer}}/-/bookmarks">{{template "icon" "bookmark"}} Bookmarks</a>
4854 <hr class="railsep">
4955 {{$settings := index $items 1}}<a{{if $settings.Current}} aria-current="page"{{end}} href="{{$settings.Href}}">{{template "icon" $settings.Icon}} {{$settings.Name}}</a>
5056 {{$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}}
@@ -52,7 +58,7 @@
5258 {{$logout := index $items 3}}<a href="{{$logout.Href}}">{{template "icon" $logout.Icon}} {{$logout.Name}}</a>
5359 </div>
5460 </details>
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}}
61 {{else}}<a class="railicon" href="/login" aria-label="Sign in" title="Sign in">{{template "icon" "person"}}<span class="raillabel" aria-hidden="true">Sign in</span><span class="vh">Sign in</span></a>{{end}}
5662 </div>
5763</nav>
5864
@@ -135,7 +141,7 @@
135141
136142{{/* raillink draws one square in the rail: the icon, the name for a
137143 screen reader and in the tooltip, and the bell's unread badge. */}}
138{{define "raillink"}}<a class="railicon" {{if .Current}}aria-current="page" {{end}}href="{{.Href}}" aria-label="{{.Name}}" title="{{.Name}}">{{template "icon" .Icon}}<span class="vh">{{.Name}}</span>{{with .Count}}<b class="count">{{.}}</b>{{end}}</a>{{end}}
144{{define "raillink"}}<a class="railicon" {{if .Current}}aria-current="page" {{end}}href="{{.Href}}" aria-label="{{.Name}}" title="{{.Name}}">{{template "icon" .Icon}}{{with .Label}}<span class="raillabel" aria-hidden="true">{{.}}</span>{{end}}<span class="vh">{{.Name}}</span>{{with .Count}}<b class="count">{{.}}</b>{{end}}</a>{{end}}
139145
140146{{define "mark"}}<svg class="mark" width="19" height="19" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2.25 18.75 12H5.25z" fill="#ff6b3d"/><rect x="3" y="13.5" width="18" height="3" fill="currentColor"/><rect x="7.5" y="18" width="9" height="3" fill="currentColor"/></svg>{{end}}
141147{{define "width"}}reading{{end}}
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