Skip to content

feat: color a field's Left green when it equals Max (field is full) #34

Description

@obeidahmad

Problem / motivation

When a field's Left has reached its Max (cap), nothing in the UI signals that the field is full. The Left column is rendered with signed, which only colors negatives red and leaves everything else default:

  • monay/tui/format.py:19 (signed) — style=theme.ERROR if m.is_negative else ""
  • monay/tui/widgets/section_detail.py:49signed(f.left) in the field table

So a field sitting exactly at its ceiling looks identical to a half-full one. A green "full" cue would make it easy to scan which fields are topped up.

Proposed solution

In the section drill-in field table, color the Left cell green when it equals the field's Max — i.e. when the cap is finite and f.left == f.cap.limit (Cap.limit, monay/domain/values.py). f.left is already clamped to the cap at compute time (Field.left = cap.clamp(raw), monay/domain/month.py), so equality cleanly means "at max / full".

Implementation: a small Left-cell helper (or extend the Left rendering in section_detail.build) with the precedence:

  1. negative → red (theme.ERROR, unchanged)
  2. finite cap and left == cap.limit → green (theme.OK)
  3. otherwise → default

Infinite-cap fields have no Max, so they never go green.

Alternatives considered

  • Bake the rule into the shared signed helper — rejected: signed is reused for CURRENT/REST/leftovers (monay/tui/format.py:19) which have no cap; the green-at-max rule is field-specific and needs the cap, so it belongs at the Left cell, not in signed.
  • A separate "full" chip/column — rejected: an extra column adds width; recoloring the existing Left cell conveys it with no layout cost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurefeat: a new capability

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions