From 42341c2c76155bbf1c5e974d6c0aefc3c76f8c02 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 8 Nov 2026 11:30:45 +0100 Subject: [PATCH] fix(mobile): iPad feedback: columns start level, map controls sit low, no day-rail chevrons, no bottom-bar settings on a tablet, and a planned place on the journey map can be written up --- .../components/Journey/JourneyLayeredMap.tsx | 17 +++++ .../Journey/JourneyMapPickCard.test.tsx | 19 ++++++ .../components/Journey/JourneyMapPickCard.tsx | 39 +++++++++-- .../components/Journey/MobileMapTimeline.tsx | 7 +- client/src/mobile/components/MImageViewer.tsx | 4 +- client/src/mobile/mobile.css | 4 ++ .../mobile/screens/dashboard/MDashboard.tsx | 2 +- .../mobile/screens/journey/MJourneyDetail.tsx | 3 +- .../screens/settings/MSettingsAppearance.tsx | 20 ++++-- client/src/mobile/screens/trip/MTripShell.tsx | 3 +- .../mobile/screens/trip/MTripShellParts.tsx | 65 +------------------ .../src/mobile/screens/trip/map/MMapArea.tsx | 4 +- .../mobile/screens/trip/tabs/MCollabNotes.tsx | 2 +- .../screens/trip/tabs/MPackingListTab.tsx | 2 +- .../mobile/screens/trip/tabs/tabChrome.tsx | 8 ++- client/src/pages/JourneyDetailPage.tsx | 4 +- .../JourneyDetailPage.helpers.test.ts | 30 +++++++++ .../JourneyDetailPage.helpers.ts | 26 ++++++++ .../pages/journeyDetail/useJourneyDetail.ts | 7 +- .../unit/mobile/largeScreenPanes.test.tsx | 2 + .../unit/mobile/largeScreenTrip.test.tsx | 60 +---------------- .../settings/MSettingsAppearance.test.tsx | 10 +++ .../tests/unit/mobile/trip/MMapArea.test.tsx | 2 + .../unit/mobile/trip/MPackingListTab.test.tsx | 1 + 24 files changed, 192 insertions(+), 149 deletions(-) diff --git a/client/src/components/Journey/JourneyLayeredMap.tsx b/client/src/components/Journey/JourneyLayeredMap.tsx index a9223514f..1c9f2da7f 100644 --- a/client/src/components/Journey/JourneyLayeredMap.tsx +++ b/client/src/components/Journey/JourneyLayeredMap.tsx @@ -1,3 +1,4 @@ +import type { JourneyMapPlace } from '@trek/shared'; import { useCallback, useState, type ComponentProps, type Ref } from 'react'; import JourneyMap, { type JourneyMapHandle } from './JourneyMap'; import JourneyMapAuto from './JourneyMapAuto'; @@ -27,6 +28,13 @@ interface Props extends MapProps { /** Leads from a picked place or stay to its entry. */ onOpenEntry?: (entryId: string) => void; entryTitleOf?: (entryId: number) => string | null; + /** Starts an entry about a picked planned place nothing was written about; absent for a reader who cannot. */ + onWriteAboutPlace?: (place: JourneyMapPlace) => void; +} + +/** A card action, only where the screen offers one. */ +function offeredIf(offered: unknown, action: T): T | undefined { + return offered ? action : undefined; } /** @@ -44,6 +52,7 @@ export default function JourneyLayeredMap({ controlsTop = 12, onOpenEntry, entryTitleOf, + onWriteAboutPlace, photos, tracks, height = 220, @@ -55,6 +64,13 @@ export default function JourneyLayeredMap({ setPicked({ marks, key: marks.map((m) => m.key).join(',') }); }, []); const close = useCallback(() => setPicked(null), []); + const writeAbout = useCallback( + (place: JourneyMapPlace) => { + setPicked(null); + onWriteAboutPlace?.(place); + }, + [onWriteAboutPlace] + ); const openEntry = useCallback( (entryId: string) => { setPicked(null); @@ -99,6 +115,7 @@ export default function JourneyLayeredMap({ marks={card.marks} onClose={close} onOpenEntry={onOpenEntry ? openEntry : undefined} + onWriteAbout={offeredIf(onWriteAboutPlace, writeAbout)} entryTitleOf={entryTitleOf} /> )} diff --git a/client/src/components/Journey/JourneyMapPickCard.test.tsx b/client/src/components/Journey/JourneyMapPickCard.test.tsx index 53078c78e..2867a8008 100644 --- a/client/src/components/Journey/JourneyMapPickCard.test.tsx +++ b/client/src/components/Journey/JourneyMapPickCard.test.tsx @@ -86,4 +86,23 @@ describe('JourneyMapPickCard', () => { fireEvent.keyDown(window, { key: 'Escape' }); expect(onClose).toHaveBeenCalled(); }); + + it('FE-JOURNEY-MAPPICK-004: a place nothing was written about offers a new entry to whoever can write', () => { + const onWriteAbout = vi.fn(); + const { unmount } = render(); + fireEvent.click(screen.getByRole('button', { name: 'New entry' })); + expect(onWriteAbout).toHaveBeenCalledWith(expect.objectContaining({ place_id: 4, name: 'Piazza San Marco' })); + unmount(); + + // A reader who cannot write, or a place already written about, gets no such button. + render( + + ); + expect(screen.queryByRole('button', { name: 'New entry' })).toBeNull(); + }); }); diff --git a/client/src/components/Journey/JourneyMapPickCard.tsx b/client/src/components/Journey/JourneyMapPickCard.tsx index bf51ebd9b..ced521a42 100644 --- a/client/src/components/Journey/JourneyMapPickCard.tsx +++ b/client/src/components/Journey/JourneyMapPickCard.tsx @@ -1,5 +1,5 @@ import type { JourneyMapPlace, JourneyMapStay } from '@trek/shared'; -import { CalendarRange, ChevronLeft, ChevronRight, Clock, MapPin, NotebookPen, X } from 'lucide-react'; +import { CalendarRange, ChevronLeft, ChevronRight, Clock, MapPin, NotebookPen, PenLine, X } from 'lucide-react'; import { useEffect, useState } from 'react'; import { useTranslation } from '../../i18n'; import { SoftPill, WhiteBadge } from '../Planner/planParts'; @@ -14,6 +14,8 @@ interface Props { onOpenEntry?: (entryId: string) => void; /** The title of an entry the reader can see, for the stay that belongs to it. */ entryTitleOf?: (entryId: number) => string | null; + /** Starts an entry about a planned place nothing was written about; absent where the reader cannot write. */ + onWriteAbout?: (place: JourneyMapPlace) => void; } function dayLabel(date: string, locale: string): string { @@ -41,7 +43,15 @@ function OpenEntry({ entryId, onOpenEntry }: { entryId: number; onOpenEntry?: (e ); } -function PlaceDetail({ place, onOpenEntry }: { place: JourneyMapPlace; onOpenEntry?: (entryId: string) => void }) { +function PlaceDetail({ + place, + onOpenEntry, + onWriteAbout, +}: { + place: JourneyMapPlace; + onOpenEntry?: (entryId: string) => void; + onWriteAbout?: (place: JourneyMapPlace) => void; +}) { const { t, locale } = useTranslation(); return (
@@ -56,9 +66,22 @@ function PlaceDetail({ place, onOpenEntry }: { place: JourneyMapPlace; onOpenEnt {place.entry_id !== null ? ( ) : ( -

- {t('journey.map.pick.notWritten')} -

+ <> +

+ {t('journey.map.pick.notWritten')} +

+ {onWriteAbout && ( + + )} + )}
); @@ -106,7 +129,7 @@ function markName(mark: JourneyMapMark): string { * one spot come as a list first, each with what kind it is, so overlapping * hits stay reachable one by one. */ -export default function JourneyMapPickCard({ marks, onClose, onOpenEntry, entryTitleOf }: Props) { +export default function JourneyMapPickCard({ marks, onClose, onOpenEntry, entryTitleOf, onWriteAbout }: Props) { const { t, locale } = useTranslation(); const [picked, setPicked] = useState(marks.length === 1 ? marks[0] : null); @@ -150,7 +173,9 @@ export default function JourneyMapPickCard({ marks, onClose, onOpenEntry, entryT - {picked?.kind === 'plan' && } + {picked?.kind === 'plan' && ( + + )} {picked?.kind === 'stay' && ( )} diff --git a/client/src/components/Journey/MobileMapTimeline.tsx b/client/src/components/Journey/MobileMapTimeline.tsx index 4cb3a5865..9da1ee02a 100644 --- a/client/src/components/Journey/MobileMapTimeline.tsx +++ b/client/src/components/Journey/MobileMapTimeline.tsx @@ -8,7 +8,7 @@ import JourneyDayScrubber from './JourneyDayScrubber' import { dayColorOf } from './journeyCard' import { useJourneyCarouselSync } from './useJourneyCarouselSync' import type { JourneyEntry } from '../../store/journeyStore' -import type { JourneyTrack } from '@trek/shared' +import type { JourneyMapPlace, JourneyTrack } from '@trek/shared' interface MapEntry { id: string @@ -40,6 +40,8 @@ interface Props { /** The map's layers (JRN-04); a picked place or stay leads to its entry's card. */ layers?: JourneyMapLayersView | null entryTitleOf?: (entryId: number) => string | null + /** Starts an entry about a picked planned place nothing was written about. */ + onWriteAboutPlace?: (place: JourneyMapPlace) => void /** Geotagged photos on the map, a tap opening them. */ photos?: MapPhoto[] onPhotoClick?: (photoIds: string[]) => void @@ -64,6 +66,7 @@ export default function MobileMapTimeline({ initialEntryId, layers, entryTitleOf, + onWriteAboutPlace, photos, onPhotoClick, controlsTop, @@ -118,6 +121,7 @@ export default function MobileMapTimeline({ hideLayerControl controlsTop={controlsTop} onOpenEntry={handleMarkerClick} + onWriteAboutPlace={onWriteAboutPlace} entryTitleOf={entryTitleOf} entries={mapEntries} checkins={[]} @@ -160,6 +164,7 @@ export default function MobileMapTimeline({ hideLayerControl controlsTop={controlsTop} onOpenEntry={handleMarkerClick} + onWriteAboutPlace={onWriteAboutPlace} entryTitleOf={entryTitleOf} entries={mapEntries} checkins={[]} diff --git a/client/src/mobile/components/MImageViewer.tsx b/client/src/mobile/components/MImageViewer.tsx index b419a76ac..29ff5bd38 100644 --- a/client/src/mobile/components/MImageViewer.tsx +++ b/client/src/mobile/components/MImageViewer.tsx @@ -41,14 +41,14 @@ export default function MImageViewer({ role="dialog" aria-modal="true" aria-label={alt} - className="m-root fixed inset-0 z-[65] bg-black/[.92]" + className="m-root fixed inset-0 z-[var(--z-overlay)] bg-[color:var(--m-viewer-bg)]" onClick={onClose} > diff --git a/client/src/mobile/mobile.css b/client/src/mobile/mobile.css index 34a4eed13..cd0f32146 100644 --- a/client/src/mobile/mobile.css +++ b/client/src/mobile/mobile.css @@ -21,6 +21,10 @@ --m-act: #101013; --m-actfg: #fff; --m-dim: rgba(16,16,19,.4); + /* A picture shown full screen (MImageViewer): dark in either scheme, as a photo viewer is. */ + --m-viewer-bg: rgba(0,0,0,.92); + --m-viewer-ink: #fff; + --m-viewer-btn: rgba(255,255,255,.15); --m-sheet: rgba(250,250,248,.94); --m-sheetop: #FAFAF8; --m-shbr: rgba(255,255,255,.95); diff --git a/client/src/mobile/screens/dashboard/MDashboard.tsx b/client/src/mobile/screens/dashboard/MDashboard.tsx index ceb4324e2..f6c456db0 100644 --- a/client/src/mobile/screens/dashboard/MDashboard.tsx +++ b/client/src/mobile/screens/dashboard/MDashboard.tsx @@ -295,7 +295,7 @@ export default function MDashboard(): React.ReactElement { )}
{renderBlock('trips')}
-
+
{dashOrder.filter(id => id !== 'trips').map(id => (
{renderBlock(id)}
))} diff --git a/client/src/mobile/screens/journey/MJourneyDetail.tsx b/client/src/mobile/screens/journey/MJourneyDetail.tsx index 99f2fcf70..c92e45c2b 100644 --- a/client/src/mobile/screens/journey/MJourneyDetail.tsx +++ b/client/src/mobile/screens/journey/MJourneyDetail.tsx @@ -84,7 +84,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD sidebarMapItems, tracks, mapLayers, entryTitleOf, mapPhotos, openMapPhotos, recordings, canTakeOverRecording, dayImport, dayImportDates, dawarichByDate, recordingPrep, dismissSuggestion, restoreSuggestions, openAtEntryId, loadJourney, updateEntry, deleteEntry, reorderEntries, uploadPhotos, - addPickedProviderPhotos, addEntryProviderPhotos, + addPickedProviderPhotos, addEntryProviderPhotos, writeAboutPlace, } = useJourneyDetail({ journeyId, embedded }) // The dock's FAB is a sibling of this screen: on the Gallery it becomes the @@ -353,6 +353,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD hideLayerControl controlsTop="calc(var(--m-safe-top, 12px) + 50px)" onOpenEntry={handleMarkerClick} + onWriteAboutPlace={writeAboutPlace} entryTitleOf={entryTitleOf} checkins={[]} entries={sidebarMapItems} diff --git a/client/src/mobile/screens/settings/MSettingsAppearance.tsx b/client/src/mobile/screens/settings/MSettingsAppearance.tsx index 1d1d68a03..bb8b786cd 100644 --- a/client/src/mobile/screens/settings/MSettingsAppearance.tsx +++ b/client/src/mobile/screens/settings/MSettingsAppearance.tsx @@ -9,6 +9,7 @@ import MToggle from '../../components/MToggle' import { MSetCard, MSetEyebrow, MSetSegments, MSetRow } from './MSettingsUi' import MMobileNavCustomizer from './MMobileNavCustomizer' import MMobileDashOrder from './MMobileDashOrder' +import { useIsWide } from '../../../hooks/sizeClass' function SliderRow({ label, sub, value, onChange }: { label: string; sub?: string; value: number; onChange: (v: number) => void }) { return ( @@ -41,6 +42,8 @@ function SliderRow({ label, sub, value, onChange }: { label: string; sub?: strin */ export default function MSettingsAppearance() { const { t } = useTranslation() + // A tablet has the rail on its side, no bottom bar: only the dashboard's order is left to set. + const wide = useIsWide() const { cfg, darkMode, isDark, update, setMode, setWidget, resetAll, accentLight, accentDark, customRatio } = useAppearanceEditor() @@ -156,11 +159,18 @@ export default function MSettingsAppearance() { )} - - {t('settings.appearance.mobileNav')} - update({ mobileNav: mn })} /> - - {t('settings.appearance.dashOrder')} + + {!wide && ( + <> + {t('settings.appearance.mobileNav')} + update({ mobileNav: mn })} /> + {t('settings.appearance.dashOrder')} + + )}

{t('settings.appearance.dashOrder.hint')}

update({ dashboard: { ...cfg.dashboard, mobileOrder: order } })} />
diff --git a/client/src/mobile/screens/trip/MTripShell.tsx b/client/src/mobile/screens/trip/MTripShell.tsx index 99c5ce573..290f6a193 100644 --- a/client/src/mobile/screens/trip/MTripShell.tsx +++ b/client/src/mobile/screens/trip/MTripShell.tsx @@ -29,7 +29,7 @@ import { useDayPreviewStore } from '../../dayPreviewStore' import { useIsSplit, useIsWide } from '../../../hooks/sizeClass' import MTripRail from './MTripRail' import { - CollabSegment, CompactToggle, DayRailSteps, DockMoreButton, DocSyncButton, GlassSegment, HeaderActions, PrimaryPill, ROW_AFTER_BACK, ROW_CENTRED, + CollabSegment, CompactToggle, DockMoreButton, DocSyncButton, GlassSegment, HeaderActions, PrimaryPill, ROW_AFTER_BACK, ROW_CENTRED, } from './MTripShellParts' import { edgeFadeClass, useEdgeFade } from '../../components/useEdgeFade' import { useShortcuts } from '../../keyboard/useShortcuts' @@ -645,7 +645,6 @@ export default function MTripShell({ {/* The glass is the outer box, the scroller sits inside its padding: that way the fade at an edge that runs on takes the chips, not the glass's rim. */}
-
{dayPill && ( { - const rtl = getComputedStyle(rail).direction === 'rtl'; - const box = rail.getBoundingClientRect(); - const chips = Array.from(rail.querySelectorAll('button')); - const pastEnd = (r: DOMRect) => (rtl ? r.left < box.left - 1 : r.right > box.right + 1); - const pastStart = (r: DOMRect) => (rtl ? r.right > box.right + 1 : r.left < box.left - 1); - const target = - toward === 'end' - ? chips.find((chip) => pastEnd(chip.getBoundingClientRect())) - : chips.filter((chip) => pastStart(chip.getBoundingClientRect())).pop(); - const reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches; - // 'nearest' on the block axis: the shell root is fixed, anything else scrolls the page behind it. - target?.scrollIntoView({ - inline: toward === 'end' ? 'start' : 'end', - block: 'nearest', - behavior: reduced ? 'auto' : 'smooth', - }); - }; - const btn = - 'absolute top-1/2 z-[1] flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-sheetop)] text-m-ink shadow-[0_4px_12px_-4px_rgba(0,0,0,.35)]'; - return ( - <> - {fade.start && ( - - )} - {fade.end && ( - - )} - - ); -} - interface CollabSegmentProps { active: MTripCollabTab; onPick: (tab: MTripCollabTab) => void; diff --git a/client/src/mobile/screens/trip/map/MMapArea.tsx b/client/src/mobile/screens/trip/map/MMapArea.tsx index 3e9f9fdd2..f5f6876f0 100644 --- a/client/src/mobile/screens/trip/map/MMapArea.tsx +++ b/client/src/mobile/screens/trip/map/MMapArea.tsx @@ -345,12 +345,14 @@ export default function MMapArea({ planner, shell }: MMapAreaProps) { // the overview stack) follows on its own. The band used to float a further 38px up to // leave the corner under it to the map credit; the phone map carries no visible credit // any more (see mobile.css), so that row would now only be a gap over the dock. + // A wide window has no dock (the rail stands on the side), so there the floor is + // the safe area alone and the controls sit down in the corners. // // The metrics are classes rather than an inline --bottom-nav-h, and the lift is its // OWN variable folded into them: the compass band below is identified by being the // one element that sets that name inline, and a second one would make that ambiguous.
+
{!!note.pinned && }