From 36ed0e0d23f29b4829bad759f5d64ce0c123331f Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 7 Nov 2026 15:00:27 +0100 Subject: [PATCH] fix(mobile): the map frames the day beside the pane, atlas search as a centred panel With the plan beside the map, the map frames the day once the splash has gone, and again once its box has settled after the pane opens or hides, a rotation or a fold: a frame fitted to the old box left the day half outside the new one. On a wide window the atlas country search stands as a centred panel instead of a band across the screen. --- .../src/mobile/screens/atlas/MAtlasSearch.tsx | 2 +- client/src/mobile/screens/trip/MTripShell.tsx | 24 ++++++++++++++++++- .../unit/mobile/trip/MTripShell.wide.test.tsx | 14 ++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/client/src/mobile/screens/atlas/MAtlasSearch.tsx b/client/src/mobile/screens/atlas/MAtlasSearch.tsx index 5518f62fa..24e3e5c82 100644 --- a/client/src/mobile/screens/atlas/MAtlasSearch.tsx +++ b/client/src/mobile/screens/atlas/MAtlasSearch.tsx @@ -50,7 +50,7 @@ export default function MAtlasSearch({ const q = query.trim().toLowerCase() const rows = q ? options.filter((o) => o.label.toLowerCase().includes(q)).slice(0, 6) : suggestions - const scrimCls = 'm-fade-in fixed inset-0 z-[70] flex flex-col bg-[rgba(16,16,19,.28)] px-[18px] pt-[calc(var(--m-safe-top,12px)+12px)] backdrop-blur-[22px] backdrop-saturate-[1.6]' // theme-lint-disable — fixed scrim value from the design + const scrimCls = 'm-fade-in fixed inset-0 z-[70] flex flex-col bg-[rgba(16,16,19,.28)] px-[18px] pt-[calc(var(--m-safe-top,12px)+12px)] backdrop-blur-[22px] backdrop-saturate-[1.6] wide:pt-[calc(var(--m-safe-top,12px)+72px)] wide:[&>*]:mx-auto wide:[&>*]:w-full wide:[&>*]:max-w-[640px]' // theme-lint-disable — fixed scrim value from the design return (
{ + selectDayRef.current = planner.handleSelectDay + }) useEffect(() => { if (followDayId == null) return autoShowRoute() setExpandedDayIds(new Set([followDayId])) + // Framed as the map toggle frames it, without touching the plan's scroll. + selectDayRef.current(followDayId, false) }, [followDayId, autoShowRoute, setExpandedDayIds]) + // The map's box changes with the pane (opening, hiding, a rotation or a fold + // crossing the split size), and a frame fitted to the old box leaves the day + // half outside the new one. Once the box has settled, frame the day again. + const frameDayId = MAP_TABS.has(trTab) ? planner.selectedDayId : null + const boxKey = `${split}:${paneOpen}` + const lastBoxRef = useRef(boxKey) + useEffect(() => { + if (lastBoxRef.current === boxKey) return + lastBoxRef.current = boxKey + if (frameDayId == null) return + const timer = setTimeout(() => selectDayRef.current(frameDayId, false), 340) + return () => clearTimeout(timer) + }, [boxKey, frameDayId]) + const openSheet = (id: string, payload?: unknown) => setSheet({ id, payload }) const closeSheet = () => setSheet(null) diff --git a/client/tests/unit/mobile/trip/MTripShell.wide.test.tsx b/client/tests/unit/mobile/trip/MTripShell.wide.test.tsx index 0d27e48a8..0af092d9f 100644 --- a/client/tests/unit/mobile/trip/MTripShell.wide.test.tsx +++ b/client/tests/unit/mobile/trip/MTripShell.wide.test.tsx @@ -9,7 +9,7 @@ import { useDocSyncOfferStore } from '../../../../src/store/docSyncOfferStore'; import type { Day } from '../../../../src/types'; import { buildPlanner } from '../../../helpers/mobileTrip'; import { server } from '../../../helpers/msw/server'; -import { fireEvent, render, screen, within } from '../../../helpers/render'; +import { fireEvent, render, screen, waitFor, within } from '../../../helpers/render'; import { setSizeClass } from '../../../helpers/sizeClass'; import { seedStore } from '../../../helpers/store'; @@ -142,6 +142,18 @@ describe('MTripShell on a wide window', () => { expect(screen.getByTestId('plan-timeline')).toBeInTheDocument(); }); + it('FE-MOB-SHELLW-007: the map frames the day beside the pane, and again once its box has changed', async () => { + setSizeClass('split'); + renderShell(); + // On arrival, as the map toggle frames it: the day, without the list flag. + expect(mocks.planner.handleSelectDay).toHaveBeenCalledWith(12, false); + vi.mocked(mocks.planner.handleSelectDay).mockClear(); + + fireEvent.click(screen.getByRole('button', { name: 'mobileTrip.hidePane' })); + vi.mocked(mocks.planner.handleSelectDay).mockClear(); + await waitFor(() => expect(mocks.planner.handleSelectDay).toHaveBeenCalledWith(12, false), { timeout: 1500 }); + }); + it('FE-MOB-SHELLW-004: folding to compact mid-plan keeps the map and the day, and brings the dock back', () => { setSizeClass('split'); renderShell();