From 07bd4d4601e57df13ca7de3dd91abd541b9df140 Mon Sep 17 00:00:00 2001 From: daniel daum Date: Tue, 24 Nov 2026 10:58:30 -0800 Subject: [PATCH] fix: plain-word repo tabs, hide empty tabs, three-language legend --- docs/decisions.md | 28 ++++++++++++ internal/build/repo.go | 6 +-- testdata/golden/index.html | 6 +-- testdata/golden/repo-a/blob/README.md.html | 20 ++++----- testdata/golden/repo-a/blob/big.txt.html | 20 ++++----- .../golden/repo-a/blob/cmd/hello/main.go.html | 20 ++++----- testdata/golden/repo-a/blob/data.bin.html | 20 ++++----- .../golden/repo-a/blob/docs/logo.png.html | 20 ++++----- testdata/golden/repo-a/branches/index.html | 20 ++++----- testdata/golden/repo-a/commit-latest.html | 20 ++++----- testdata/golden/repo-a/index.html | 24 +++++----- testdata/golden/repo-a/issues/index.html | 20 ++++----- testdata/golden/repo-a/log/index.html | 20 ++++----- testdata/golden/repo-a/packages/index.html | 20 ++++----- testdata/golden/repo-a/pulls/index.html | 20 ++++----- testdata/golden/repo-a/releases/index.html | 20 ++++----- testdata/golden/repo-a/tags/index.html | 20 ++++----- .../golden/repo-a/tree/cmd/hello/index.html | 20 ++++----- testdata/golden/repo-a/tree/docs/index.html | 20 ++++----- testdata/golden/repo-b/index.html | 16 +++---- testdata/golden/repo-b/issues/index.html | 17 +++---- testdata/golden/repo-b/log/index.html | 16 +++---- testdata/golden/repo-b/releases/index.html | 17 +++---- testdata/golden/repos/index.html | 6 +-- web/static/style.css | 44 ++++++++++--------- web/templates/_repo.html | 22 +++++++--- 26 files changed, 264 insertions(+), 238 deletions(-) diff --git a/docs/decisions.md b/docs/decisions.md index 5a5ee3e..30bf809 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -884,3 +884,31 @@ allowlist of request headers instead of stripping a denylist; git proxying is capped at 8 concurrent requests (503 beyond); registry blobs are always downloads; issue, pull and comment bodies are cut at 32 KB and threads show their newest 100 comments. + +## A quieter code bar + +On an iPhone the repo tabs overlapped: Safari shrank the scrolling tabs +below their content, so each icon sat on the previous word. Even where they +fit, six icons, six labels and four count pills under a wrapping language +legend made the top of the code box busy. This replaces "Tab bars that fit" +for the repo tabs; the README box's document tabs are unchanged. + +- **Plain words.** The repo tabs drop their icons and read like the site + nav above them: secondary text, the open tab in `--accent-bright` with an + underline as wide as the word, 1.5rem apart (1.25rem on phones). Counts + are small secondary numerals, not pills. `flex: none` on each tab stops + Safari's squeeze. +- **Only tabs with something in them.** Code and Commits always show. + Releases, Issues, Pulls and Packages show when they have at least one + item, or when they're the open page (an old link to an empty page still + says where you are). The pages themselves still exist. +- **Three languages and "other".** `langBar` keeps the three largest + languages instead of six; the rest join "other", in the legend and the + strip. On phones the legend is 0.75rem with 0.75rem gaps. +- **Widths** (Geist Pixel advances, as before): all six tabs with counts + take 448px of the 631px column. On a 390px phone (358px of content) the + showcase repo's three tabs take 202px; all six take 428px and scroll with + the edge fade. The legend for Go, CSS, HTML and other takes 335px on a + phone, so it stays on one line down to 375px screens. +- Not checked in a real browser in this pass: the numbers come from the + font's metrics, not a render. diff --git a/internal/build/repo.go b/internal/build/repo.go index 0c49791..78b4f5e 100644 --- a/internal/build/repo.go +++ b/internal/build/repo.go @@ -511,8 +511,8 @@ func licenseName(src []byte) string { return "license" } -// langBar turns Gitea's bytes-per-language into bar segments: the six -// largest, plus "other" for the rest. +// langBar turns Gitea's bytes-per-language into bar segments: the three +// largest, plus "other" for the rest, so the legend fits one line on phones. func langBar(bytes map[string]int64) []Lang { var total int64 names := make([]string, 0, len(bytes)) @@ -527,7 +527,7 @@ func langBar(bytes map[string]int64) []Lang { x, rest := 0.0, 0.0 for i, n := range names { pct := 100 * float64(bytes[n]) / float64(total) - if i >= 6 || pct < 0.5 { + if i >= 3 || pct < 0.5 { rest += pct continue } diff --git a/testdata/golden/index.html b/testdata/golden/index.html index 22fb10d..a9e721b 100644 --- a/testdata/golden/index.html +++ b/testdata/golden/index.html @@ -21,9 +21,9 @@ - - - + + + diff --git a/testdata/golden/repo-a/blob/README.md.html b/testdata/golden/repo-a/blob/README.md.html index 60183a2..b6dd929 100644 --- a/testdata/golden/repo-a/blob/README.md.html +++ b/testdata/golden/repo-a/blob/README.md.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/blob/big.txt.html b/testdata/golden/repo-a/blob/big.txt.html index 9e033f1..e8b039f 100644 --- a/testdata/golden/repo-a/blob/big.txt.html +++ b/testdata/golden/repo-a/blob/big.txt.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/blob/cmd/hello/main.go.html b/testdata/golden/repo-a/blob/cmd/hello/main.go.html index eb5fd99..5f318c3 100644 --- a/testdata/golden/repo-a/blob/cmd/hello/main.go.html +++ b/testdata/golden/repo-a/blob/cmd/hello/main.go.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/blob/data.bin.html b/testdata/golden/repo-a/blob/data.bin.html index 1bbacce..fac77e4 100644 --- a/testdata/golden/repo-a/blob/data.bin.html +++ b/testdata/golden/repo-a/blob/data.bin.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/blob/docs/logo.png.html b/testdata/golden/repo-a/blob/docs/logo.png.html index 241100c..3f6aec4 100644 --- a/testdata/golden/repo-a/blob/docs/logo.png.html +++ b/testdata/golden/repo-a/blob/docs/logo.png.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/branches/index.html b/testdata/golden/repo-a/branches/index.html index b82b54d..24856bb 100644 --- a/testdata/golden/repo-a/branches/index.html +++ b/testdata/golden/repo-a/branches/index.html @@ -10,13 +10,13 @@ - - - + + + - +

2 branches

diff --git a/testdata/golden/repo-a/commit-latest.html b/testdata/golden/repo-a/commit-latest.html index be1242b..84bf8ac 100644 --- a/testdata/golden/repo-a/commit-latest.html +++ b/testdata/golden/repo-a/commit-latest.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/index.html b/testdata/golden/repo-a/index.html index feb55bc..1310532 100644 --- a/testdata/golden/repo-a/index.html +++ b/testdata/golden/repo-a/index.html @@ -11,13 +11,13 @@ - - - + + + - + -
  • Go79.8%
  • HTML12.3%
  • CSS6.1%
  • Shell1.4%
  • other0.5%
  • +
    • Go79.8%
    • HTML12.3%
    • CSS6.1%
    • other1.8%
    - +
    main
    diff --git a/testdata/golden/repo-a/issues/index.html b/testdata/golden/repo-a/issues/index.html index 3d9a316..3e111b4 100644 --- a/testdata/golden/repo-a/issues/index.html +++ b/testdata/golden/repo-a/issues/index.html @@ -10,13 +10,13 @@ - - - + + + - +

1 open · 1 closed

diff --git a/testdata/golden/repo-a/log/index.html b/testdata/golden/repo-a/log/index.html index 69dc056..108de4b 100644 --- a/testdata/golden/repo-a/log/index.html +++ b/testdata/golden/repo-a/log/index.html @@ -10,13 +10,13 @@ - - - + + + - +

Latest 27 of 27 commits on main

diff --git a/testdata/golden/repo-a/packages/index.html b/testdata/golden/repo-a/packages/index.html index 451a6e2..dfbbcea 100644 --- a/testdata/golden/repo-a/packages/index.html +++ b/testdata/golden/repo-a/packages/index.html @@ -10,13 +10,13 @@ - - - + + + - +

code.danieldaum.net/daniel/repo-acontainer2 versions

diff --git a/testdata/golden/repo-a/pulls/index.html b/testdata/golden/repo-a/pulls/index.html index 24566d2..6d32980 100644 --- a/testdata/golden/repo-a/pulls/index.html +++ b/testdata/golden/repo-a/pulls/index.html @@ -10,13 +10,13 @@ - - - + + + - +

5 pull requests

diff --git a/testdata/golden/repo-a/releases/index.html b/testdata/golden/repo-a/releases/index.html index 4ea16e9..369c968 100644 --- a/testdata/golden/repo-a/releases/index.html +++ b/testdata/golden/repo-a/releases/index.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/tags/index.html b/testdata/golden/repo-a/tags/index.html index 323d915..e0cb57f 100644 --- a/testdata/golden/repo-a/tags/index.html +++ b/testdata/golden/repo-a/tags/index.html @@ -10,13 +10,13 @@ - - - + + + - +

2 tags

diff --git a/testdata/golden/repo-a/tree/cmd/hello/index.html b/testdata/golden/repo-a/tree/cmd/hello/index.html index a2f9cf2..e5f0d75 100644 --- a/testdata/golden/repo-a/tree/cmd/hello/index.html +++ b/testdata/golden/repo-a/tree/cmd/hello/index.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-a/tree/docs/index.html b/testdata/golden/repo-a/tree/docs/index.html index c4327af..bed2838 100644 --- a/testdata/golden/repo-a/tree/docs/index.html +++ b/testdata/golden/repo-a/tree/docs/index.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-b/index.html b/testdata/golden/repo-b/index.html index 0acafd5..a2933f2 100644 --- a/testdata/golden/repo-b/index.html +++ b/testdata/golden/repo-b/index.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-b/issues/index.html b/testdata/golden/repo-b/issues/index.html index e088f3d..317f36e 100644 --- a/testdata/golden/repo-b/issues/index.html +++ b/testdata/golden/repo-b/issues/index.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-b/log/index.html b/testdata/golden/repo-b/log/index.html index 2aa720e..3d98ca7 100644 --- a/testdata/golden/repo-b/log/index.html +++ b/testdata/golden/repo-b/log/index.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repo-b/releases/index.html b/testdata/golden/repo-b/releases/index.html index 6b31a09..42017f2 100644 --- a/testdata/golden/repo-b/releases/index.html +++ b/testdata/golden/repo-b/releases/index.html @@ -10,13 +10,13 @@ - - - + + + - +
diff --git a/testdata/golden/repos/index.html b/testdata/golden/repos/index.html index 6c19931..c9dd35d 100644 --- a/testdata/golden/repos/index.html +++ b/testdata/golden/repos/index.html @@ -10,9 +10,9 @@ - - - + + + diff --git a/web/static/style.css b/web/static/style.css index a282684..01626a7 100644 --- a/web/static/style.css +++ b/web/static/style.css @@ -2600,24 +2600,26 @@ a.tl-sha:hover { color: var(--accent-bright); } -/* repo tabs */ +/* repo tabs: plain words like the site nav, the open one in the accent and + underlined. The underline is as wide as the word. */ .tabs { display: flex; flex-wrap: nowrap; /* saturn's nav wraps; tabs scroll instead */ - gap: 0; + gap: 1.5rem; margin: 0 0 1.25rem; overflow-x: auto; border-bottom: 1px solid var(--rule); - font-size: 0.85rem; + font-size: 0.875rem; scrollbar-width: none; } .tabs a { + flex: none; /* Safari shrinks scrolling flex items until they overlap */ display: inline-flex; - align-items: center; - gap: 0.35rem; + align-items: baseline; + gap: 0.3rem; margin-bottom: -1px; - padding: 0.6rem 0.45rem; + padding: 0.6rem 0; border-bottom: 2px solid transparent; color: var(--text-secondary); white-space: nowrap; @@ -2626,28 +2628,16 @@ a.tl-sha:hover { .tabs a:hover { color: var(--text-headings); - border-bottom-color: var(--rule); } .tabs a[aria-current="page"] { - color: var(--text-headings); - font-weight: 500; - border-bottom-color: var(--accent-bright); -} - -.tabs a[aria-current="page"] .icon { color: var(--accent-bright); + border-bottom-color: var(--accent-bright); } .count { - min-width: 1.25rem; - padding: 0 0.35rem; - border-radius: 999px; - background: var(--hover); - color: var(--text-headings); - font-size: 0.7rem; - font-weight: 500; - text-align: center; + color: var(--text-secondary); + font-size: 0.75rem; } /* code box */ @@ -2893,6 +2883,14 @@ a.ci:hover { color: var(--text-secondary); } +/* phones: the three languages and "other" stay on one line */ +@media (max-width: 600px) { + .lang-legend { + gap: 0.25rem 0.75rem; + font-size: 0.75rem; + } +} + /* breadcrumbs */ .crumbs { display: flex; @@ -2943,6 +2941,10 @@ a.ci:hover { padding-right: 2rem; mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); } + + .tabs { + gap: 1.25rem; + } } .doc-tabs label { diff --git a/web/templates/_repo.html b/web/templates/_repo.html index 418f06d..0ee52e5 100644 --- a/web/templates/_repo.html +++ b/web/templates/_repo.html @@ -35,14 +35,24 @@ {{- end}} +{{- /* tabs: plain words like the site nav. Releases, issues, pulls and + packages only show when there's something in them, or when open. */}} {{- end}} -- knotmirror 0.0.1