fix(map): hide the 'You are here' pin on desktop

Location is a mobile-only affordance now (the desktop Near Me button was removed),
so stop seeding the cached location on desktop and don't pass userLocation to the
map on desktop. Result: no 'You are here' badge and no proximity sort on desktop;
mobile is unchanged.

Gate: 101 tests, 0 errors/warnings, boot smoke green.
This commit is contained in:
SkateSpots 2026-09-26 23:49:34 +07:00
parent 9e8f8b87de
commit e1deec21bd

View file

@ -12,6 +12,7 @@ import { filterByTrustLevel, type TrustFilterLevel } from '@/lib/trustFilter';
import { SortDropdown, type SortOption } from '@/components/SortDropdown';
import { calculateDistance } from '@/lib/sortOptions';
import { useZapTotals, zapTargetKey } from '@/hooks/useZapTotals';
import { useIsMobile } from '@/hooks/useIsMobile';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
@ -603,7 +604,11 @@ export default function MapPage() {
const [sortBy, setSortBy] = useState<SortOption>('recent');
// Seed from the cached last-known location so the "you are here" badge and
// proximity sorting are available instantly; a fresh fix updates it.
// Mobile-only: Near Me is a mobile affordance, so desktop shows no location
// pin (or proximity sort).
const isMobile = useIsMobile();
const [userLocation, setUserLocation] = useState<{lat: number; lon: number} | null>(() => {
if (!isMobile) return null;
const cached = getLastLocation();
return cached ? { lat: cached.lat, lon: cached.lng } : null;
});
@ -1635,7 +1640,7 @@ export default function MapPage() {
showCrews={showCrews}
showBtcMap={showBtcMap}
flyTo={flyTo}
userLocation={userLocation ? { lat: userLocation.lat, lng: userLocation.lon } : null}
userLocation={isMobile && userLocation ? { lat: userLocation.lat, lng: userLocation.lon } : null}
/>
</Suspense>
{/* Loading indicator — a slim, honest top bar. The map stays