diff --git a/src/components/map/near-me-button.tsx b/src/components/map/near-me-button.tsx
index 28b9c17..f9aae7a 100644
--- a/src/components/map/near-me-button.tsx
+++ b/src/components/map/near-me-button.tsx
@@ -27,9 +27,15 @@ export function NearMeButton({ onLocated, className }: NearMeButtonProps) {
setBusy(false);
onLocated({ lat: pos.coords.latitude, lng: pos.coords.longitude });
},
- () => {
+ (err) => {
setBusy(false);
- setError("Could not read your location.");
+ setError(
+ err.code === err.PERMISSION_DENIED
+ ? "Allow location access in your browser settings."
+ : err.code === err.TIMEOUT
+ ? "Location request timed out. Try again."
+ : "Your location could not be determined. Try again.",
+ );
},
{ enableHighAccuracy: true, timeout: 10000 },
);
@@ -47,7 +53,11 @@ export function NearMeButton({ onLocated, className }: NearMeButtonProps) {
{error}
} + {error && ( ++ {error} +
+ )} ); } diff --git a/src/components/map/near-me-fab.tsx b/src/components/map/near-me-fab.tsx index d3ebe0b..3dc9969 100644 --- a/src/components/map/near-me-fab.tsx +++ b/src/components/map/near-me-fab.tsx @@ -15,42 +15,60 @@ interface NearMeFabProps { /** Round floating "near me" button for the mobile map, sized for thumb reach. */ export function NearMeFab({ onLocated, className }: NearMeFabProps) { const [busy, setBusy] = React.useState(false); + const [error, setError] = React.useState