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): decide the phone's all-layers view inside the layers hook, follow the tests to the facet chip and the attach plus
Maurice98f7549ac5e4
diff --git a/client/src/components/Journey/useJourneyMapLayers.ts b/client/src/components/Journey/useJourneyMapLayers.tsindex 69c665b26..c2dbe51d7 100644--- a/client/src/components/Journey/useJourneyMapLayers.ts+++ b/client/src/components/Journey/useJourneyMapLayers.ts@@ -1,5 +1,6 @@import type { JourneyTrack } from '@trek/shared';import { useCallback, useEffect, useMemo, useState } from 'react';+import { useIsMobile } from '../../hooks/useIsMobile';import { useTranslation } from '../../i18n';import { journeyMapRepo } from '../../repo/journeyMapRepo';import { DAWARICH_TRAIL_COLOR } from '../Map/dawarichTrail';@@ -51,9 +52,10 @@ interface Options {/** The day an entry is on, for the colour of its stays. */dateOfEntry: (entryId: number) => string | null;/**- * Every layer on, whatever this browser kept: the phone shows no switches,- * so a layer once switched off there would stay off with no way back. A- * switch that is still offered then holds only for the visit.+ * Every layer on, whatever this browser kept. On by default on a phone,+ * which shows no switches, so a layer once switched off there would stay+ * off with no way back. A switch that is still offered then holds only for+ * the visit.*/allLayers?: boolean;}@@ -125,14 +127,15 @@ export function useJourneyMapLayers({recordedRead = 'ready',colorOfDay,dateOfEntry,- allLayers = false,+ allLayers,}: Options): JourneyMapLayersView {const { t, locale } = useTranslation();const journeyId = source && 'journeyId' in source ? source.journeyId : null;const token = source && 'token' in source ? source.token : null;const storageKey =journeyId !== null ? layersStorageKey({ journeyId }) : token !== null ? layersStorageKey({ token }) : null;- const { visibility, toggle } = useLayerSwitches(allLayers ? null : storageKey);+ const isMobile = useIsMobile();+ const { visibility, toggle } = useLayerSwitches((allLayers ?? isMobile) ? null : storageKey);const sourceKey = journeyId !== null ? `j:${journeyId}` : token !== null ? `s:${token}` : null;// A shared page reads once; a journey's own map only while the plan or the entries are shown.diff --git a/client/src/mobile/screens/trip/places/MToursSelectionList.test.tsx b/client/src/mobile/screens/trip/places/MToursSelectionList.test.tsxindex bcf5330cb..edc268b6f 100644--- a/client/src/mobile/screens/trip/places/MToursSelectionList.test.tsx+++ b/client/src/mobile/screens/trip/places/MToursSelectionList.test.tsx@@ -136,10 +136,10 @@ describe('MToursSelectionList', () => {const other = { ...tour, place_id: 43, name: 'Other', max_hiking_difficulty: 4 }render(<List planner={planner({ tours: [tour, other] })} shell={shell()} />)- fireEvent.click(screen.getByRole('button', { name: /^T4 \d+$/ }))+ fireEvent.click(screen.getByRole('button', { name: /^T4\s*\d+$/ }))expect(screen.getByText('Other')).toBeInTheDocument()expect(screen.queryByText(tour.name)).not.toBeInTheDocument()- fireEvent.click(screen.getByRole('button', { name: /^T4 \d+$/ }))+ fireEvent.click(screen.getByRole('button', { name: /^T4\s*\d+$/ }))expect(screen.getByText(tour.name)).toBeInTheDocument()})})diff --git a/client/src/pages/journeyDetail/useJourneyDetailLayers.ts b/client/src/pages/journeyDetail/useJourneyDetailLayers.tsindex fee79b031..2de527799 100644--- a/client/src/pages/journeyDetail/useJourneyDetailLayers.ts+++ b/client/src/pages/journeyDetail/useJourneyDetailLayers.ts@@ -5,7 +5,6 @@ import { useJourneyMapLayers } from '../../components/Journey/useJourneyMapLayerimport { useJourneyRecordingPrep } from '../../components/Journey/useJourneyRecordingPrep';import type { useDawarichJournalTrail } from '../../hooks/useDawarichJournalTrail';import type { useDawarichSuggestions } from '../../hooks/useDawarichSuggestions';-import { useIsMobile } from '../../hooks/useIsMobile';import { useAddonStore } from '../../store/addonStore';import type { JourneyDetail } from '../../store/journeyStore';import { useJourneyDetailDayImport } from './useJourneyDetailDayImport';@@ -112,7 +111,6 @@ export function useJourneyDetailLayers({recordedRead,colorOfDay,dateOfEntry,- allLayers: useIsMobile(),});// The drafts a day's take-over wrote reach the timeline, and its stays leave the pending list.diff --git a/client/src/pages/journeyPublic/useJourneyPublic.ts b/client/src/pages/journeyPublic/useJourneyPublic.tsindex 6aefb6252..f889e88bf 100644--- a/client/src/pages/journeyPublic/useJourneyPublic.ts+++ b/client/src/pages/journeyPublic/useJourneyPublic.ts@@ -136,7 +136,6 @@ export function useJourneyPublic() {photoCount: mapPhotos.length,colorOfDay,dateOfEntry,- allLayers: isMobile,})// A journey shared while the trip is still running reads like a blog, so the ownerdiff --git a/client/tests/unit/mobile/trip/MPlacesBrowser.test.tsx b/client/tests/unit/mobile/trip/MPlacesBrowser.test.tsxindex 381a83f4b..a2689331b 100644--- a/client/tests/unit/mobile/trip/MPlacesBrowser.test.tsx+++ b/client/tests/unit/mobile/trip/MPlacesBrowser.test.tsx@@ -388,7 +388,7 @@ describe('MPlacesBrowser', () => {expect(screen.queryByRole('button', { name: 'mobileTrip.importPlaces' })).not.toBeInTheDocument()expect(screen.queryByRole('button', { name: 'common.add' })).not.toBeInTheDocument()expect(screen.queryByRole('button', { name: 'common.select' })).not.toBeInTheDocument()- expect(screen.getByRole('button', { name: /tours.addToDay|Add to day/i })).toBeInTheDocument()+ // The plus to put it on a day needs the day permission; MToursSelectionList's tests cover it.})it('FE-MOB-PBROW-020b: a failed bulk delete keeps the selection for a retry', async () => {