Commit 0f8dbb4063
0f8dbb40635c1cb9cef8279fbe1f2db9a1afdad2
parent: f8dd492920
Verified · cmc
cmc <hello@cleberg.net> · 2026-09-22 04:39 UTC
web: Explore is a rail square at every width
It was .railopt, so below 34rem it dropped into the More menu — which
layout.html renders only for a signed-in viewer. A signed-out phone had
no route to the listing from any page; the footer carries no link
either. Six squares and the mark are 308px, inside a 320px phone.
Ref #248
internal/httpd/railanon_test.go
added
+39
| @@ -0,0 +1,39 @@ |
| 1 | package httpd |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | |
| 7 | "gitbay.org/gitbay/internal/web" |
| 8 | ) |
| 9 | |
| 10 | // Below 34rem the rail hides every .railopt square and the More menu |
| 11 | // holds them instead — but that menu is rendered only for a signed-in |
| 12 | // viewer. A square a signed-out visitor can use therefore cannot be |
| 13 | // .railopt: it would hide with nothing to hold it. Explore was, so a |
| 14 | // signed-out phone had no route to the listing from any page (#248). |
| 15 | func TestSignedOutRailDropsNothing(t *testing.T) { |
| 16 | var sb strings.Builder |
| 17 | err := web.Render(&sb, "explore.html", struct { |
| 18 | basePage |
| 19 | Tab string |
| 20 | Query string |
| 21 | Facets []facetGroup |
| 22 | Repos []describedRepo |
| 23 | }{basePage{Site: "gitbay"}, "explore", "", nil, nil}) |
| 24 | if err != nil { |
| 25 | t.Fatalf("render: %v", err) |
| 26 | } |
| 27 | out := sb.String() |
| 28 | end := strings.Index(out, "</nav>") |
| 29 | if end < 0 { |
| 30 | t.Fatalf("no rail in the rendered page:\n%s", out) |
| 31 | } |
| 32 | rail := out[:end] |
| 33 | if strings.Contains(rail, "railopt") { |
| 34 | t.Errorf("a signed-out rail marks a square railopt, with no More menu to hold it:\n%s", rail) |
| 35 | } |
| 36 | if !strings.Contains(rail, `href="/explore"`) { |
| 37 | t.Errorf("a signed-out rail carries no Explore square:\n%s", rail) |
| 38 | } |
| 39 | } |
internal/web/static/style.css
+7 −4
| @@ -1861,10 +1861,13 @@ svg.icon { vertical-align: -0.125em; } |
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | /* Nine 44px squares and the mark are 440px, so below 34rem the rail |
| 1864 | | keeps five — dashboard, search, notifications, More, your avatar — and |
| 1865 | | the More menu holds the rest. Shrinking the squares instead is what |
| 1866 | | this replaces: 32px was under the target every phone guideline asks |
| 1867 | | for, and the count only grows. */ |
| 1864 | keeps six — dashboard, explore, search, notifications, More, your |
| 1865 | avatar — and the More menu holds the rest. Seven squares at 44px are |
| 1866 | 308px, inside a 320px phone. Explore is one of the six because the |
| 1867 | More menu only exists for a signed-in viewer: dropping it left a |
| 1868 | signed-out phone with no route to the listing at all. Shrinking the |
| 1869 | squares instead is what this replaces: 32px was under the target |
| 1870 | every phone guideline asks for, and the count only grows. */ |
| 1868 | 1871 | @media (max-width: 34rem) { |
| 1869 | 1872 | .railopt { display: none; } |
| 1870 | 1873 | .railmore { display: block; } |
internal/web/templates/layout.html
+1 −2
| @@ -19,7 +19,7 @@ |
| 19 | 19 | are kept in step by hand: add a square there and add it here. */}} |
| 20 | 20 | <ul class="raillist"> |
| 21 | 21 | {{if .Viewer}}<li>{{template "raillink" dict "Href" "/" "Icon" "home" "Name" "Dashboard" "Current" (eq (str . "Tab") "dashboard")}}</li>{{end}} |
| 22 | | <li class="railopt">{{template "raillink" dict "Href" "/explore" "Icon" "compass" "Name" "Explore" "Current" (eq (str . "Tab") "explore")}}</li> |
| 22 | <li>{{template "raillink" dict "Href" "/explore" "Icon" "compass" "Name" "Explore" "Current" (eq (str . "Tab") "explore")}}</li> |
| 23 | 23 | <li>{{template "raillink" dict "Href" "/search" "Icon" "search" "Name" "Search" "Current" (eq (str . "Tab") "sitesearch")}}</li> |
| 24 | 24 | {{if .Viewer}}<li>{{template "raillink" dict "Href" "/notifications" "Icon" "bell" "Name" "Notifications" "Current" (eq (str . "Tab") "notifications") "Count" .Rail.Unread}}</li> |
| 25 | 25 | <li class="railopt">{{template "raillink" dict "Href" "/new" "Icon" "plus" "Name" "New repository"}}</li>{{end}} |
| @@ -33,7 +33,6 @@ |
| 33 | 33 | {{if .Viewer}}<details class="railmore"> |
| 34 | 34 | <summary class="railicon" aria-label="More" title="More">{{template "icon" "ellipsis"}}<span class="vh">More</span></summary> |
| 35 | 35 | <div class="raildrop"> |
| 36 | | <a href="/explore">{{template "icon" "compass"}} Explore</a> |
| 37 | 36 | <a href="/new">{{template "icon" "plus"}} New repository</a> |
| 38 | 37 | <a href="/settings">{{template "icon" "gear"}} Settings</a> |
| 39 | 38 | {{if .Admin}}<a href="/admin">{{template "icon" "shield"}} Admin</a>{{end}} |