Console: header wraps at 390 px
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+36
−5
internal/console/appnav_test.go+17 −0internal/console/navsnapshot_test.go+15 −1internal/console/templates/layout.html+4 −4
CI failed — run details
diff --git a/internal/console/appnav_test.go b/internal/console/appnav_test.go| index 17b73eee8..0362480f1 100644 |
| --- a/internal/console/appnav_test.go |
| +++ b/internal/console/appnav_test.go |
| @@ -353,3 +353,20 @@ func TestAccountSettingsFormsUseSettingsRow(t *testing.T) { |
| t.Errorf("%d small Save buttons, want 2", n) |
| } |
| } |
| + |
| +func TestHeaderWrapsOnNarrowScreens(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + c := signInPaul(t, fx) |
| + status, _, body := get(t, c, fx.u("/apps/kass")) |
| + if status != 200 { |
| + t.Fatalf("GET /apps/kass = %d", status) |
| + } |
| + for _, sel := range []string{"header", "header nav"} { |
| + if blk := cssBlock(t, body, sel); !strings.Contains(blk, "flex-wrap: wrap") { |
| + t.Errorf("%s does not wrap: %s", sel, blk) |
| + } |
| + } |
| + if blk := cssBlock(t, body, "header .addr"); !strings.Contains(blk, "text-overflow: ellipsis") { |
| + t.Errorf("header .addr does not truncate: %s", blk) |
| + } |
| +} |
diff --git a/internal/console/navsnapshot_test.go b/internal/console/navsnapshot_test.go| index bd81234c2..752176dd1 100644 |
| --- a/internal/console/navsnapshot_test.go |
| +++ b/internal/console/navsnapshot_test.go |
| @@ -1,6 +1,7 @@ |
| package console |
| import ( |
| + "fmt" |
| "os" |
| "path/filepath" |
| "testing" |
| @@ -24,7 +25,8 @@ func TestNavSnapshots(t *testing.T) { |
| "logs": "/apps/kass/logs", "errors": "/apps/kass/errors", "availability": "/apps/kass/availability", |
| "analytics": "/apps/kass/analytics", "activity": "/apps/kass/activity", |
| "settings": "/apps/kass/settings", "placement": "/apps/kass/settings/placement", |
| - "apps": "/", "trash": "/trash", "account-settings": "/settings", |
| + "errors-analytics": "/apps/kass/settings/errors-analytics", |
| + "apps": "/", "trash": "/trash", "account-settings": "/settings", |
| } { |
| _, _, body := get(t, c, fx.u(path)) |
| if err := os.WriteFile(filepath.Join(dir, name+".html"), []byte(body), 0o644); err != nil { |
| @@ -37,4 +39,16 @@ func TestNavSnapshots(t *testing.T) { |
| if err := os.WriteFile(filepath.Join(dir, "releases-full.html"), []byte(body), 0o644); err != nil { |
| t.Fatal(err) |
| } |
| + // Releases past 20 versions: page 1 links older ones, page 2 holds the rest. |
| + many := newConsoleFixture(t) |
| + for i := 10; i <= 30; i++ { |
| + shipVersion(t, many, "kass", fmt.Sprintf("v%d", i)) |
| + } |
| + mc := signInPaul(t, many) |
| + for name, path := range map[string]string{"releases-p1": "/apps/kass/releases", "releases-p2": "/apps/kass/releases?page=2"} { |
| + _, _, pg := get(t, mc, many.u(path)) |
| + if err := os.WriteFile(filepath.Join(dir, name+".html"), []byte(pg), 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| } |
diff --git a/internal/console/templates/layout.html b/internal/console/templates/layout.html| index f0f116cce..67f8238d8 100644 |
| --- a/internal/console/templates/layout.html |
| +++ b/internal/console/templates/layout.html |
| @@ -72,15 +72,15 @@ |
| .icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; } |
| header { |
| max-width: 64rem; margin: 0 auto; padding: 1.4rem 0; |
| - display: flex; align-items: baseline; gap: 1rem; |
| + display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; row-gap: 0.5rem; |
| border-bottom: 1px solid var(--rule); |
| } |
| header .brand a { font-weight: 700; color: var(--ink); text-decoration: none; } |
| header nav { |
| - margin-left: auto; display: flex; align-items: baseline; gap: 1rem; |
| + margin-left: auto; display: flex; align-items: baseline; gap: 0.5rem 1rem; flex-wrap: wrap; |
| font-size: 0.9rem; |
| } |
| - header .addr { color: var(--muted); } |
| + header .addr { color: var(--muted); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| /* The account switcher sits where the wordmark used to: a <details> |
| disclosure, so it is a real button to a screen reader, opens on |
| Enter/Space, and needs no JavaScript to work at all. The inline script |
| @@ -593,7 +593,7 @@ |
| <a href="{{.Nav}}/team"{{if eq .ActiveNav "team"}} aria-current="page"{{end}}>Team</a> |
| <a href="{{.Nav}}/settings"{{if eq .ActiveNav "settings"}} aria-current="page"{{end}}>Settings</a> |
| {{end}} |
| - <a class="addr" href="/settings" title="Your settings">{{.Address}}</a> |
| + <a class="addr" href="/settings" title="{{.Address}}">{{.Address}}</a> |
| <form method="post" action="/auth/signout"> |
| <input type="hidden" name="csrf" value="{{.CSRF}}"> |
| <button class="linkish" type="submit">Sign out</button> |