Open bills in the drawer instead of expanding the row

Merged
GA
2mo ago
+377-167

A proposal for part 1 of #3662. A row on the Bills overview now opens the bill in the right-hand drawer, the way transactions and Plan › Budgets categories open, instead of expanding a panel under the row.

This changes a pattern rather than fixing a bug. #3202 chose the inline expansion on purpose ("the row expansion belongs to a row"), so it needs a maintainer decision. The code is here so that decision can be made against the working version.

What changes

  • Overview rows and Next up items open the bill's summary in the shared drawer frame, as a DS::Dialog drawer. It is the partial the expansion rendered. The chart, history and settings stay on the bill's page, one click away through View full bill.
  • The inline plumbing goes: the per-row frames, the frame and close params, and pane_close. display=pane becomes display=drawer. Opened outside a frame (cmd-click, a pasted link), the same URL renders the bill's page instead of a bare dialog.
  • Pause (toggle_status) now returns to the page it was pressed on. Before, it always landed on Settings › Recurring. Pause and Delete in the bill drawer, and Pause in the payment drawer, submit to _top, because a redirect answered into the drawer frame leaves "Content missing" there.
  • The bill drawer and the payment drawer are data-turbo-temporary. Both link to the bill's page, and without it Back from there brings the drawer back as a stray non-modal dialog. The payment drawer is only temporary when it opens in the drawer frame. On a direct visit the dialog is the page, so Back still restores it.
  • DS::Dialog: when a dialog replaces an open one in the same frame, it takes over the focus target to return to. This happens when Find payment swaps the bill drawer for the payment drawer. Closing it now puts focus back on the row instead of <body>.
  • Recent payments sit on the inset surface, like the payment drawer's list. On the drawer's container fill, the old card vanished.
  • bills.pane.close is removed from the 7 locales that had it.

Actions inside the drawer:

  • Find payment, Review match, Add payment and Manage payments swap it for the payment drawer.
  • Add link, Edit and Smart configuration open the modal over it.
  • Pause and Delete reload the list with the drawer closed.

View full bill sits at the end of the drawer's action row, not in a pinned footer, because the actions slot on DS::Dialog only takes DS::Buttons.

Screenshots

BeforeAfter
DesktopBefore: the bill expanded under its rowAfter: the bill in the right-hand drawer
375pxBefore on a phoneAfter on a phone

Dark:

After, dark theme

Validation

  • bin/rails test: 10335 runs, 0 failures, 0 errors.
  • DISABLE_PARALLELIZATION=true bin/rails test:system: 181 runs with 1 failure, property_test "can persist property subtype". That is the known morph-refresh flake, and it passed 3/3 on rerun. After the payment drawer fix, the five bills system test files were rerun: 14 runs, 0 failures.
  • New test/system/bill_drawer_test.rb:
    • At 375px, closing the drawer puts focus back on the row, and the row hasn't moved.
    • Closing the payment drawer opened through Find payment returns focus to the row. This fails 3/3 without the DS::Dialog change.
    • Back from the bill's page shows no leftover dialog. This fails without data-turbo-temporary.
    • The same holds when the bill's page was reached through the payment drawer's View full bill. This fails without the payment drawer change.
  • recurring_occurrences_controller_test: the payment drawer is temporary in the drawer frame and not on a direct visit. This fails if the flag is missing, and also if it is set on both.
  • RuboCop, erb_lint, npm run lint and Brakeman are clean. Biome doesn't cover app/components/, so the dialog controller was checked through stdin.

The first commit is a separate fix to declare_and_pay_bill_test. It typed the due date into a native date field, and on a day-first browser locale that declared the bill on the wrong day. The test errored on main locally. It now sets the date as a Date.

Overlaps

  • #3877 (mine) changes the same Next up link in _month_pulse. Whichever lands second resolves it.
  • #3751 re-indents the trial-chip test that this PR points at the drawer. Keep its travel_to and use get_bill_drawer. Its current version still requests display: "pane", which now renders the full page.
  • #3666 (the breadcrumb, part 2 of #3662) is untouched.

Not done here: the transaction, budget category and transfer drawers also have links that leave the page, so they probably have the same Back problem. This is from reading the code; I haven't reproduced it. One fix in DS::Dialog would cover them all, and that belongs in its own PR.

Refs #3662

Summary by CodeRabbit

  • New Features
    • Bill details now open in a drawer from the bill list and “Next up,” showing the selected occurrence and relevant details. Full bill pages remain available for more information.
  • Improvements
    • Closing a bill or payment drawer restores focus to the originating bill row.
    • Pausing or resuming a recurring transaction returns you to the referring page when possible.
    • Status changes from a recurring occurrence drawer update the full page.
    • Horizontal scrolling is better contained when a payment drawer is open on mobile.