Repository navigation
feat(fetcher): add weather_forecast + fix chart bg - #215
Conversation
Open-Meteo daily multi-day forecast fetcher for a fixed (latitude, longitude). Sibling of the existing `weather` (now) widget. Refactor: `src/fetcher/weather.rs` is split into `src/fetcher/weather/` with `common.rs` (Units / weather_description / weather_badge / http / parse_options), `now.rs` (existing logic, unchanged registered name and public behaviour), and `forecast.rs` (new). Mirrors the `github/` family layout. 9 shapes: `TextBlock` (default), `Text`, `Entries`, `Ratio`, `NumberSeries`, `PointSeries`, `Bars`, `Badge`, `Timeline`. `Image` / `Calendar` / `Heatmap` rejected (no natural mapping). `Bars` carries per-day precipitation **probability** (%) rather than rainfall amount so chart_bar stays informative in dry forecasts where `precipitation_sum` is all zero. `NumberSeries` keeps the rainfall amount in tenths-of-mm/inch for sparkline / histogram consumers. Textual shapes (`TextBlock` / `Entries` / `Timeline` detail) append precipitation amount when > 0 (`Tue 🌧 18°/13°C 💧80% 8.4mm`). Options: `latitude` / `longitude` (required), `units` (metric default), `days` (default 3, range 1..=7). Refs #41 (#68: weather_forecast). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ratatui 0.29's `Chart` widget seeds its internal `Canvas` with `self.style.bg.unwrap_or(Color::Reset)` (`chart.rs:1023`), and `Canvas::default()` itself defaults `background_color` to `Color::Reset` (`canvas.rs:639`). Either path paints the terminal default background across the entire plot area, overwriting the panel surface (`theme.bg` or `bg = "subtle"`) the layout already painted. Anchor both renderers to `theme.bg`: - `chart_line`: `Chart::new(...).style(Style::default().bg(theme.bg))` propagates the background into the inner Canvas. - `chart_scatter`: `Canvas::default().background_color(theme.bg)` sets the bg directly. Add `theme::BG` to each renderer's `COLOR_KEYS` so the catalog surfaces the theme dependency. Regression test in each renderer asserts the rendered cells carry `Theme::default().bg` rather than `Color::Reset`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #215 +/- ##
==========================================
- Coverage 96.10% 95.97% -0.13%
==========================================
Files 151 154 +3
Lines 44778 45421 +643
==========================================
+ Hits 43032 43593 +561
- Misses 1746 1828 +82
🚀 New features to boost your workflow:
|
Summary
weather_forecastfetcher — Open-Meteo daily multi-day forecast (default 3 days, range 1..=7) for a fixed(latitude, longitude). Sibling ofweather(now). 9 shapes covering everything from a one-liner headline to aTimelineof per-day events.weather.rssplit intosrc/fetcher/weather/{mod,common,now,forecast}.rsmirroring thegithub/family layout.weather's registered name / behaviour / tests are unchanged.chart_line/chart_scatter— ratatui'sChart/Canvaswere paintingColor::Resetacross the plot area, erasing the paneltheme.bg. Anchored both totheme.bg.Refs #41 — ticks the
weather_forecastbox on #68.weather_forecastreferencetext_block(default),text,entries,ratio,number_series,point_series,bars,badge,timelineOptions
latitude35.68for Tokyo).longitudeunits"metric"|"imperial""metric"days3Compatible renderers (per shape)
text_blocklist_plaintexttext_plain,text_asciientriesgrid_tableratiogauge_battery,gauge_circle,gauge_line,gauge_segment,gauge_thermometernumber_serieschart_histogram,chart_sparklinepoint_serieschart_line,chart_scatterbarschart_bar,chart_pie,list_rankingbadgestatus_badgetimelinelist_timelineTheme tokens
Barscarries per-day precipitation probability (%), not rainfall amount, sochart_barstays informative in dry forecasts.NumberSerieskeeps the rainfall amount in tenths-of-mm/inch for sparkline / histogram consumers. Textual shapes append precipitation amount only when > 0 (Tue 🌧 18°/13°C 💧80% 8.4mm).chart_line/chart_scatterbg fixratatui 0.29's
Chartwidget seeds its internalCanvaswithself.style.bg.unwrap_or(Color::Reset)(chart.rs:1023);Canvas::default()defaultsbackground_colortoColor::Reset(canvas.rs:639). Either path painted the terminal default across the plot area and erased the panel surface (theme.bgorbg = "subtle").chart_line:Chart::new(...).style(Style::default().bg(theme.bg))propagates the bg into the inner Canvas.chart_scatter:Canvas::default().background_color(theme.bg).theme::BGadded to each renderer'sCOLOR_KEYSso the docs / catalog surface the theme dependency. Regression tests assert rendered cells carryTheme::default().bg.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test --all-targets(2054 lib + 28 + 12 integration, all green; 12 live-network tests#[ignore]d)cargo run --bin splashboard -- catalog fetcher weather_forecastshows 9 shapes + 4 options + every compatible renderer.splashboard/dashboard.tomlsmoke-tested locally across 8 panels (TextBlock / Entries / PointSeries chart_line / Bars chart_bar / Ratio gauge_battery / Badge / Timeline / Text centered)chart_linepanel bg matches sibling panels under boththeme.bgandbg = "subtle"layouts in productionweather_forecastto[x]after merge