Repository navigation
Redesign the TUI's chrome and Timers screen (ALI-2615) - #14
Conversation
The tab bar now carries the ◷ notch wordmark, numbered tabs with a primary underline, and the running pill on every tab. The bottom is a rule and one line of keys with the latest status at the right. The Timers list gains a hero (NOW TRACKING, block-digit elapsed time, today, this week and unbilled), range chips (t w m a f), day groups with subtotals, status glyphs, a detail pane at 120 columns and wider, and a compact layout below that with a summary line and enter for details. New keys: m (this month), r (resume), enter (details). Layout sizes come from design/tokens.json (tui-margin, tui-wide, tui-detail-width; tui-chrome-rows is now 4).
… notes (ALI-2615) The list's column widths, the detail pane's label column and note rows, and the hero's row counts were Go literals, outside design/tokens.json. They're tokens now (tui-col-*, tui-detail-label, tui-detail-note-rows, tui-hero-rows*), generated into internal/theme. New tui-min-width (64) and tui-min-height (22) give the smallest terminal the layout fits, measured from the views' real output. The contrast notes said warning draws invoiced status and primary the running timer. In the redesigned Timers list invoiced is accent, running is success, and day headers are primary; warning is left for Reports and the hero's unbilled total. The notes now say so.
- Text was cut by rune count, so CJK and emoji ran past their columns and could push the running pill off the tab bar. truncate and truncateStr now cut by display width, as does wrapWords. - The compact details overlay and the wide detail pane weren't fitted to the body: at 80x24 the overlay lost its bottom border and keys, and a short wide terminal could overflow. The box now drops spacing and lesser fields first, keeping its borders, the task and every key, and isn't drawn when even those don't fit. - The range keys and r had no place on screen. Each range chip now shows its key, and r resume stays in the pane and the overlay. - Range keys reset the cursor but not the scroll offset. - On a narrow tab bar the pill was clipped. The task name goes first, then the inactive tabs' names, then the wordmark's name. - Below 64x22 the layout wrapped over itself; it now shows a centred "Terminal too small" note. - The details stayed open after an edit, a delete or a tab switch. - A reload moved the cursor by index. It now follows the selected entry by ID, and after r or space starts a timer, selects the new one. - The hero, the rows, the day subtotals and the pill each read the clock separately and some rounded, so Today could show 4:38:46 above a 4:38:47 subtotal. They now share one now and whole seconds. - Day subtotals now line up in two right-aligned columns, "—" included. - q quit is back at the end of the key line, the first key dropped. - Removed the unused filteredTotals and friendlyDay, and comments that named removed functions.
Review round 1A fresh reviewer ran
Fixed in 5087201 and c28a0ff. Each behaviour fix has a regression test that fails without the fix.
Declined
|
r and space set selectRunning on the model, and whichever entry list arrived next used it up. A failed start left it set, so the next unrelated reload jumped the cursor to whatever was running; a watcher reload landing between StopAllRunning and StartEntry used it up before the new entry existed, so the start's own list didn't select it. startCmd now returns timerStartedMsg with the new entry's ID, and only that message selects it. Nothing is left in the model to go stale.
…ALI-2615) - At 120+ columns and 22 rows the wide layout left 7 rows for an 8-row detail pane, so the pane column went blank. The wide layout now also needs the rows for the pane (23 at the hero's height); shorter wide terminals get the compact layout, with details over the list. - Status and error messages were cut to half the line, even with keys to spare. The message now takes the room it needs and the keys fill the rest. - After y at 120+ columns no range chip was highlighted. The wide chips now show Yesterday while it's active, as the compact ones do. - The compact details survived n (new timer) and a widen-then-narrow. Both now close them. - The pane gap, the list's trailing column, and the tab bar and key line gaps were literals. They're tokens now (tui-pane-gap, tui-col-trail, tui-wordmark-gap, tui-tab-gap, tui-key-gap). - Removed the test-only tabsStart and a comment naming the removed footer, and the landing page no longer says the elapsed time is in the bottom status bar.
Review round 2A fresh reviewer ran
Fixed in 61a8efe and 4f53cef. Each behaviour fix has a test that fails without it.
Noted: |
- The new-timer form discarded StartEntry's result and sent a plain reload, so unlike r and space it left the cursor on the old entry. It now sends timerStartedMsg with the new entry's ID. - A range key kept the compact details open, so they reopened on the new range's first entry. setRange now closes them. - With no message, the key line still reserved the 3-column gap that separates keys from a message, dropping q quit when the keys fit exactly. - README: enter opens details in the compact layout, which now includes wide terminals under 23 rows.
Review round 3 (final)A fresh reviewer ran
Fixed in 315e9f7. Each behaviour fix has a test that fails without it.
Older than this PR, left for later tickets
The loop stops here after three rounds. Nothing at P1 or P2 is open. Process note: the round 3 skill run checked out this PR's head in the main checkout for about 4 minutes, then switched back to |
Closes ALI-2615. First of the TUI redesign tickets (ALI-2615 to 2618), built from the canvas boards RdTuiTimers and RdTuiNarrow.
What changed
Chrome (every tab)
◷ notchwordmark in highlight, numbered tabs (1 Timers…), and a primary━underline under the active tab in the rule below.● 1:23:46on success) and its task sit at the right of the tab bar, or● idlewhen nothing runs. The old footer is gone.kcaps and labels, ending inq quit) with the latest status at the right (✓ …in success,✕ …in danger). The message takes the room it needs first; keys that don't fit are dropped whole,q quitfirst.tui-min-width,tui-min-height) the screen shows a centred "Terminal too small" note instead of a layout that wraps.tui-chrome-rows), and content has a 2-column margin (tui-margin).Timers screen (new
internal/ui/views/timers_view.go)t w m a f;ystill gives yesterday). The keys reset the list to its top.—with no rate) in two right-aligned columns, and the footer shows the entry count and total. Money usesstatus.HourlyRateand is rounded withstatus.Cents. The hero, rows, subtotals and the tab bar pill all count the running timer in whole seconds from one clock reading, so they agree.rorspacestarts a timer the new entry is selected (by the ID the start returns, so a failed start or an early reload can't misplace it).▶ running,○ unbilled,◐ invoiced,● paid.▌.╭─ Entry) shows fields, wrapped notes and the keys that apply to the entry. On short terminals it drops spacing and lesser fields first, keeping its borders, the task and every key; with no room at all it isn't drawn.enteropening the details over the list, fitted to the body the same way (esc, an edit, a delete or a tab switch closes them).m(this month),r(resume the selected entry's task), andenter(details, compact layout only).Tokens
tui-margin2,tui-wide120,tui-detail-width42, the list columns (tui-col-duration,tui-col-gap,tui-col-status,tui-col-earned),tui-detail-label,tui-detail-note-rows,tui-hero-rows,tui-hero-rows-compact,tui-min-width64 andtui-min-height22.tui-chrome-rows9 → 4.design/buildemits the new constants.Contrast (WCAG formula, built-in palette)
Every pair is in the token file's contrast list, so
go run ./design/build -checkcovers it in CI. Every pair passes. The lowest text pair is subtle on bg_alt, at 4.96:1. Status is never shown by colour alone: each one has a glyph and a word.Differences from the boards
/ searchchip or key. Search on the Timers screen isn't in this ticket's scope.? all keys. The key sheet comes with ALI-2616, and the compact bottom line shows four keys until then.t w m a fdiscoverable.·lines up on every day.q quiton the key line. Not on the board; it's the first key dropped when space runs out.•is gone; notes show in the detail pane.nstarts a timer,rresumes the selected entry).How to try it
Run it against a copy of your database, not the live one:
Try a terminal at least 120 columns wide, then one narrower than that. In the narrow one,
enteropens the details.NOTCH_RENDER_DIR=/some/dir go test -run TestRenderSample ./internal/uiwrites text renders at 140×40 and 90×32 with the boards' sample data.Checks
go vet ./...,go test ./...,go run ./design/build -checkandgofmt -l .are clean. The new tests cover day grouping and subtotals, the wide and compact layouts, block digits, money formatting, the month preset, resume, detail keys, hero totals, and the pane on short terminals. Each new behaviour test fails when its code is removed.