tui: clean-look chrome redesign (one accent, honest tor phase, real frames) #120
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_bcf0ae45-onionwire-tui-clean-look-chrome-redesign"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
The main screen (
draw_main_chrome) is rebuilt around one accent, one primary pane and one honest status line. This applies the principles of bitchat-tui (MIT) — no code was copied; the Ratatui versions differ (0.26 vs 0.30) and its wrap helper countscharunits where OnionWire counts cells.App::draw_mainnow builds aMainViewof plain data and calls the publicdraw_main_chrome, sotests/tui_frames.rsdumps the real chrome — no reconstructed stand-in. Every frame below was produced bycargo test --locked --test tui_frames -- --nocapture dump_audit_frames.Before — 80x24
After — 80x24
Before — 120x40
After — 120x40
After — 200x60 (must not break)
States
Empty roster + connecting:
Disconnected (tor off) + fingerprint mismatch:
Error (alert row + fail-closed note) — the sentence is printed once, in the error channel:
Outbox queued (peer unreachable):
Empty roster at the target size:
What changed, lever by lever
style_accenton the focused pane border,style_highlighton the selected roster row,>marker on the active conversation. The header gives up the accent, which is what stops it competing with the panes>prefix on the roster row / chat title / composer; bold on the focused title;focus_is_a_marker_not_only_colourasserts it at 80 and 120style_border. No glow, no blinkingpane_footer_hints(Pane)+TorPhasefolded into theTORtokenchat_no_friends_lines,empty_roster_lines,TorPhase::word()draw_text_overlayclears the area then centres a popup with a one-cell side margin (help_overlay_keeps_a_margin_and_shows_the_tail)stale; nothing else is coloured◷ queued (try 1/8, retry 45s),✓/okfor delivered,failed: …for terminal. No unread count exists in the render path — see belowTor phase is now a first-class state
Node::tor_state()was already cheap, read-only and unused by the TUI. It is read straight from theArc<Node>theAppalready holds — no new data field, no store read from the render path:hs::TorStateTorPhaseBootstrappingConnecting…/...connectingPublishedReady✓/okreadyDegradedReachableDegraded!degradedStoppedOffxoffBoth the header and the footer state it, and always as a word plus a glyph, so it survives
NO_COLOR, a 16-colour terminal and a monochrome dump.Footer variants (all locked strings kept)
status_footer(w, fp, onion, note, hints)TOR,onion:status_footer_phased(w, fp, onion, phase, note, hints){glyph} TOR {word},onion:status_footer_compact(w, fp, phase, note, hints){glyph} TOR {word}onlyme:andonion:The main footer drops the onion (the header has it one line above) and gives those cells to the hints.
TOR,me:and? helpsurvive at 80, 120 and 200 in every variant;status_footer's signature and fail-closed guarantees are untouched. When the alert row already carries the fail-closed sentence, the footer no longer repeats it.Width
Cells everywhere this card touched:
status_footer*,alert_line,short_send_reason,main_header_line*,draw_text_overlay,roster_row_text,fit_cells.chars().count()is never used for a width and no crate was added (measurement is ratatui's ownSpan::width). The roster spends its budget name first, then thestaleword, then a fingerprint prefix — at 22 cells a row readsbob-the-sta… staleinstead of… bbbbbbbb… stale(that mid-token clip was a finding indocs/TUI.md).Verification
cargo test --locked— 366 passed, 0 failed, 4 ignored (this branch; 356 before, +10 new TUI tests)cargo clippy --locked --all-targets -- -D warnings— cleanmain_chrome_fits_80x24_120x40_and_200x60), and the dump helper asserts it per row as it prints.tests/tui_frames.rs(12),tests/tui_chrome.rs(+4: phase projection, phase footer, compact footer, per-pane hints). Existing assertions were not rewritten; one was fixed (below).One pre-existing failure fixed
tests/tui_spec.rs::wallets_settings_menu_truncates_wide_values_in_cellswas failing on main in this environment (3/3 runs, verified with my changes stashed) becauseONIONWIRE_ASCII/NO_COLORare process-wide and a parallel test sets them, sofit_cells("abcdefghij", 8)returned"abcde..."and the assertion demanded"abcdef…". Two neighbouring assertions in the same test already accept either ellipsis form; the third now does too, and asserts more than before (that truncation happened and that an ellipsis is present) instead of less.Scope
Presentation only:
src/tui.rs,tests/tui_chrome.rs,tests/tui_spec.rs,tests/tui_frames.rs,docs/TUI.md. No wire/session/store/send-path file touched; no new crate; no repo-widecargo fmt. The only backend symbol read is the existing read-onlyNode::tor_state().Not closed (no data in the render path): a roster unread count — there is no unread counter reachable from
App. Marker + word is already there for outbox andstale; adding unread needs a backend field, so it is named here rather than invented.CI note: the four checks (ci/test, ci/sdk, ci/fuzz, android-ci/android) were still
Waiting to run~20 min after the push — the shared Pi runner was busy with the #119 fuzz job. Local verification for headeefa7e5:cargo test --locked366 passed / 0 failed / 4 ignored,cargo clippy --locked --all-targets -- -D warningsclean. Not claiming CI green until the runner reports.paymentsrow (key p) #121paymentsrow (key p) #121paymentsrow (key p) #121