Repository navigation
Redesign the Reports tab (ALI-2618), re-landed on main - #18
Merged
Merged
Conversation
…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.
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.
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 -checkpasses.Review record: #17
Fixes ALI-2618