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)