jeancochrane / mellow-bike-map

🚲 Web app and routing API for finding safe, chill bike routes. Like Google Maps if it took you through cozy side streets.
https://mellowbikemap.com
MIT License
13 stars 5 forks source link

Update user location as they move around #40

Closed kalilsn closed 2 years ago

kalilsn commented 2 years ago

Rough draft for #35

This seems to work pretty well for me testing in Chrome (open devtools, cmd+shift+p -> "Show Sensors", set location to "Other" and change). I tested that it:

Before merging, I'd like to remove some of the duplication that this creates with the initAutocomplete method and make some of these constants more explicit (the zoom level, the "My position" text). This also introduces a bunch of unnecessary getElementById calls which I'll fix. I'd also like to refactor so we store the current location in JS rather than writing it to an <input> element, although that's a little more involved. Let me know if those sound like okay changes!

I'm also wondering if we need a more explicit way to set the source location to "My position" now that we're actually tracking it. AFAICT the only way to do that right now is by reloading the page (although a quirk of my implementation is that you can now type "My position" into the autocomplete bar and it will then follow you). Perhaps a button next to the input? I'd like to discuss what that interface should look like before I move forward!

kalilsn commented 2 years ago

Closing this PR and moving this work into a combined PR adding user locations and refactoring the frontend