Repository navigation
feat(web): savings-card historical vs flat-rate dashboard tile - #281
Conversation
Mounts above the controls row on the main dashboard. Self-contained
web component: own Week/Month toggle (same pill shape ftw-history-card
uses, single shared accent), own fetch loop against /api/savings/daily,
own paint cycle. No external JS wiring.
Headline is a mono tabular SEK total with sign + percentage, color
flipped per sign via a CSS custom property so re-paint on each poll
tick doesn't restyle the world. Sparkline is inline SVG — diverging
bars on a hairline zero baseline (green above, red below), the same
gestalt the plan view's "vs flat avg price" badge uses but extended
along the time axis.
Three terminal states:
- empty : /api/savings/daily returned [] (no price.zone)
- awaiting : every day comes back resolution=no_prices
(zone set, price provider hasn't filled yet)
- ready : at least one day has real prices → render normally
The "awaiting" state matters on a fresh dev system — the API otherwise
returns 7 zeroed days, and a flat sparkline at zero would look like a
silent failure rather than the legitimate "no data yet" it is.
Closes #280. Depends on #279 (server-side endpoint).
a51ad58 to
79faad3
Compare
💡 Codex Reviewhttps://github.com/frahlg/forty-two-watts/blob/a51ad58f05e0b59a7509489c2790674563ad0699/go/internal/state/cost.go#L139 Change the flat-rate average query to treat https://github.com/frahlg/forty-two-watts/blob/a51ad58f05e0b59a7509489c2790674563ad0699/go/internal/api/api_savings.go#L146 The cache is indexed only by ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Three terminal states
Test plan
Depends on
#279 (`/api/savings/daily` endpoint). This PR is stacked on `278-historical-savings-vs-flat` so the API exists during local testing; will need rebase onto master once #279 merges.
Closes #280.