Add IP Geolocation for first time users #54
Merged
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.
This PR adds IP Geolocation, so that first time users will always "spawn" in their own region, without having to pan away from LA/Irvine area.
This uses Cloudflare's IP Geolocation API to get the user's ROUGH location via a worker.
It will not be accurate, but it will be enough to get the user to their own region.
Adding a pin with this provided lat/long would prob freak a few people out and even mapping sites (google, bing, etc) don't do it either on default.
This feature will not function if there is already a cached geolocation, and if there is not, it will create one and store it BEFORE the user allows the browser side geolocation provider to do so.
One thing that I would like someone to do, as I'm not familiar too much with the codebase, is figure out how to not have the browser location prompt happen during onMount. It should only be called/requested when the user presses the "find me"/locate button.