Give each Income plan period one hero figure

Merged
GA
2mo ago
+47-15

Problem

The Income plan page read flat. In each pay period the date, the safe/short amount and the three breakdown figures (due, reserved, safe) all sat at roughly the same weight, so nothing told you where to look. The allocation bar was h-0.5 and barely registered.

What changes

All of it is in bills/_paycheck_period.html.erb, using tokens only. There are no new surfaces or CSS.

  • One hero figure per period. The safe/short amount goes from text-lg to text-2xl and keeps its tone. The period date stays text-lg.
  • The breakdown is the bar's legend. Each label gets a dot in its segment's colour (bg-inverse / bg-subdued / bg-success or bg-destructive). The due and reserved figures drop to text-sm text-secondary. The safe/short figure keeps its tone and weight.
  • Dots only for segments on the bar. A figure whose segment isn't on the bar gets no dot, because a dot with no matching segment would be a false key. In a short period the bar is "covered" plus "short", so only "short" gets a dot. The grey covered part stays unlabelled, as before this change, and the bar's aria-label still spells out the split.
  • The bar is taller. It goes from h-0.5 to h-1.5, so it reads as a chart.
  • Phone layout. At 375px the dot gutter made the labels truncate, so labels now wrap. Figures indent past the dot and sit at the foot of their column, so all three columns line up whether or not they have a dot.

_paycheck_income.html.erb is unchanged.

Screenshots

Before on the left, after on the right.

Desktop, light
Desktop light

Desktop, dark
Desktop dark

375px, light
Mobile light

375px, dark
Mobile dark

Validation

  • A new controller test checks that, for every period, the legend dots are exactly the bar's segment colours, in order. It failed before the view change and passes after.
  • bin/rails test: 10,330 runs, 0 failures, 0 errors.
  • Bills system tests: bills_mobile, find_my_bills and recurring_transaction_frequency are green. declare_and_pay_bill_test errors with RecordNotFound on a date-dependent occurrence. It errors the same way with the base view from main, so this change didn't cause it.
  • erb_lint, RuboCop, Biome and Brakeman (0 warnings) are all clean.

Summary by CodeRabbit

  • Improvements
    • Paycheck allocation bars are taller, and safe or short amounts are more prominent.
    • Allocation breakdowns retain consistent spacing when segments are absent, and labels wrap instead of truncating.
    • Segment colors now match their legend swatches.