Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store pollutant and map coordinates and zoom in URL #122

Merged
merged 6 commits into from
Nov 20, 2024

Conversation

jdudley1123
Copy link
Member

@jdudley1123 jdudley1123 commented Nov 20, 2024

Context

Currently we store the day and the zone in the URL, allowing them to be persisted. However, we don't store the pollutant or map settings, so they can't be persisted or included in shared URLs.

Changes in this PR

This PR:

  • Combines the prediction and tab JS controllers into a forecast controller
  • Stores pollutant selection and map coordinates and zoom in the URL
  • Changes the URL from storing the day ('tomorrow') to the date '2024-11-21' to stop issues when sharing

We no longer have multiple pollution layers or a control to switch between them, so this code is unnecessary (and currently throws an error).
These two controllers have very similar functionality and are both very small, so it makes sense to combine them.

I've also cleaned up a few leftover attributes that we're no longer using.
The prediction controller doesn't just focus on predictions anymore, so it makes sense to generalise its name.
Storing the pollutant in the URL means we can persist it and include it in links that are shared. It behaves like the zone selector.
Storing the map coordinates and zoom in the URL means we can persist them and include them in links that are shared.
Currently we store the day ('today', 'tomorrow', etc.) in the URL. If the user shares the tomorrow URL on Monday and the recipient clicks on Tuesday, they will see the forecast for Wednesday.

This change means we store the date ('2024-11-20') instead. If the date is outside of the bounds of the three day forecast, we fall back to the nearest day (so today for past dates and day after tomorrow for future dates).

The former URLs with day will still work, but date takes precedence.
@jdudley1123 jdudley1123 merged commit 73eec60 into develop Nov 20, 2024
2 checks passed
@jdudley1123 jdudley1123 deleted the url-params-3 branch November 20, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant