Nearby services
What it does
Finds nearby pharmacies, hospitals, doctors, police, embassies, ATMs, petrol, restaurants, cafes, and lodging using Google Maps Places (New). Auto-expands the search radius 5km -> 10km -> 25km until at least 8 results are found.
Where to find it
Safety Hub -> "Nearby help" tab. Reusable <NearbyServices /> component can be embedded on any page.
How to use it
- Pick a category chip.
- Tap "Find ... near me" -> grants location once (battery-friendly).
- Results show distance, rating, open/closed, Call, Directions, Website.
Admin controls
Requires the Google Maps Platform connector. Without it, the server fn returns a friendly "not configured" notice and the UI shows a banner. Connect via Connectors -> Google Maps.
Edge cases
- No keys: shows configure banner, no crash.
- Location denied: falls back to last-known fix or a clear error toast.
- No results within 25km: shows "No places found nearby".
Related files
src/lib/nearby.functions.ts(server fn, gateway call)src/components/NearbyServices.tsxsrc/routes/safety.tsx(Nearby help tab)