Skip to content

Dashboard: savings card showing historical vs flat-rate #280

Closed

Description

@frahlg

Background

#279 ships the data path: `GET /api/savings/daily?days=N` returns per-local-day `saved_ore` plus totals. This issue is the UI on top.

Scope

A new `` web component, mounted on the main dashboard, that shows:

  • Headline total — saved SEK over the selected window (week / month), with the matching percentage vs flat-rate cost. Green when positive, red when negative. Mono numerics.
  • Range toggle — Week (7) / Month (30), same shape as `ftw-history-card`'s Week/Month switch.
  • Per-day sparkline — small bar chart of saved öre per day in the window. Bars are amber (`var(--accent-e)`) on positive days, dim on zero/negative days. Hover tooltip with the per-day breakdown.
  • Empty state — when `cfg.Price.Zone` is unset, the endpoint returns no days. The card renders a single muted line ("No price provider configured") and nothing else.

Design constraints

  • `DESIGN.md`: one amber accent only, mono for eyebrow labels and numerics, sans for prose, 1 px hairlines, no drop-shadows.
  • Tokens from `web/components/theme.css` — no hex literals.
  • Must work in light and dark mode automatically (token-driven).
  • No new web fonts — the Pi boots without WAN.

Files to touch

  • `web/components/ftw-savings-card.js` (new)
  • `web/components/index.js` — register the import
  • `web/index.html` — mount near the existing energy daily cards

Out of scope

  • `vs no battery` historical card (separate issue if/when state.DailyCostBreakdown grows that column)
  • Long-form analytics (a "savings over the year" page)

Depends on #279.

Activity

  1. added
    enhancement
    on May 18, 2026
  2. added a commit that references this issue on May 18, 2026
    79faad3
  3. added a commit that references this issue on May 18, 2026
    f695c5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions