Conversation
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YDHvoY5YQsE8iV24NuUqcL
Collaborator
Author
|
Superseded by |
Contributor
|
Preview deployment: https://featxcenter-dynamic-stations.preview.avy-fx.org |
Collaborator
Author
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.
Description
Makes the weather station pages center-dynamic without changing what NWAC renders. Every place that assumed NWAC now takes the center: the SnowObs service, the station registry, the route gates, static params, and the client pickers. A center gets station pages by having an entry in the registry; today that's only NWAC.
The
/weather/stationsindex route is deleted. It was a hardcoded list of links, and it becomes an ordinary Payload page that an editor owns, placed under the Weather dropdown so it resolves at the same URL through the nav. The station detail, accumulated precipitation, and map routes stay native.The SnowObs
sourceis the center's own slug, per the decision on #1169. Centers whose stations live under other sources (Mesowest, SNOTEL) are #1304.Related Issues
Closes #1169. Follow-ups split out so it could: #1303 (display timezone from the center, after #1295) and #1304 (a second center's station groups, with the source-per-station finding).
Key Changes
constants/weatherStations.ts:STATION_REGISTRIESkeyed by center, with NWAC's regions and groups undernwac. ExportsgetStationRegistry(center),getStationGroup(center, slug),precipStationStids(registry),CENTERS_WITH_STATIONS.STATIONS_TENANT_SLUGand theNWAC_*exports are gone.services/snowobs/snowobs.ts:fetchStationTimeseries(centerSlug, stids, options); source is the slug, token still from the center's AFP config.[station]/page.tsx,csv/route.ts,graph-data/route.ts,accumulated-precipitation/page.tsxgate on the registry (404 without one) and pass the center through. The station page's static params iterateCENTERS_WITH_STATIONS; the graph-data caps derive from the requesting center's registry.useStationRegistry()gives client components (StationPicker,EditViewDialog,StationGraphs) the registry fromuseTenant().stationspage under Weather instead of the "Weather Data" built-in row.StationGraphsmocks the tenant; the service test passes the center.How to test
Against a reseeded database (
pnpm seed:standalone):nwac.localhost:3000/weather/stations: the Payload "Weather Data" page, reached from the Weather dropdown./weather/stations/hurricane-ridge(table, graphs, download) and/weather/stations/accumulated-precipitationrender as on main; the graphs compare picker lists the other 30 live stations by region.sac.localhost:3000/weather/stations/hurricane-ridge,.../accumulated-precipitation,/weather/graph-data?...and/weather/stationsall 404;/weather/stations/mapstill renders.Prod: create the
stationspage under Weather in the NWAC admin and swap the nav link from the "Weather Data" built-in row; order relative to the deploy doesn't matter, the page has no traffic yet.pnpm tsc,pnpm lint,pnpm fallow:auditandpnpm test(795) pass. Committed with--no-verifysincedriftisn't installed locally; CI runs it.Screenshots / Demo video
None: NWAC is unchanged by design.
Migration Explanation
No migrations. The built-in "Weather Data" row for NWAC is no longer seeded; in prod it's deleted by hand once the nav points at the page.
Future enhancements / Questions
#1303 and #1304.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YDHvoY5YQsE8iV24NuUqcL
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.