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(mobile): the journal as a trip tab keeps its switch and menu in the shell's top row, like the tour tab
Mauricea9af19f02a47
diff --git a/client/scripts/feature-pairs.json b/client/scripts/feature-pairs.jsonindex 53de49cb5..db76f9345 100644--- a/client/scripts/feature-pairs.json+++ b/client/scripts/feature-pairs.json@@ -1038,7 +1038,7 @@"src/mobile/screens/settings/MSettingsUi.tsx": "Phone only settings UI primitives (card, row, input, button, segments, hint).","src/mobile/screens/settings/MTileCacheUsage.tsx": "Phone only: the native tile cache size and clear action, which the browser build has no counterpart for.","src/mobile/screens/settings/MWebPushCard.tsx": "Already shares hooks/useWebPush with components/Settings/WebPushCard.tsx.",- "src/mobile/screens/trip/tours/tourHeadSlot.ts": "Phone shell only; the place in the shell's top row the tours tab fills with its switch and map button. The desktop planner heads its rails itself.",+ "src/mobile/screens/trip/tabHeadSlot.ts": "Phone shell only; the place in the shell's top row the tours tab and the journal fill with their own switches. The desktop heads its panels itself.","src/mobile/screens/trip/MTripRail.tsx": "Phone shell only; the trip's sections on the leading edge of a wide window in place of the dock, with the tabs and handlers MTripShell hands in.","src/mobile/screens/trip/MTripShellParts.tsx": "Markup only; small pieces of MTripShell's top controls (segment pill, compact toggle, document sync button), with the state and handlers MTripShell hands in.","src/mobile/screens/trip/dockTabs.ts": "Phone only helper that picks which trip tabs get a seat in the mobile dock.",diff --git a/client/src/mobile/screens/journey/MJourneyDetail.tsx b/client/src/mobile/screens/journey/MJourneyDetail.tsxindex c92e45c2b..59a936a0f 100644--- a/client/src/mobile/screens/journey/MJourneyDetail.tsx+++ b/client/src/mobile/screens/journey/MJourneyDetail.tsx@@ -1,4 +1,4 @@-import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, type CSSProperties, type ReactNode } from 'react'import { Outlet, useSearchParams } from 'react-router'import { BookOpen, ChevronLeft, MapPin, Grid3x3, MoreHorizontal, Play, Image, Camera, EyeOff, Settings2, X, Route, ListChecks } from 'lucide-react'import JourneyLayeredMap from '../../../components/Journey/JourneyLayeredMap'@@ -32,6 +32,8 @@ import MJourneyFeed from './MJourneyFeed'import MJourneySettingsSheet from './MJourneySettingsSheet'import MJourneyDayImportSheet from './MJourneyDayImportSheet'import MJourneyRecordingSheet from './MJourneyRecordingSheet'+import { createPortal } from 'react-dom'+import { useTabHeadSlot } from '../trip/tabHeadSlot'/*** Journey detail — integrated map with the horizontal 280px card timeline@@ -86,6 +88,9 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyDloadJourney, updateEntry, deleteEntry, reorderEntries, uploadPhotos,addPickedProviderPhotos, addEntryProviderPhotos, writeAboutPlace,} = useJourneyDetail({ journeyId, embedded })+ // A trip tab: the header goes into the trip shell's top row (tabHeadSlot.ts).+ const shellSlot = useTabHeadSlot()+ const headSlot = embedded ? shellSlot : null// The dock's FAB is a sibling of this screen: on the Gallery it becomes the// upload button, so it has to know which tab is open — and it stops knowing@@ -339,7 +344,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyDreturn (// h-dvh, not h-full: the shell stopped providing a definite height (#1809)// and a map on a percentage of an auto-height parent collapses to zero.- <div ref={rootRef} className="m-bleed relative h-dvh overflow-hidden">+ <div ref={rootRef} className="m-bleed relative h-dvh overflow-hidden" style={headSlot ? IN_SHELL_ROW : undefined}>{/* Integrated map — always mounted, the gallery overlays it. Beside the feedit begins where the feed ends, so its controls and its framing stay inthe part that can be seen. */}@@ -448,10 +453,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD{/* Header: back — segment — upload / overflow menu. Beside the feed it keepsto the feed, as the trip's controls keep to its pane. */}- <div- className="m-bar-x absolute top-[var(--m-safe-top,12px)] z-10 flex items-center justify-between gap-2"- style={feed ? { insetInlineEnd: 'calc(100% - var(--m-rail-w, 0px) - var(--m-pane-aside-w) + 16px)' } : undefined}- >+ <HeaderFrame slot={headSlot} feed={!!feed}>{embedded ? (<span className="w-[38px] flex-none" aria-hidden />) : (@@ -464,7 +466,10 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD<ChevronLeft size={18} strokeWidth={2.2} className="rtl:-scale-x-100" /></button>)}- <div className="absolute left-1/2 top-0 flex -translate-x-1/2 rounded-full bg-[color:var(--m-sheet)] p-[3px] shadow-[0_5px_14px_-6px_rgba(0,0,0,.3)]">+ <div+ data-view-switch+ className="absolute left-1/2 top-0 flex -translate-x-1/2 rounded-full bg-[color:var(--m-sheet)] p-[3px] shadow-[0_5px_14px_-6px_rgba(0,0,0,.3)]"+ ><buttontype="button"onClick={() => setView('timeline')}@@ -519,7 +524,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD<MoreHorizontal size={17} strokeWidth={2} /></button></span>- </div>+ </HeaderFrame>{/* The stays Dawarich recorded for these dates, as candidate entries. Overthe map rather than in the header: it belongs to what is on the map,@@ -824,3 +829,30 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD</div>)}++/**+ * With the header in the shell's row, what the screen measures from its top+ * starts right under that row instead of under a row of its own.+ */+const IN_SHELL_ROW = { '--m-safe-top': 'calc(env(safe-area-inset-top, 0px) + 6px)' } as CSSProperties++/** The header row: on the screen, or in the trip shell's top row when the journal is a trip tab. */+function HeaderFrame({ slot, feed, children }: { slot: HTMLElement | null; feed: boolean; children: ReactNode }) {+ if (slot) {+ return createPortal(+ <div className="flex min-w-0 flex-1 items-center gap-2 [&>span:first-child]:hidden [&_[data-view-switch]]:static [&_[data-view-switch]]:translate-x-0">+ {children}+ </div>,+ slot+ )+ }+ return (+ <div+ className="m-bar-x absolute top-[var(--m-safe-top,12px)] z-10 flex items-center justify-between gap-2"+ style={feed ? { insetInlineEnd: 'calc(100% - var(--m-rail-w, 0px) - var(--m-pane-aside-w) + 16px)' } : undefined}+ >+ {children}+ </div>+ )+}+diff --git a/client/src/mobile/screens/trip/MTripShell.tsx b/client/src/mobile/screens/trip/MTripShell.tsxindex 4e2313b37..972b45b0b 100644--- a/client/src/mobile/screens/trip/MTripShell.tsx+++ b/client/src/mobile/screens/trip/MTripShell.tsx@@ -35,7 +35,7 @@ import { edgeFadeClass, useEdgeFade } from '../../components/useEdgeFade'import { useShortcuts } from '../../keyboard/useShortcuts'import { tripCreateIntent } from '../../../components/Layout/useCreateAction'import MDockScrim from '../../components/MDockScrim'-import { setTourHeadSlot } from './tours/tourHeadSlot'+import { setTabHeadSlot } from './tabHeadSlot'/*** Mobile trip screen frame. Owns the chrome the design shares across every@@ -866,8 +866,8 @@ export default function MTripShell({not in the dock, so nothing was lit up there either, and the screengave no clue which plugin was open. Same treatment as the others, fromthe tab entry the planner already builds (id, label, icon). */}- {/* The tours tab puts its own controls here instead (tours/tourHeadSlot.ts). */}- {trTab === 'tour-planner' && <div ref={setTourHeadSlot} className="pointer-events-auto absolute inset-x-[52px] top-1/2 flex -translate-y-1/2 items-center gap-2" />}+ {/* The tours tab and the journal put their own controls here instead (tabHeadSlot.ts). */}+ {(trTab === 'tour-planner' || trTab === 'journal') && <div ref={setTabHeadSlot} className="pointer-events-auto absolute inset-x-[52px] top-1/2 flex -translate-y-1/2 items-center gap-2" />}{trTab.startsWith('plugin:') && (() => {const tab = planner.TRIP_TABS.find(x => x.id === trTab)if (!tab) return nulldiff --git a/client/src/mobile/screens/trip/tours/tourHeadSlot.ts b/client/src/mobile/screens/trip/tabHeadSlot.tssimilarity index 55%rename from client/src/mobile/screens/trip/tours/tourHeadSlot.tsrename to client/src/mobile/screens/trip/tabHeadSlot.tsindex 31565bbff..eada67f2b 100644--- a/client/src/mobile/screens/trip/tours/tourHeadSlot.ts+++ b/client/src/mobile/screens/trip/tabHeadSlot.ts@@ -1,8 +1,9 @@/**- * The place in the trip shell's top row that the tours tab fills with its own- * controls: the switch between the trip's tours and the editor, and on a window- * that shows the pane or the map, the map button. The row has the back button- * on one side and nothing else to say on a tablet, so the tab's name made way.+ * The place in the trip shell's top row that a tab fills with its own controls,+ * beside the back button: the tours tab its switch between the trip's tours and+ * the editor (and the map button where the window shows the pane or the map),+ * the journal its Journey/Gallery switch and its menu. Without it those sat on+ * a row of their own under the shell's, an empty band above every such tab.** The shell hands the node in through a callback ref; the tab portals into it.* Kept outside React state so the shell does not render again for it.@@ -13,7 +14,7 @@ let slot: HTMLElement | null = null;const listeners = new Set<() => void>();/** The callback ref of the shell's slot. */-export function setTourHeadSlot(node: HTMLElement | null): void {+export function setTabHeadSlot(node: HTMLElement | null): void {if (node === slot) return;slot = node;for (const listener of listeners) listener();@@ -24,8 +25,8 @@ function subscribe(listener: () => void): () => void {return () => listeners.delete(listener);}-/** The slot while the shell shows it, else null (the tab then keeps its controls in its pane). */-export function useTourHeadSlot(): HTMLElement | null {+/** The slot while the shell shows it, else null (the tab then keeps its controls on its own row). */+export function useTabHeadSlot(): HTMLElement | null {return useSyncExternalStore(subscribe,() => slot,diff --git a/client/src/mobile/screens/trip/tours/MTourWorkspace.tsx b/client/src/mobile/screens/trip/tours/MTourWorkspace.tsxindex fe6ede02f..f8a618fa5 100644--- a/client/src/mobile/screens/trip/tours/MTourWorkspace.tsx+++ b/client/src/mobile/screens/trip/tours/MTourWorkspace.tsx@@ -13,7 +13,7 @@ import { useTripPlannerPageOf } from '../../../../pages/tripPlanner/useTripPlannimport MIconBtn from '../../../components/MIconBtn';import MSegmented from '../../../components/MSegmented';import type { MTripTabPanelProps } from '../MTripShell';-import { useTourHeadSlot } from './tourHeadSlot';+import { useTabHeadSlot } from '../tabHeadSlot';/** The pane's two halves: the trip's tours, or the editor with the tour open in it. */type MTourPane = 'tours' | 'editor';@@ -67,7 +67,7 @@ export default function MTourWorkspace({ planner }: Pick<MTripTabPanelProps, 'plconst showPane = split || !mapShown;const showMap = split || mapShown;const { t } = planner;- const headSlot = useTourHeadSlot();+ const headSlot = useTabHeadSlot();// In the shell's top row the switch also brings the pane back from the map.const pickPane = (next: MTourPane) => {setPane(next);diff --git a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsxindex affcde569..42d24a87d 100644--- a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx+++ b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx@@ -3,6 +3,7 @@ import { describe, it, expect, beforeEach, afterEach, onTestFinished, vi } fromimport { setSizeClass } from '../../../helpers/sizeClass';import { render, screen, fireEvent, waitFor, act } from '../../../helpers/render';import MJourneyDetail from '../../../../src/mobile/screens/journey/MJourneyDetail';+import { setTabHeadSlot } from '../../../../src/mobile/screens/trip/tabHeadSlot';import { addonsApi, journeyApi, memoriesApi } from '../../../../src/api/client';import { useJourneyStore } from '../../../../src/store/journeyStore';import { useAuthStore } from '../../../../src/store/authStore';@@ -336,6 +337,23 @@ describe('MJourneyDetail', () => {expect(hook.setView).toHaveBeenCalledWith('timeline');});+ it("FE-MOB-JDET-050: as a trip tab the switch and the menu sit in the trip shell's top row", () => {+ const slot = document.createElement('div');+ document.body.appendChild(slot);+ setTabHeadSlot(slot);+ try {+ mocks.detail = buildHook();+ render(<MJourneyDetail journeyId={7} embedded />);+ expect(slot).toContainElement(screen.getByRole('button', { name: /journey.share.gallery/ }));+ expect(slot).toContainElement(screen.getByRole('button', { name: 'files.menu' }));+ // The view switch stands beside the back button rather than centred over the screen.+ expect(slot.querySelector('[data-view-switch]')?.parentElement?.className).toContain('[&_[data-view-switch]]:static');+ } finally {+ setTabHeadSlot(null);+ slot.remove();+ }+ });+it('FE-MOB-JDET-010: back navigates to the journey list', () => {const { hook } = setup();fireEvent.click(screen.getByRole('button', { name: 'journey.detail.backToJourney' }));diff --git a/client/tests/unit/mobile/trip/MTourWorkspace.test.tsx b/client/tests/unit/mobile/trip/MTourWorkspace.test.tsxindex 73185d266..9e253caed 100644--- a/client/tests/unit/mobile/trip/MTourWorkspace.test.tsx+++ b/client/tests/unit/mobile/trip/MTourWorkspace.test.tsx@@ -1,8 +1,8 @@import { fireEvent } from '@testing-library/react';import type { ReactNode } from 'react';import { beforeEach, describe, expect, it, vi } from 'vitest';+import { setTabHeadSlot } from '../../../../src/mobile/screens/trip/tabHeadSlot';import MTourWorkspace from '../../../../src/mobile/screens/trip/tours/MTourWorkspace';-import { setTourHeadSlot } from '../../../../src/mobile/screens/trip/tours/tourHeadSlot';import { buildPlanner } from '../../../helpers/mobileTrip';import { render, screen } from '../../../helpers/render';import { setSizeClass } from '../../../helpers/sizeClass';@@ -59,7 +59,7 @@ beforeEach(() => {page.wandererOpen = false;page.calls = [];dragBridge.mockClear();- setTourHeadSlot(null);+ setTabHeadSlot(null);});describe('MTourWorkspace', () => {@@ -141,7 +141,7 @@ describe('MTourWorkspace', () => {setSizeClass('wide');const slot = document.createElement('div');document.body.appendChild(slot);- setTourHeadSlot(slot);+ setTabHeadSlot(slot);render(<MTourWorkspace planner={buildPlanner()} />);expect(await screen.findByTestId('tour-list')).toBeInTheDocument();expect(slot).toContainElement(screen.getByRole('tab', { name: 'tours.planner.tripTours' }));