Repository navigation
Menu bar: size columns from measured text; name the local connection per platform - #195
Merged
Merged
Conversation
fylorn
force-pushed
the
fix/menubar-text-and-local-name
branch
from
September 25, 2026 00:05
34b1b46 to
a6a1353
Compare
The quota rows assumed a 92 pt reset column and the Today row split its
width into equal thirds. Both fit the Chinese strings, but English runs
past them: "Resets in 3 days" (92.2 pt) and "Resets in 42 min" (93.8 pt)
ran into the percentage ("31%Resets in 3 days"), and "Requests 4 failed"
(93.7 pt) ran into the next cell ("Requests 4 failedTokens").
- Quota rows: the window-name and reset columns are measured, across
every quota row in the menu so the bars stay aligned, and never
narrower than before. The bar takes what is left, down to 40 pt;
past that the reset text is cut with an ellipsis.
- Today: cells stay equal while everything fits. A cell that needs more
gets its width and the others share the rest; if nothing fits, the
widths follow the content and the text is cut within its cell.
- The header title (a remote server's name) and the name in an
in-progress row are cut before the text on their right instead of
running under it.
The Chinese strings all fit the old minimum widths, so the Chinese
menu renders byte-for-byte the same as before (checked on every
menubar_preview state).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Rust side named the built-in connection tr!("本机", "This Mac") on
every platform, so the Connection submenu of the Windows and Linux tray
said "This Mac" in English. The name now comes from one function,
connection::store::local_name(): "This Mac" on macOS, "This computer"
elsewhere, "本机" in Chinese everywhere. The connection list, the tray
and menu bar submenu and the local connect errors all use it, and the
menu bar preview shows it.
The interface keeps writing the local name itself (connText.local, same
wording) so it follows a language switch at once. Every place that
shows a connection's name now goes through profileName(), including
the switch dialog and the not-connected page, and the local name is
defined once in connection.i18n.tsx.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
force-pushed
the
fix/menubar-text-and-local-name
branch
from
September 25, 2026 00:12
a6a1353 to
8d43211
Compare
fylorn
added a commit
that referenced
this pull request
Sep 25, 2026
Generated with `pnpm shots` on dev at 3b8638e (after the Keys, Clients, Routing, Upstreams, Settings, Traffic and Overview redesigns, #190-#199), core v0.47.0. Two complete runs produce byte-identical files. - `{zh,en}/<scene>-{light,dark}.png`: 13 scenes, 2360x1540. - `menubar-{light,dark}.png` (178x64) and `{zh,en}/menubar-menu-*.png` (664x1120). - `web/`: the website variants (WebP from the dark images, and the dark menu bar item as PNG). The English menu images were drawn with the menu bar layout fix from #195 applied, which this branch does not contain: without it, "Resets in 3 days" and "4 failed" run into the text beside them. Every other image, including the Chinese menus, is the same with or without that fix. The old images and the README references are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 25, 2026
) * build(shots): regenerate the product screenshots from the real interface The screenshots in docs/screenshots/ were taken with a pipeline that lived in an ignored local directory and was lost. This one is in the repository and runs with one command, `pnpm shots` (macOS only): - scripts/shots/ is a separate Vite entry that mounts src/main.tsx on mocked IPC. It is not part of the app build, and src/index.css now keeps scripts/ out of Tailwind's source scan, so the app bundle is the same with or without it. - The configuration views (upstreams, keys, routes, security rules, prices, dry runs) are what the pinned core answers for a demo configuration, stored in scripts/shots/core/ and regenerated by oracle.sh. Masking, detected protocols, rule flags and prices are therefore core's own, and sentences carry their real message codes. - The clock is fixed and the traffic comes from a fixed seed, so two runs write byte-identical files. - capture.swift renders each scene in the system WKWebView, the engine the app uses on macOS, and frames it as a macOS 26 window. - examples/menubar_shots.rs draws the menu bar item and its menu with the app's own rendering code, at exactly 2x. - finish.mjs writes 256-colour PNGs to docs/screenshots/ and the website's WebP variants to docs/screenshots/web/. sharp is a new dev dependency; its install script is not needed and not allowed to run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * build(shots): follow the redesigned pages and catch mock drift in CI The Keys and Clients redesign (#190) changed `key_usage` to take `{sinceMs, bucketMs}` and return `KeyUsage`, and `upstream_stats` gained hourly buckets. The mock still answered the old shapes, and nothing failed: its command handlers returned `unknown`, so the pages rendered error states that the capture accepted. - Every Tauri command handler now returns the type the interface reads (`KeyUsage`, `UpstreamStats`, `Dashboard`, `ConnView`, ...), and the stored core answers are checked against the core types. `pnpm typecheck`, which CI runs, now includes `scripts/shots/`, so a changed generated type fails the Frontend job. It already caught the Overview redesign (#196) dropping `history` from `Dashboard`. - At capture time, a command the mock does not answer or one called without the arguments it expects is logged as an error and stops the run, instead of falling back to a default time window. - `key_usage` and `upstream_stats` return totals plus sparse buckets, as tw-store's `cost_by` / `cost_buckets_by` do; `input_tokens` in the totals no longer includes cache reads and writes. `dashboard` computes latency over the same window as the summary, with tw-store's percentile rule, as dashboard.rs now asks for. - The menu bar images take the page's fixed clock (`--now`) instead of the system clock, so runs on different days are byte-identical. Run on its own, `menubar_shots` uses the same instant. - A scene with a table that does not fit the window fails instead of being captured with its last columns cut off. The MCP scene collapses the sidebar so the six client columns fit. - Demo configuration: every secret keeps the first 5 and last 4 characters shown in the masked views, with EXAMPLE in the middle (zeros for the hex control key). Cursor's key gets its own route to a `cheapest` group, so the routing page has three routes and three groups; the core answers are regenerated with oracle.sh (core v0.47.0). - Review fixes: the hidden-text event counts 74 characters, the length of the text it reveals; the remote MCP finding uses tw-scan's rule id `remote-mcp`; CONTRIBUTING names `fetch-core.sh` and uses US spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(screenshots): add screenshots of the current interface Generated with `pnpm shots` on dev at 3b8638e (after the Keys, Clients, Routing, Upstreams, Settings, Traffic and Overview redesigns, #190-#199), core v0.47.0. Two complete runs produce byte-identical files. - `{zh,en}/<scene>-{light,dark}.png`: 13 scenes, 2360x1540. - `menubar-{light,dark}.png` (178x64) and `{zh,en}/menubar-menu-*.png` (664x1120). - `web/`: the website variants (WebP from the dark images, and the dark menu bar item as PNG). The English menu images were drawn with the menu bar layout fix from #195 applied, which this branch does not contain: without it, "Resets in 3 days" and "4 failed" run into the text beside them. Every other image, including the Chinese menus, is the same with or without that fix. The old images and the README references are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shots: wait for the traffic table's deferred render before capturing The table body renders through useDeferredValue; on a busy machine the capture's idle and stable-snapshot checks pass before that render commits, and the scene is shot with only the in-flight row while the run succeeds. Wait until the table has its rows. Images are unchanged at normal speed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs found while shooting the English product screenshots.
1. Overlapping text in the English menu bar menu
The custom rows in
src-tauri/src/menubar/macos.rsassumed widths that only the Chinese strings fit:31%Resets in 3 daysRequests 4 failedTokensThe fix measures the text instead:
share_columns).fit()(the ellipsis helper behinddraw_clipped) allows 0.001 pt of floating-point error. A column computed as width + gap − gap can otherwise come out a hair short and cut text that fits ("4 fai…").The Chinese layout is unchanged. Every Chinese string fits the old minimum widths.
menubar_preview --pngfor all five states renders byte-identical Chinese PNGs before and after, along with every English state that has no quota or failure note.Verification (English,
alertstate, ink runs measured on the rendered PNG; no screenshots attached):63%andResetsformed one run. After,63%ends at 189.5 pt andResetsstarts at 202.8 pt (a 13.2 pt gap).100%andResets in 42 minnow have an 11.5 pt gap.failedandTokensformed one run. After, there is an 11.2 pt gap.menubar_shotsfrom docs: product screenshots from a committed, deterministic pipeline #189,--today 11200000 9870000 214 4) shows the same result:31%then an 11.5 pt gap beforeResets in 3 days, and4 failedthen an 11 pt gap beforeTokens.New tests in
menubar::macosmeasure real AppKit text. English reset times must leaveTEXT_GAPafter the percentage. The failure note must stay inside its cell in both languages. The Chinese columns must equal the old constants. Two more tests covershare_columnsandfit. Reverting to the fixed widths makes both English tests fail: "Resets in 42 min" starts 1.8 pt inside the percentage, and the "Requests / 4 failed" cell does not fit in 93.3 pt.2. "This Mac" on Windows and Linux
The Rust side named the built-in connection
tr!("本机", "This Mac")on every platform. The English Connection submenu of the Windows and Linux tray therefore read "This Mac". The name now comes from a single function,connection::store::local_name():It is used by the connection list (
connection::view), the menu bar and tray submenus (they read that list), and the local-connection errors inconnector::test. Themenubar_previewsnapshot uses it too.The interface still writes the local name itself (
connText.local, same wording) so a language switch applies at once. The following changes make it consistent:profileName(). This includes the switch dialog (titles, the retarget report, the toast and the checkbox), the not-connected page (titles) and the delete confirmation.connection.i18n.tsx(localZh/localEn, used bylocalandstartupLocal).profileNameignores the Rust-provided name for the local profile and writes "This computer" off macOS.menubar_preview sub --en --dumpnow listsConnection→✓ This Mac. The Rust test asserts "This Mac" on macOS and "This computer" on the Windows and Linux CI jobs.Rebase note
The branch was rebased onto dev after #194 merged. In
SwitchDialog.tsx, the two lines both PRs touched keep #194'snotify.success(...)anddisabled={busy}and usenamefor the connection name.Checks run locally
bash scripts/version.sh,pnpm typecheck,pnpm build,pnpm test(321 passed)cargo fmt --all --checkcargo clippy --all-targets -- -D warningscargo test(404 passed;control_planeran against twcore 0.47.0)🤖 Generated with Claude Code