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 @@
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.railusermenu, details.railmore, details.refmenu'); 32 const popovers = () => document.querySelectorAll('details.popover, details.railpins, details.railcreate, details.railusermenu, 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.railusermenu, details.railmore, details.refmenu')) return; 36 if (!d.matches('details.popover, details.railpins, details.railcreate, details.railusermenu, 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 +57 −23 · view
@@ -280,26 +280,37 @@ a.skip:focus { top: var(--sp-3); text-decoration: none; }
280 inline svg, its name in an aria-label and in a visually hidden span, so 280 inline svg, its name in an aria-label and in a visually hidden span, so
281 the nav reads the same to a screen reader as the old text list did. */ 281 the nav reads the same to a screen reader as the old text list did. */
282.rail { 282.rail {
283 height: var(--rail-strip-h); 283 height: 48px;
284 background: var(--shell-bg); 284 background: var(--shell-bg);
285 color: var(--shell-fg); 285 color: var(--shell-fg);
286 border-bottom: 1px solid var(--shell-line); 286 border-bottom: 1px solid var(--shell-line);
287 display: flex; 287 display: flex;
288 flex-direction: row; 288 flex-direction: row;
289 align-items: center; 289 align-items: center;
290 padding: 0 var(--sp-1); 290 gap: var(--sp-1);
291 padding: 0 var(--sp-3);
291} 292}
292a.brand { 293a.brand {
293 display: flex; 294 display: inline-flex;
294 align-items: center; 295 align-items: center;
295 justify-content: center; 296 justify-content: center;
297 gap: var(--sp-2);
296 flex: none; 298 flex: none;
297 width: var(--rail-mark-box); 299 height: 32px;
298 height: var(--rail-strip-h); 300 padding: 0 var(--sp-2);
301 border-radius: var(--r-ctl);
299 color: var(--shell-fg); 302 color: var(--shell-fg);
303 font-size: var(--fs-2);
304 font-weight: 600;
305 letter-spacing: -0.01em;
300} 306}
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); }
302a.brand svg.mark { display: block; flex: none; width: var(--rail-mark); height: var(--rail-mark); } 309a.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}
303 314
304ul.raillist { 315ul.raillist {
305 list-style: none; 316 list-style: none;
@@ -307,23 +318,26 @@ ul.raillist {
307 padding: 0; 318 padding: 0;
308 display: flex; 319 display: flex;
309 align-items: center; 320 align-items: center;
321 gap: var(--sp-1);
310 min-width: 0; 322 min-width: 0;
311} 323}
312/* the spacer that holds settings, admin and the account cell at the far
313 end of the row */
314.railgap { flex: 1; } 324.railgap { flex: 1; }
315.railicon { 325.railicon {
316 position: relative; 326 position: relative;
317 display: flex; 327 display: inline-flex;
318 align-items: center; 328 align-items: center;
319 justify-content: center; 329 justify-content: center;
330 gap: 6px;
320 flex: none; 331 flex: none;
321 width: var(--rail-hit); 332 min-width: 32px;
322 height: var(--rail-strip-h); 333 height: 32px;
323 padding: 0; 334 padding: 0 var(--sp-2);
324 border: 0; 335 border: 0;
336 border-radius: var(--r-ctl);
325 background: none; 337 background: none;
326 color: var(--shell-fg); 338 color: var(--shell-fg);
339 font-size: var(--fs-2);
340 font-weight: 500;
327 cursor: pointer; 341 cursor: pointer;
328} 342}
329.railicon:hover { background: var(--shell-hover); text-decoration: none; } 343.railicon:hover { background: var(--shell-hover); text-decoration: none; }
@@ -332,6 +346,20 @@ ul.raillist {
332 background: var(--shell-hover); 346 background: var(--shell-hover);
333 box-shadow: inset 0 -2px 0 var(--shell-mark); 347 box-shadow: inset 0 -2px 0 var(--shell-mark);
334} 348}
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}
335.count { 363.count {
336 font-size: var(--fs-0); 364 font-size: var(--fs-0);
337 font-weight: 600; 365 font-weight: 600;
@@ -345,16 +373,17 @@ ul.raillist {
345/* the unread count is a badge on the bell's corner, not a trailing number */ 373/* the unread count is a badge on the bell's corner, not a trailing number */
346.railicon .count { 374.railicon .count {
347 position: absolute; 375 position: absolute;
348 top: 2px; 376 top: 0;
349 right: 2px; 377 right: 0;
350 margin: 0; 378 margin: 0;
351 padding: 0 3px; 379 padding: 0 4px;
352 line-height: 1.35; 380 line-height: 1.35;
353} 381}
354.railfoot { 382.railfoot {
355 flex: none; 383 flex: none;
356 display: flex; 384 display: flex;
357 align-items: center; 385 align-items: center;
386 gap: var(--sp-1);
358 min-width: 0; 387 min-width: 0;
359} 388}
360.railfoot a { color: var(--shell-fg); } 389.railfoot a { color: var(--shell-fg); }
@@ -2001,18 +2030,22 @@ button.react:hover { background: var(--surface); }
2001button.react.mine { border-color: var(--accent); background: var(--surface); color: var(--fg); } 2030button.react.mine { border-color: var(--accent); background: var(--surface); color: var(--fg); }
2002 2031
2003/* ---- rail pinned switcher ---- */ 2032/* ---- rail pinned switcher ---- */
2004.railusermenu { position: relative; } 2033.railusermenu, .railcreate { position: relative; }
2005.railusermenu > summary { list-style: none; cursor: pointer; } 2034.railusermenu > summary, .railcreate > summary { list-style: none; cursor: pointer; }
2006.railusermenu > summary::-webkit-details-marker { display: none; } 2035.railusermenu > summary::-webkit-details-marker, .railcreate > summary::-webkit-details-marker { display: none; }
2036.railcreate[open] > summary, .railpins[open] > summary { background: var(--shell-hover); }
2007.railavatar { 2037.railavatar {
2008 display: flex; 2038 display: inline-flex;
2009 align-items: center; 2039 align-items: center;
2010 justify-content: center; 2040 justify-content: center;
2011 width: var(--rail-hit); 2041 gap: 5px;
2012 height: var(--rail-strip-h); 2042 height: 32px;
2043 padding: 0 var(--sp-2);
2044 border-radius: var(--r-ctl);
2013} 2045}
2014.railavatar:hover, .railusermenu[open] > .railavatar { background: var(--shell-hover); } 2046.railavatar:hover, .railusermenu[open] > .railavatar { background: var(--shell-hover); }
2015.railavatar .avatar { width: var(--rail-mark); height: var(--rail-mark); } 2047.railavatar .avatar { width: var(--rail-mark); height: var(--rail-mark); }
2048.raildrop { top: calc(100% + 6px); }
2016.raildrop a.railuser { 2049.raildrop a.railuser {
2017 width: 100%; 2050 width: 100%;
2018 height: auto; 2051 height: auto;
@@ -2031,8 +2064,9 @@ button.react.mine { border-color: var(--accent); background: var(--surface); col
2031.railpins > summary { list-style: none; } 2064.railpins > summary { list-style: none; }
2032.railpins > summary::-webkit-details-marker { display: none; } 2065.railpins > summary::-webkit-details-marker { display: none; }
2033.railpins .raildrop { 2066.railpins .raildrop {
2034 left: calc(100% + var(--sp-1)); 2067 left: 0;
2035 top: 0; 2068 right: auto;
2069 top: calc(100% + 6px);
2036 bottom: auto; 2070 bottom: auto;
2037 min-width: 14rem; 2071 min-width: 14rem;
2038} 2072}
internal/web/templates/layout.html +22 −16 · view
@@ -15,19 +15,19 @@
15<div class="shell"> 15<div class="shell">
16 16
17<nav class="rail" aria-label="Site"> 17<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>
19 {{$items := railOptItems .}} 19 {{$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. */}}
24 <ul class="raillist"> 20 <ul class="raillist">
25 {{if .Viewer}}<li>{{template "raillink" dict "Href" "/" "Icon" "home" "Name" "Dashboard" "Current" (eq (str . "Tab") "dashboard")}}</li>{{end}} 21 <li>{{template "raillink" dict "Href" "/explore" "Icon" "compass" "Name" "Explore" "Label" "Explore" "Current" (eq (str . "Tab") "explore")}}</li>
26 <li>{{template "raillink" dict "Href" "/explore" "Icon" "compass" "Name" "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}}
27 <li class="railsearch-mob">{{template "raillink" dict "Href" "/search" "Icon" "search" "Name" "Search" "Current" (eq (str . "Tab") "sitesearch")}}</li> 30 <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}}
31 </ul> 31 </ul>
32 <form method="get" action="/search" class="railsearch" role="search"> 32 <form method="get" action="/search" class="railsearch" role="search">
33 <input type="search" name="q" aria-label="Search repositories, issues, and merge requests" placeholder="Search repositories, issues, MRs…"> 33 <input type="search" name="q" aria-label="Search repositories, issues, and merge requests" placeholder="Search repositories, issues, MRs…">
@@ -35,16 +35,22 @@
35 </form> 35 </form>
36 <span class="railgap"></span> 36 <span class="railgap"></span>
37 <div class="railfoot"> 37 <div class="railfoot">
38 {{if .Viewer}}<details class="railmore"> 38 {{if .Viewer}}
39 <summary class="railicon" aria-label="More" title="More">{{template "icon" "ellipsis"}}<span class="vh">More</span></summary> 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>
40 <div class="raildrop"> 41 <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>
42 </div> 45 </div>
43 </details> 46 </details>
47 {{template "raillink" dict "Href" "/notifications" "Icon" "bell" "Name" "Notifications" "Current" (eq (str . "Tab") "notifications") "Count" .Rail.Unread}}
44 <details class="railusermenu"> 48 <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>
46 <div class="raildrop"> 50 <div class="raildrop">
47 <a class="railuser" href="/{{.Viewer}}">{{template "icon" "person"}} <span><strong>{{.Viewer}}</strong></span></a> 51 <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>
48 <hr class="railsep"> 54 <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> 55 {{$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}} 56 {{$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 @@
52 {{$logout := index $items 3}}<a href="{{$logout.Href}}">{{template "icon" $logout.Icon}} {{$logout.Name}}</a> 58 {{$logout := index $items 3}}<a href="{{$logout.Href}}">{{template "icon" $logout.Icon}} {{$logout.Name}}</a>
53 </div> 59 </div>
54 </details> 60 </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}}
56 </div> 62 </div>
57</nav> 63</nav>
58 64
@@ -135,7 +141,7 @@
135 141
136{{/* raillink draws one square in the rail: the icon, the name for a 142{{/* raillink draws one square in the rail: the icon, the name for a
137 screen reader and in the tooltip, and the bell's unread badge. */}} 143 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}}
139 145
140{{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}} 146{{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}}
141{{define "width"}}reading{{end}} 147{{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