tibudiyanto / jakarta-vax-availability

jakarta-vax-availability.vercel.app
100 stars 46 forks source link

Sort by the nearest vax location (Fix #2) #6

Closed agallio closed 3 years ago

agallio commented 3 years ago

Add get current location. Still investigating on how to get the nearest vax location.

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tibudiyanto/jakarta-vax-availability/3jCeh6ya7qc1mqJk4be2oTb4TV3V
✅ Preview: https://jakarta-vax-availability-git-fork-agallio-ad-3dd129-tibudiyanto.vercel.app

kelilipan commented 3 years ago

Maybe we can calculate distance between 2 location? https://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula

If I'm not wrong, the API also return lat&long, maybe we can use this image

tibudiyanto commented 3 years ago

yep. imo, if we got user current location, just sort everything based of that haversine formula. Simplest i can think of is to map the schedule to generate the distance, then sort it.

pveyes commented 3 years ago

Minor feedback: if user already grant location before no need to press button again

You can use navigator.permission to check

agallio commented 3 years ago

@pveyes

Currently Safari is not supported. Is there any other way to get users permissions?

image

Or just change the behavior using useEffect hook? So users don't have to click the button every single time they want to sort by location?

pveyes commented 3 years ago

it's fine to ignore safari, safari user can keep clicking the button 😂

vercel[bot] commented 3 years ago

Someone is attempting to deploy a commit to a Personal Account owned by @tibudiyanto on Vercel.

@tibudiyanto first needs to authorize it.

agallio commented 3 years ago

Fix #2

@tibudiyanto 🚀 image

tibudiyanto commented 3 years ago

very coool

resir014 commented 3 years ago

Linked to #2. Also @agallio there are conflicts, please resolve.

agallio commented 3 years ago

Done @resir014. 🚀