Skip to content

Redesign the Reports tab (ALI-2618), re-landed on main - #18

Merged
michaelaguiar merged 1 commit into
mainfrom
ali-2618-reland
Dec 4, 2026
Merged

michaelaguiar merged 1 commit into
mainfrom
ali-2618-reland

Conversation

@michaelaguiar

Copy link
Copy Markdown
Member

Re-lands #17 (ALI-2618, the Reports redesign) on main.

#17 was stacked on #16's branch and merged into that branch, not main, because it was merged before GitHub retargeted it. Its squash commit (ae66de2) now sits on ali-2617-tui-clients, and main doesn't have it.

This PR is that same commit, cherry-picked onto main. Main's tree matches #16's final tree (f3a3af1), so the result is byte-for-byte the tree #17 was reviewed and tested at: eb85847 is #17's head tree (9a4864a). No code changed.

Checks on this branch:

  • go vet ./... passes.
  • go test ./... passes.
  • go run ./design/build -check passes.

Review record: #17

Fixes ALI-2618

…I-2618) (#17)

* Redesign the Reports tab: stat cards, hours by day and CSV export (ALI-2618)

The Reports tab now draws from internal/report, the code behind
`notch report`, so for the same range its numbers match
`notch report -json` (a test compares the two as JSON for every preset).
It no longer uses db.ReportByProject, so it reads start dates in local
time like the CLI.

The screen follows the canvas's Reports board:

- Range chips (t Today, w Week, m Month, y Year, a All, f Custom…) with
  the dates beside them. f opens a Custom range modal (From, To, Apply,
  Cancel) with field errors; a blank date leaves that side open.
- Four stat cards: hours and entries, earned and the average rate,
  outstanding (invoiced, not paid) and unbilled.
- BY DAY: block-character bars in eighth blocks, each with its day and
  hours written under it; today's bar is in success and its day bold.
  This week runs on to Sunday. Ranges with more days than fit show a bar
  per week, month or year.
- BY CLIENT AND PROJECT: clients with their projects nested under them,
  with hours, invoiced and paid counts and earned, and a total.

At 120 columns and up the bars sit beside the table; narrower terminals
stack them with shorter bars and compact cards, and drop the bars before
the table gets fewer than three rows.

e exports the range's entries with report.WriteCSV to the XDG download
folder (else ~/Downloads, else home), named for the range, adding
" (2)", " (3)"… rather than overwriting. The status line shows the path.
enter opens the entries behind a client or project row, where e edits an
entry as before.

New layout tokens: tui-card-gap, tui-bar-width, tui-bar-gap,
tui-bar-rows, tui-bar-rows-compact, tui-report-col-hours,
tui-report-col-count, tui-report-col-earned, tui-report-trail and
tui-report-indent. The keys sheet and README cover the new keys.

* Reports review fixes (ALI-2618)

- Presets follow the clock: each reload works out today, this week,
  this month or this year again, so a tab left open past midnight or
  into a new month shows (and exports) the current range. Custom ranges
  stay put.
- The table cursor and the entries list follow their row by client and
  project ID, and the entries cursor its entry by ID, across reloads.
  When the list's row leaves the report, the list closes and the status
  line says so; an open edit form closes to the report.
- A database change from another process (dbWatch, and the fallback
  tick) reloads the Reports tab as well as Timers.
- CSV exports are created 0600, and a download folder that can't be
  written to falls through to the next (~/Downloads, then home).
  user-dirs.dirs values in single quotes, unquoted, after export, or
  followed by a comment now parse.
- An entry gone before its edit form opens says so on the status line;
  the old message was never shown.
- Amounts are never cut: cards, the table and the entries list drop the
  cents, then go compact ($123k, $1.2M), with the same fitMoney and
  fitRate as the Clients tab in ALI-2617 (in money.go, to merge into one
  copy). Hours too wide show as whole hours.
- Layout counts come from what's drawn (card lines, the table's fixed
  lines, entry columns from their widest values and the cell padding),
  and two new tokens: tui-card-pad and tui-report-min-rows.

* Rename the Reports entries header's amountOrDash after the merge (ALI-2618)

The Clients tab (ALI-2617) has its own moneyOrDash(x, rate, w), so the
Reports one, which shows an amount in full or a dash, is amountOrDash.

* Drop the removed fourth tab from the tab-switch test

Tab 4 no longer exists after the Clients fold, so pressing 4 did nothing
and that iteration tested nothing.
@michaelaguiar
michaelaguiar merged commit 8d451de into main Dec 4, 2026
1 check passed
@michaelaguiar
michaelaguiar deleted the ali-2618-reland branch December 4, 2026 18:05
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