LF-5298: Show a 5-day weather forecast with frost-risk warnings on the Home page#4178
Draft
litefarm-pr-bot wants to merge 1 commit into
Conversation
Swap the legacy WeatherBoard for a new WeatherForecast widget driven by OpenWeather's /data/2.5/forecast endpoint. The widget shows a 5-day / 3-hour forecast with five day pills, a horizontal time strip of 3-hour slots, a shared rollover selection (one slot index drives a derived day pill highlight), and a red frost-risk banner whenever the day's minimum forecast temperature is below 2°C. Backend always requests metric units; the frontend converts on display using the farm's measurement setting. All local-day grouping, day pill labels and time chip labels use the farm timezone from city.timezone in the OpenWeather response rather than the browser timezone. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Home page weather widget has been a single-snapshot read of OpenWeather's current-conditions endpoint since the original implementation, and the design system has since moved on to a 5-day forecast model that includes frost-risk surfacing. The legacy code coupled the displayed measurement system (metric/imperial) into the OpenWeather request itself, which forced the frost threshold to be expressed twice (once for each unit) and prevented a single, authoritative metric trigger. The widget also derived all date labels from the browser timezone, so a farm in India viewed from a North-American browser saw days mislabelled.
This change replaces the legacy
WeatherBoardwith a newWeatherForecastwidget undercontainers/WeatherForecast/(smart, RTK-Query backed) andcomponents/WeatherForecast/(presentational, composed ofDayPillRow,FrostBanner,DayWeatherSummary,TimeStrip, and aPureWeatherForecastshell). The backend endpoint constant moves from/data/2.5/weatherto/data/2.5/forecast, the request hard-codesunits=metric, and the controller stops readingrow.units.measurement. The frontend converts to display units client-side via pure helpers incontainers/WeatherForecast/selectors.ts. TheWeatherDatashared type is replaced byWeatherForecast(withslots[]andcity.timezoneOffsetSeconds), and the RTK Query endpoint is renameduseGetWeatherQuery→useGetWeatherForecastQuery. Day grouping, day-pill labels and time-chip labels use the offset returned by OpenWeather (city.timezone), never the browser timezone.Pattern to carry forward: when a backend response shape changes in a way that affects an RTK Query hook's name or argument, the breaking edit and every consumer must ship together — the previous one-call API made it tempting to split the rewrite across PRs, but the type rename and Home wiring are inseparable in practice and would leave the legacy widget broken in an interim merge.
Jira: https://lite-farm.atlassian.net/browse/LF-5298
Testing checklist