Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(map): the base layer switch stays in its corner when a place opens

Maurice46aa0c6b0aea
diff --git a/client/src/components/Map/MapView.tsx b/client/src/components/Map/MapView.tsx
index 9fede926c..94159480e 100644
--- a/client/src/components/Map/MapView.tsx
+++ b/client/src/components/Map/MapView.tsx
@@ -1224,7 +1224,11 @@ export const MapView = memo(function MapView({
{/* 20px off the sidebar, not 12: the pill is round and frosted, so at the
smaller gap its shadow ran into the sidebar edge and the two read as one
surface. */}
- <div style={{ position: 'absolute', left: leftWidth + 20, top: hasInspector ? 80 : undefined, bottom: hasInspector ? undefined : switcherBottom, zIndex: 1000, pointerEvents: 'none' }}>
+ {/* Bottom left, whatever else is on screen. Opening a place used to send it to the
+ top of the map, which read as the control moving house rather than as room being
+ made: the inspector is a centred card at most 800 wide, so the corner it would
+ have been clearing is one the card never reaches. */}
+ <div style={{ position: 'absolute', left: leftWidth + 20, bottom: switcherBottom, zIndex: 1000, pointerEvents: 'none' }}>
<MapLayerSwitcher active={baseLayer} onToggle={toggleBaseLayer} />
</div>
</div>
diff --git a/client/src/components/Map/MapViewGL.tsx b/client/src/components/Map/MapViewGL.tsx
index afd0a097a..16ea7daea 100644
--- a/client/src/components/Map/MapViewGL.tsx
+++ b/client/src/components/Map/MapViewGL.tsx
@@ -2305,11 +2305,12 @@ export function MapViewGL({
{/* Same pill, same corner, same offsets as the Leaflet map: the switch should not
move when an instance changes renderer. The day panel is a centred card on the
desktop map and never reaches the pill, but on a phone it is full width and
- does, which is why the lift is only there. */}
+ does, which is why the lift is only there. An open place inspector is a centred
+ card too, and used to send the pill to the top of the map for a corner it never
+ covers. */}
<div style={{
position: 'absolute', left: leftWidth + 20, zIndex: 1000, pointerEvents: 'none',
- top: hasInspector ? 80 : undefined,
- bottom: hasInspector ? undefined : isMobile && hasDayDetail
+ bottom: isMobile && hasDayDetail
? 'calc(var(--bottom-nav-h, 0px) + 20px + var(--day-panel-h, 0px) + 12px)'
: 'calc(var(--bottom-nav-h, 0px) + 12px)',
}}>