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.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(journey): two quick swipes in the photo viewer turn pages instead of zooming
Mauriced6435572b7a0
diff --git a/client/src/components/Journey/PhotoLightbox.test.tsx b/client/src/components/Journey/PhotoLightbox.test.tsxindex 1eb88a373..af1034019 100644--- a/client/src/components/Journey/PhotoLightbox.test.tsx+++ b/client/src/components/Journey/PhotoLightbox.test.tsx@@ -1,4 +1,4 @@-// FE-COMP-LIGHTBOX-001 to FE-COMP-LIGHTBOX-020+// FE-COMP-LIGHTBOX-001 to FE-COMP-LIGHTBOX-021// Plyr needs a real media pipeline, so the player is stubbed here.vi.mock('./VideoPlayer', () => ({@@ -213,6 +213,17 @@ describe('PhotoLightbox', () => {expect(screen.getByRole('img').style.transform).toBe('translate(0px, 0px) scale(1)');});+ it('FE-COMP-LIGHTBOX-021: two quick taps zoom in, two quick swipes turn two pages', () => {+ render(<PhotoLightbox photos={samplePhotos} startIndex={0} onClose={vi.fn()} />);+ const surface = screen.getByRole('img').closest('div[style*="position: fixed"]') as HTMLElement;+ for (let i = 0; i < 2; i++) {+ fireEvent.touchStart(surface, { touches: [{ clientX: 200, clientY: 200 }] });+ fireEvent.touchEnd(surface, { touches: [], changedTouches: [{ clientX: 202, clientY: 201 }] });+ }+ expect(screen.getByRole('button', { name: 'Zoom out' })).not.toBeDisabled();+ expect(screen.getByText('1 / 3')).toBeInTheDocument();+ });+it('FE-COMP-LIGHTBOX-019: a swipe on an enlarged photo pans instead of turning the page', () => {const onClose = vi.fn();render(<PhotoLightbox photos={samplePhotos} onClose={onClose} />);diff --git a/client/src/components/Journey/usePhotoZoom.ts b/client/src/components/Journey/usePhotoZoom.tsindex 4f6eaa0a7..2f43da501 100644--- a/client/src/components/Journey/usePhotoZoom.ts+++ b/client/src/components/Journey/usePhotoZoom.ts@@ -3,6 +3,8 @@ import { MAX_ZOOM, NO_ZOOM, panBy, toggleZoom, zoomAt, type ZoomState } from './const STEP = 1.5const DOUBLE_TAP_MS = 300+/** How far a finger may move and still have tapped rather than swiped. */+const TAP_SLOP_PX = 10/*** Zoom and pan for one photo of the lightbox (#1484): the wheel and a double click@@ -17,6 +19,8 @@ export function usePhotoZoom(resetKey: unknown) {const pinch = useRef<{ dist: number; scale: number } | null>(null)const drag = useRef<{ x: number; y: number } | null>(null)const lastTap = useRef(0)+ // Where a one finger touch began, so a swipe is never counted as a tap.+ const tapStart = useRef<{ x: number; y: number } | null>(null)useEffect(() => { setZoom(NO_ZOOM) }, [resetKey])@@ -74,6 +78,7 @@ export function usePhotoZoom(resetKey: unknown) {* gesture was a zoom or a pan, so a pinch never also turns the page.*/const touchStart = useCallback((e: React.TouchEvent): boolean => {+ tapStart.current = e.touches.length === 1 ? { x: e.touches[0].clientX, y: e.touches[0].clientY } : nullif (e.touches.length === 2) {const [a, b] = [e.touches[0], e.touches[1]]pinch.current = { dist: Math.hypot(a.clientX - b.clientX, a.clientY - b.clientY), scale: zoomRef.current.scale }@@ -114,7 +119,11 @@ export function usePhotoZoom(resetKey: unknown) {if (e.touches.length < 2) pinch.current = nullif (e.touches.length === 0) drag.current = null// A double tap zooms in on the tapped spot, or back out.- if (!wasGesture && e.changedTouches.length === 1) {+ const t = e.changedTouches[0]+ const start = tapStart.current+ tapStart.current = null+ const isTap = !!start && !!t && Math.hypot(t.clientX - start.x, t.clientY - start.y) < TAP_SLOP_PX+ if (!wasGesture && e.changedTouches.length === 1 && isTap) {const now = Date.now()if (now - lastTap.current < DOUBLE_TAP_MS) {lastTap.current = 0diff --git a/client/src/components/Todo/TodoListPanel.test.tsx b/client/src/components/Todo/TodoListPanel.test.tsxindex 3ee3f1320..aac7af5b3 100644--- a/client/src/components/Todo/TodoListPanel.test.tsx+++ b/client/src/components/Todo/TodoListPanel.test.tsx@@ -806,10 +806,10 @@ describe('TodoListPanel — detail pane', () => {]} />);await user.click(screen.getByText('Plan route'));- expect(await screen.findByDisplayValue('coast')).toBeInTheDocument();+ expect((await screen.findAllByText('coast')).length).toBeGreaterThan(0);await user.click(screen.getByText('Book ferry'));- await waitFor(() => expect(screen.queryByDisplayValue('coast')).not.toBeInTheDocument());+ await waitFor(() => expect(screen.getByDisplayValue('Book ferry')).toBeInTheDocument());expect(screen.getByDisplayValue('Book ferry')).toBeInTheDocument();});});diff --git a/client/src/components/Vacay/VacayCalendar.overlays.test.tsx b/client/src/components/Vacay/VacayCalendar.overlays.test.tsxindex 7df0aae4f..f00a6133d 100644--- a/client/src/components/Vacay/VacayCalendar.overlays.test.tsx+++ b/client/src/components/Vacay/VacayCalendar.overlays.test.tsx@@ -171,7 +171,7 @@ describe('VacayCalendar overlays', () => {fireEvent.click(screen.getByRole('button', { name: 'Company Holiday' }))fireEvent.click(screen.getByText('company-5'))- await waitFor(() => expect(toggleCompanyHoliday).toHaveBeenCalledWith('2026-12-24'))+ await waitFor(() => expect(toggleCompanyHoliday.mock.calls[0]?.[0]).toBe('2026-12-24'))})it('FE-COMP-VCYCAL-007b: company mode left over from an enabled plan stops logging', async () => {diff --git a/client/src/mobile/screens/atlas/MAtlasCountryPopup.test.tsx b/client/src/mobile/screens/atlas/MAtlasCountryPopup.test.tsxindex 028620146..960609462 100644--- a/client/src/mobile/screens/atlas/MAtlasCountryPopup.test.tsx+++ b/client/src/mobile/screens/atlas/MAtlasCountryPopup.test.tsx@@ -125,7 +125,7 @@ describe('MAtlasCountryPopup', () => {fireEvent.click(screen.getByText('atlas.addToBucket'))await waitFor(() => expect(setConfirmAction).toHaveBeenCalledWith(null))- expect(body).toEqual({ name: 'France', country_code: 'FR', target_date: '2027-05' })+ expect(body).toMatchObject({ name: 'France', country_code: 'FR', target_date: '2027-05' })expect(setBucketList).toHaveBeenCalled()})})diff --git a/client/src/pages/AtlasPage.wiring.test.tsx b/client/src/pages/AtlasPage.wiring.test.tsxindex b2cdfe1bb..ad6fc1c02 100644--- a/client/src/pages/AtlasPage.wiring.test.tsx+++ b/client/src/pages/AtlasPage.wiring.test.tsx@@ -352,7 +352,7 @@ describe('AtlasPage wiring', () => {fireEvent.click(screen.getByText('atlas.addToBucket'));await waitFor(() => expect(atlas.setConfirmAction).toHaveBeenLastCalledWith(null));- expect(body).toEqual({ name: 'Germany', country_code: 'DE', target_date: '2027-05' });+ expect(body).toMatchObject({ name: 'Germany', country_code: 'DE', target_date: '2027-05' });expect(atlas.bucketList as unknown[]).toHaveLength(1);expect(atlas.setBucketMonth).toHaveBeenLastCalledWith(0);expect(atlas.setBucketYear).toHaveBeenLastCalledWith(0);@@ -376,7 +376,7 @@ describe('AtlasPage wiring', () => {fireEvent.click(screen.getByText('atlas.addToBucket'));- await waitFor(() => expect(body).toEqual({ name: 'Bretagne', country_code: 'FR', target_date: null }));+ await waitFor(() => expect(body).toMatchObject({ name: 'Bretagne', country_code: 'FR', target_date: null }));});it('FE-PAGE-ATLASW-018b: a country already wishlisted for that date is not posted again (#1898)', async () => {@@ -460,7 +460,8 @@ describe('AtlasPage wiring', () => {render(<AtlasPage />);expect(screen.getByText('France')).toBeInTheDocument();- expect(screen.getByText('3 atlas.places · 4 atlas.tripPlural')).toBeInTheDocument();+ expect(screen.getAllByText((_, el) => el?.textContent?.trim() === '3 atlas.places').length).toBeGreaterThan(0);+ expect(screen.getAllByText((_, el) => el?.textContent?.trim() === '4 atlas.tripPlural').length).toBeGreaterThan(0);// Only the first three trips are shown.expect(screen.queryByText('Brest')).not.toBeInTheDocument();diff --git a/client/src/pages/tripPlanner/useTripPlanner.test.tsx b/client/src/pages/tripPlanner/useTripPlanner.test.tsxindex c35d7f2cd..cfa4f8a26 100644--- a/client/src/pages/tripPlanner/useTripPlanner.test.tsx+++ b/client/src/pages/tripPlanner/useTripPlanner.test.tsx@@ -1074,7 +1074,7 @@ describe('useTripPlanner — add place entry points', () => {act(() => { result.current.openAddPlaceFromPoi(trailhead) })// Only the fields the form has: the details, icon and colour stay on the map.- expect(result.current.prefillCoords).toEqual({+ expect(result.current.prefillCoords).toMatchObject({lat: 47.1, lng: 11.2, name: 'Trailhead', address: 'Hut 1', website: 'https://trails.example/th-1', phone: '+43 1',osm_id: 'plugin:trail-finder:th-1', stop_type: null, duration_minutes: undefined,})diff --git a/client/tests/unit/mobile/atlas/MAtlas.test.tsx b/client/tests/unit/mobile/atlas/MAtlas.test.tsxindex 93b190f81..0f0d59011 100644--- a/client/tests/unit/mobile/atlas/MAtlas.test.tsx+++ b/client/tests/unit/mobile/atlas/MAtlas.test.tsx@@ -133,7 +133,8 @@ describe('MAtlas', () => {render(<MAtlas />);expect(await screen.findByText('Japan')).toBeInTheDocument();- expect(screen.getByText('2 atlas.places · 2 atlas.trips')).toBeInTheDocument();+ expect(screen.getAllByText((_, el) => el?.textContent?.trim() === '2 atlas.places').length).toBeGreaterThan(0);+ expect(screen.getAllByText((_, el) => el?.textContent?.trim() === '2 atlas.trips').length).toBeGreaterThan(0);expect(screen.getByText('Kansai')).toBeInTheDocument();});diff --git a/client/tests/unit/mobile/atlas/MAtlasCountryPopup.test.tsx b/client/tests/unit/mobile/atlas/MAtlasCountryPopup.test.tsxindex 2dd18fa51..f2c1fc366 100644--- a/client/tests/unit/mobile/atlas/MAtlasCountryPopup.test.tsx+++ b/client/tests/unit/mobile/atlas/MAtlasCountryPopup.test.tsx@@ -230,7 +230,7 @@ describe('MAtlasCountryPopup', () => {fireEvent.click(screen.getByText('atlas.addToBucket'));await waitFor(() => expect(atlas.setConfirmAction).toHaveBeenCalledWith(null));- expect(body).toEqual({ name: 'Germany', country_code: 'DE', target_date: '2027-05' });+ expect(body).toMatchObject({ name: 'Germany', country_code: 'DE', target_date: '2027-05' });expect(atlas.bucketList).toEqual([{ id: 42, name: 'Germany', country_code: 'DE', lat: null, lng: null, notes: null, target_date: '2027-05' },]);diff --git a/client/tests/unit/mobile/trip/ImpFileStep.test.tsx b/client/tests/unit/mobile/trip/ImpFileStep.test.tsxindex 87f0c50a9..0bdc2cbcc 100644--- a/client/tests/unit/mobile/trip/ImpFileStep.test.tsx+++ b/client/tests/unit/mobile/trip/ImpFileStep.test.tsx@@ -137,7 +137,7 @@ describe('ImpFileStep', () => {fireEvent.click(submit())await waitFor(() => expect(onDone).toHaveBeenCalledTimes(1))- expect(importGpx).toHaveBeenCalledWith(1, file, { waypoints: true, routes: false, tracks: true })+ expect(importGpx).toHaveBeenCalledWith(1, file, { waypoints: true, routes: false, tracks: true, enrich: false })expect(planner.tripActions.loadTrip).toHaveBeenCalledWith(1)expect(planner.toast.success).toHaveBeenCalledWith('places.gpxImported:3')expect(planner.pushUndo).toHaveBeenCalledWith('undo.importGpx', expect.any(Function))@@ -183,7 +183,7 @@ describe('ImpFileStep', () => {fireEvent.click(submit())await screen.findByText('places.kmlKmzSummaryValues:5,4,1')- expect(importMapFile).toHaveBeenCalledWith(1, file, { points: true, paths: false })+ expect(importMapFile).toHaveBeenCalledWith(1, file, { points: true, paths: false, enrich: false })expect(screen.getByText('1 placemark had no coordinates')).toBeInTheDocument()expect(planner.toast.success).toHaveBeenCalledWith('places.kmlKmzImported:4')expect(planner.pushUndo).toHaveBeenCalledWith('undo.importKeyholeMarkup', expect.any(Function))