Skip to content

Redesign the TUI's chrome and Timers screen (ALI-2615) - #14

Merged
michaelaguiar merged 6 commits into
mainfrom
ali-2615-tui-timers
Dec 4, 2026
Merged

michaelaguiar merged 6 commits into
mainfrom
ali-2615-tui-timers

Conversation

@michaelaguiar

@michaelaguiar michaelaguiar commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

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)

  • Tab bar: ◷ notch wordmark in highlight, numbered tabs (1 Timers …), and a primary ━ underline under the active tab in the rule below.
  • The running pill (● 1:23:46 on success) and its task sit at the right of the tab bar, or ● idle when nothing runs. The old footer is gone.
  • On a narrow bar the pill keeps its place: the task name goes first, then the inactive tabs' names, then the wordmark's name.
  • Bottom: a rule, then one line of keys (k caps and labels, ending in q 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 quit first.
  • Below 64×22 (tui-min-width, tui-min-height) the screen shows a centred "Terminal too small" note instead of a layout that wraps.
  • Chrome is 4 rows (tui-chrome-rows), and content has a 2-column margin (tui-margin).

Timers screen (new internal/ui/views/timers_view.go)

  • Hero: NOW TRACKING, task, client › project, a meta line (start time, rate and earned so far), block-digit elapsed time, and Today, This week and Unbilled. Today and This week include the running timer's time so far; Unbilled counts finished entries. There is an idle state when nothing runs.
  • Range chips: Today, Week, Month, All, Custom…, each with its key just before it in subtle (t w m a f; y still gives yesterday). The keys reset the list to its top.
  • The list is grouped by local day. Each day header shows its subtotal (time · money, or — with no rate) in two right-aligned columns, and the footer shows the entry count and total. Money uses status.HourlyRate and is rounded with status.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.
  • A reload keeps the selection on the same entry, and after r or space starts 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).
  • Status glyphs: ▶ running, ○ unbilled, ◐ invoiced, ● paid.
  • The selected row is on bg_alt with a primary ▌.
  • From 120 columns up, the detail pane (╭─ 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.
  • The wide layout also needs 23 rows, so the pane fits its borders, task and keys; a wide terminal shorter than that gets the compact layout.
  • Under 120 columns, the compact layout has a 2-row hero, Client › Project folded into the summary line at the bottom, and enter opening the details over the list, fitted to the body the same way (esc, an edit, a delete or a tab switch closes them).
  • New keys: m (this month), r (resume the selected entry's task), and enter (details, compact layout only).

Tokens

  • New: tui-margin 2, tui-wide 120, tui-detail-width 42, 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-width 64 and tui-min-height 22.
  • The contrast notes now say which colour draws what in the redesign (invoiced is accent in the Timers list; warning stays for Reports and the hero's unbilled total).
  • Text is cut by display width, so CJK and emoji stay inside their columns.
  • tui-chrome-rows 9 → 4.
  • The glyph usage notes now say where each glyph is drawn.
  • design/build emits the new constants.

Contrast (WCAG formula, built-in palette)

Text Background Ratio Used for
text #C2D9E9 bg #0D171F 12.42:1 task names, totals, hero task, detail values
text #C2D9E9 bg_alt #252E35 9.47:1 selected row, active tab, key caps
dim #B7D2E5 bg #0D171F 11.53:1 client › project, earned, inactive chips
dim #B7D2E5 bg_alt #252E35 8.79:1 inactive tabs; place and earned on the selected row
subtle #899EAC bg #0D171F 6.51:1 column titles, subtotals, ○ unbilled, hints, key labels
subtle #899EAC bg_alt #252E35 4.96:1 tab numbers, idle dot; ○ unbilled on the selected row
primary #91B0DE bg #0D171F 8.17:1 day headers
primary #91B0DE bg_alt #252E35 6.23:1 ▌ on the selected row
success #99C2ED bg #0D171F 9.74:1 NOW TRACKING, digits, ▶ running, ● paid, ✓ status
success #99C2ED bg_alt #252E35 7.43:1 ▶ / ● on the selected row
accent #9DC6E9 bg #0D171F 10.08:1 ◐ invoiced
accent #9DC6E9 bg_alt #252E35 7.69:1 ◐ on the selected row
warning #A4CBF7 bg #0D171F 10.75:1 unbilled total in the hero
highlight #AFCFFF bg_alt #252E35 8.67:1 wordmark
danger #C79EA9 bg #0D171F 7.67:1 ✕ error
bg #0D171F success #99C2ED 9.74:1 running pill
bg #0D171F primary #91B0DE 8.17:1 active range chip
border #5F6468 bg #0D171F 3.03:1 rules and box borders (3:1 non-text)

Every pair is in the token file's contrast list, so go run ./design/build -check covers 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

  • Four tabs, not three. Projects stays reachable until ALI-2617 folds it into Clients.
  • No / search chip or key. Search on the Timers screen isn't in this ticket's scope.
  • No ? all keys. The key sheet comes with ALI-2616, and the compact bottom line shows four keys until then.
  • Range chips show their keys. The board's chips have no keys; the subtle key before each one keeps t w m a f discoverable.
  • Day subtotals are column-aligned. The board's float against the right edge; here the · lines up on every day.
  • q quit on the key line. Not on the board; it's the first key dropped when space runs out.
  • No notes marker in the list. The board has none, so the old • is gone; notes show in the detail pane.
  • The board's sample doesn't add up. Its Today (4:13:46) doesn't match its rows (4:38:46), and its footer says 8 entries for 7 rows. The renders compute these from the data.
  • The idle hero isn't on the boards. It shows NOT TRACKING with a hint (n starts a timer, r resumes the selected entry).

How to try it

Run it against a copy of your database, not the live one:

cp ~/.local/share/notch/notch.db /tmp/notch-try.db
NOTCH_DB=/tmp/notch-try.db go run .

Try a terminal at least 120 columns wide, then one narrower than that. In the narrow one, enter opens the details.

NOTCH_RENDER_DIR=/some/dir go test -run TestRenderSample ./internal/ui writes text renders at 140×40 and 90×32 with the boards' sample data.

Checks

go vet ./..., go test ./..., go run ./design/build -check and gofmt -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.

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.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 1

A fresh reviewer ran code-review (high) on fe92496 and found no P1. It confirmed:

  • both renders fill the terminal exactly;
  • day grouping, subtotals and Unbilled add up;
  • scrolling keeps the cursor visible past day headers;
  • every colour pair drawn is in tokens.json's checked list.

Fixed in 5087201 and c28a0ff. Each behaviour fix has a regression test that fails without the fix.

  • P2, wide characters. truncate and truncateStr counted runes, so CJK or emoji text overflowed columns and clipped the timer pill. Text is now cut by display width everywhere, including the delete prompt.
  • P2, the compact details box didn't fit short terminals. At 80×24 it lost its border and keys. It now drops lower-priority rows first, keeping the border, task and keys.
  • P2, the range keys and r weren't on screen. Each chip now shows its key (t Today w Week …). r resume is in the wide pane and the compact box.
  • P2, the detail pane overflowed short terminals. It's now hidden when it can't fit.
  • P3, range keys didn't reset the scroll offset. Fixed.
  • P3, the tab bar clipped the timer pill under about 78 columns. The pill now comes first, and the task name, tab names and wordmark give way.
  • P3, fixed sizes were Go literals. They're now tokens in design/tokens.json.
  • P3, tiny terminals wrapped into a mess. Below 64×22 the screen says it's too small. That size is measured from the views' own fixed widths and heights.
  • P3, the details box stayed open after an edit, a delete or a tab switch. It now closes.
  • P3, dead code and stale comments. filteredTotals, friendlyDay and old references to renderHotkeyBar are gone.
  • P3, the selection jumped after a reload. It now stays on the same entry by ID. After r or space starts a timer, the new one is selected.
  • P3, contrast notes said invoiced uses warning. It uses accent; the notes are corrected.
  • P3, q quit was dropped from the key line. It's back, and is the first key dropped when space is short.
  • Found while checking the renders:
    • The hero's Today total, the Today subtotal and the pill disagreed by a second. They now share one clock reading, cut to the second.
    • Day subtotals didn't line up when a day had no rate. They're now in aligned columns.

Declined

  • The notes marker in list rows. The board has none, and notes show in the detail pane and box.
  • Six keys instead of "five plus ? all keys". The ? sheet is ALI-2616.

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.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 2

A fresh reviewer ran code-review (high) on c28a0ff and found no P1. It confirmed these round 1 fixes hold:

  • cutting text by display width;
  • wrapping text that holds wide characters;
  • the timer pill keeping priority in the tab bar;
  • the minimum-size message fitting at 64×22;
  • one shared clock;
  • setRange resetting the scroll;
  • q quit being dropped first.

Fixed in 61a8efe and 4f53cef. Each behaviour fix has a test that fails without it.

  • P2, the 22-row minimum only covered the compact layout. At 120 columns or more and 22 rows, the Entry pane lacked a row and vanished. A wide terminal now uses the wide layout only when the pane fits, from 23 rows. Below that it uses the compact layout, where the details open over the list, so 22 rows stay usable.
  • P2, the "select the new timer" flag lived in model state. A failed start left it set, so a later unrelated reload jumped the cursor. A reload between StopAllRunning and StartEntry used it up before the new entry existed. startCmd now returns a timerStartedMsg carrying the new entry's ID, and only that selects it. Both races are tested against a real database.
  • P3, status and error messages were cut to half the line. A message now takes priority over the key chips: "✕ Mark as invoiced first (press i)" fits whole at 64 columns.
  • P3, the wide range chips had no Yesterday. Fixed.
  • P3, the details box reappeared after n then esc, and after widening and narrowing the terminal. Both now close it.
  • P3, tabsStart was used only by tests, and a comment named removed functions. Both are fixed.
  • P3, the landing page said the elapsed time is in the bottom bar. It now says the tab bar.
  • P3, some gaps were still literals. They're now tokens: tui-pane-gap, tui-col-trail, tui-wordmark-gap, tui-tab-gap and tui-key-gap.

Noted: TestWatch_DoesNotFireOnReads failed once in the skill's run. It then passed 120 of 120 runs, and its code (internal/db) isn't in this PR. It may be flaky from file events arriving late after the test's own setup writes. That's worth a follow-up if it shows up in CI.

- 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.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 3 (final)

A fresh reviewer ran code-review (high) on 4f53cef and found no P1 or P2. It confirmed:

  • only timerStartedMsg selects a new entry, and an error selects nothing;
  • the wide layout's 23-row boundary is right (inner height ≥ 17 for the pane's 8 rows);
  • the 64×22 floor holds;
  • the new gap tokens equal the old literals;
  • the landing copy is right.

Fixed in 315e9f7. Each behaviour fix has a test that fails without it.

  • P3, the new-timer form didn't select its timer. It discarded StartEntry's result and sent a plain reload. It now sends timerStartedMsg with the new ID, like r and space.
  • P3, a range key kept the compact details open, so they reopened on the new range's first entry. setRange now closes them.
  • P3, the key line reserved the message gap with no message, dropping q quit when the keys fit exactly.
  • P3, README: enter opens details in the compact layout, which now includes wide terminals under 23 rows.

Older than this PR, left for later tickets

  • The edit form is clipped at 80×22, so a validation error under the buttons is hidden. The form becomes a modal with errors under each field in ALI-2616.
  • The TUI's own start still stops and starts in two steps. It moves to db.AddEntry in ALI-2616.
  • Other items from the skill's run are minor or older than this PR:
    • a GetRunningEntry error can flash the pill to idle for one tick;
    • the EARNED column cuts a value wider than 10 cells;
    • a day's subtotal sums exact seconds, so it can differ from its rows' shown times by a second;
    • a few layout minimums are still literals.

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 main. Nothing was lost.

@michaelaguiar
michaelaguiar marked this pull request as ready for review December 4, 2026 15:52
@michaelaguiar
michaelaguiar merged commit 5e9dc76 into main Dec 4, 2026
1 check passed
@michaelaguiar
michaelaguiar deleted the ali-2615-tui-timers branch December 4, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant