From 2d6c8c51579fef3655a89118ee297a423fc0c93b Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 21 Aug 2026 12:48:04 +0200 Subject: [PATCH] fix(mobile): open the stay when you tap the stay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tapping the accommodation in the day sheet opened the place it is pinned to, so check-in, check-out and the confirmation code had no way in at all. The sheet that edits them has taken an accId since the mobile rewrite; nothing ever passed one. The row is a real button now and opens that editor, with the place kept one tap to its right for anyone who wants it. Viewers without day_edit keep the place as their target, since the editor is no use to them. The linked hotel booking below opens too — the day's booking list filters hotels out, so that strip was the only place it showed and it did nothing. Closes #2001 --- .../mobile/screens/trip/sheets/MDaySheet.tsx | 56 ++++++++++++++----- .../tests/unit/mobile/trip/MDaySheet.test.tsx | 4 ++ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/client/src/mobile/screens/trip/sheets/MDaySheet.tsx b/client/src/mobile/screens/trip/sheets/MDaySheet.tsx index f2622d6cc..5fc2d4dc8 100644 --- a/client/src/mobile/screens/trip/sheets/MDaySheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MDaySheet.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useRef, useState } from 'react' import { - CalendarDays, Car, Compass, Footprints, Hotel, Pencil, Plus, RotateCcw, + CalendarDays, Car, Compass, Footprints, Hotel, MapPin, Pencil, Plus, RotateCcw, Route as RouteIcon, TramFront, Zap, } from 'lucide-react' import type { WeatherResult } from '@trek/shared' @@ -15,6 +15,7 @@ import { RES_ICONS, getNoteIcon } from '../../../../components/Planner/DayPlanSi import { getDayBookendHotels, isDayInAccommodationRange } from '../../../../utils/dayOrder' import { splitReservationDateTime } from '../../../../utils/formatters' import { dayCoMapsUrl, dayGoogleMapsUrl, optimizeDayOrder } from '../lib/dayRoute' +import GoogleMapsIcon from '../../../../components/shared/GoogleMapsIcon' import { splitNoteTime } from '../lib/dayNotes' import { weatherIconFor } from '../plan/planTimelineModel' import type { Assignment, DayNote, Reservation } from '../../../../types' @@ -197,6 +198,18 @@ export default function MDaySheet({ planner, shell }: MTripSheetsProps) { shell.openSheet('accommodation', { dayId: day.id }) } + // Tapping the stay opens the stay. It used to open the place the stay is + // pinned to, which put check-in/check-out/confirmation out of reach entirely — + // MAccommodationSheet has taken an accId all along, nothing ever passed one (#2001). + const editAccommodation = (accId: number) => { + if (!day) return + shell.openSheet('accommodation', { dayId: day.id, accId }) + } + const openAccommodationPlace = (placeId: number) => { + shell.closeSheet() + planner.handlePlaceClick(placeId) + } + const cTemp = (c: number) => Math.round(isFahrenheit ? c * 9 / 5 + 32 : c) const formattedDate = day?.date ? new Date(`${day.date.slice(0, 10)}T00:00:00Z`).toLocaleDateString(locale, { @@ -328,12 +341,7 @@ export default function MDaySheet({ planner, shell }: MTripSheetsProps) { onClick={openInGoogleMaps} className={`flex items-center gap-[5px] rounded-full px-3 py-[7px] text-[0.75rem] font-semibold text-m-ink ${INNER_CLS}`} > - + {t('planner.openGoogleMaps')} )} @@ -460,10 +468,15 @@ export default function MDaySheet({ planner, shell }: MTripSheetsProps) { const linked = planner.reservations.find(r => String(r.accommodation_id ?? '') === String(acc.id)) return (
-
{ if (acc.place_id) { shell.closeSheet(); planner.handlePlaceClick(acc.place_id) } }} - > +
+
+ {badge.label} + {canEditDays && acc.place_id != null && ( + + )}
{(acc.check_in || acc.check_out || acc.confirmation) && (
@@ -501,7 +525,13 @@ export default function MDaySheet({ planner, shell }: MTripSheetsProps) {
)} {linked && ( -
+ // The day's booking list filters hotels out, so this strip is + // the only place the stay's booking shows up — it may as well open it. +
+ )}
) diff --git a/client/tests/unit/mobile/trip/MDaySheet.test.tsx b/client/tests/unit/mobile/trip/MDaySheet.test.tsx index 570378887..32322c9ce 100644 --- a/client/tests/unit/mobile/trip/MDaySheet.test.tsx +++ b/client/tests/unit/mobile/trip/MDaySheet.test.tsx @@ -343,7 +343,11 @@ describe('MDaySheet', () => { // start_day_id is this day, end_day_id a later one → check-in badge plus the stat label. expect(screen.getAllByText('Check-in')).toHaveLength(2) + // Tapping the stay edits the stay; the place is one tap further right (#2001). fireEvent.click(screen.getByText('Hotel Sacher')) + expect(shell.openSheet).toHaveBeenCalledWith('accommodation', { dayId: 2, accId: ACCOMMODATIONS[0].id }) + + fireEvent.click(screen.getByRole('button', { name: 'View details' })) expect(shell.closeSheet).toHaveBeenCalled() expect(planner.handlePlaceClick).toHaveBeenCalledWith(55)