From da92581a16d32dec646c96013b08bfd7adb84a4a Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 21 Aug 2026 12:47:47 +0200 Subject: [PATCH] fix(planner): let a route choice survive the map, and keep new items on their day MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two things the mobile planner forgot. The day sheet's route toggle only ever lived in component state, and entering the map — or tapping a day while in it — forced it back on. Turning the route off therefore did nothing you could see and had reset itself by the time you looked again. The choice is now remembered per trip; the map still switches it on by default, but only while the user has never said otherwise. Adding a place or a booking from inside a day did not connect it to that day. The place dropped into the unplanned pool, which on mobile is a different screen — it looks like the save was lost — and the booking opened with no date at all. Both entry points now carry the day they were opened from, including a long-press on the mobile map, where the chip rail names a day at all times. The desktop map has no such context and passes nothing, so its pool behaviour stands. While here: the import button on the bookings and transports headers only appeared when kitinerary was installed, though the server also accepts an import when the LLM parser is configured (#2007). Closes #2003 Closes #1998 --- client/src/mobile/screens/trip/MTripShell.tsx | 15 +++-- .../src/mobile/screens/trip/map/MMapArea.tsx | 7 ++- .../screens/trip/plan/useMPlanTimeline.ts | 28 ++++++--- .../screens/trip/sheets/MPlaceEditSheet.tsx | 1 + .../screens/trip/sheets/MReservationSheet.tsx | 18 +++++- .../src/pages/tripPlanner/useTripPlanner.ts | 61 ++++++++++++++++--- client/tests/helpers/mobileTrip.ts | 5 ++ .../unit/mobile/trip/MTripShell.test.tsx | 12 ++-- 8 files changed, 119 insertions(+), 28 deletions(-) diff --git a/client/src/mobile/screens/trip/MTripShell.tsx b/client/src/mobile/screens/trip/MTripShell.tsx index 624b1e715..0ea0606b2 100644 --- a/client/src/mobile/screens/trip/MTripShell.tsx +++ b/client/src/mobile/screens/trip/MTripShell.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState, type ComponentType, type ReactNode } from 'react' import { findTodayDayId } from '../../../components/Planner/today' import { - ChevronLeft, FileDown, List, Map as MapIcon, MoreHorizontal, PackageCheck, + ChevronDown, ChevronLeft, Download, FileDown, List, Map as MapIcon, MoreHorizontal, PackageCheck, Plane, Plus, Rows3, Ticket, TrainFront, Trash2, Upload, Wallet, } from 'lucide-react' import type { LucideIcon } from 'lucide-react' @@ -241,7 +241,7 @@ export default function MTripShell({ // Entering the map: draw the current day's route and frame it — the // BoundsController re-fits to include the polyline once OSRM resolves. if (next === 'map') { - planner.setRouteShown(true) + planner.autoShowRoute() if (planner.selectedDayId != null) planner.handleSelectDay(planner.selectedDayId, false) focusMapOnDay(planner.selectedDayId) } else { @@ -284,7 +284,7 @@ export default function MTripShell({ // In map mode a day tap fits to that day's places, draws its route and drops // the other days' pins, so the day it framed is the day it shows. if (view === 'map') { - planner.setRouteShown(true) + planner.autoShowRoute() focusMapOnDay(dayId) } } @@ -335,11 +335,14 @@ export default function MTripShell({ // Inactive chips only — an inline background would otherwise beat // the active chip's bg-m-act class. style={active ? undefined : { background: dayTintBackground(tint, 'badge', '--day-tint-chip') }} - className={`flex-1 whitespace-nowrap rounded-full px-3 py-[5px] text-center text-[0.75rem] font-semibold ${ + className={`flex flex-1 items-center justify-center gap-[3px] whitespace-nowrap rounded-full px-3 py-[5px] text-center text-[0.75rem] font-semibold ${ active ? 'bg-m-act text-m-actfg shadow-[0_6px_16px_-6px_rgba(0,0,0,.4)]' : 'text-m-ink' }`} > {dayChipLabel(day, language, t('planner.dayN', { n: day.day_number ?? idx + 1 }))} + {/* Marks the second tap as "opens the day", the only day-sheet + route that also exists in map view. */} + {active &&