From 48f28b40c4776a92106aaa4b8539820b4ea140d4 Mon Sep 17 00:00:00 2001 From: Maurice Date: Thu, 1 Oct 2026 10:08:04 +0200 Subject: [PATCH] feat(collections): navigate to a saved place from its sheet on the phone The phone's collection place sheet gets the Navigation button the desktop detail and the trip's place sheet already have, first among its actions: one offered app opens straight away, more open the same picker. (#2091) --- .../screens/collections/MCollPlaceSheet.tsx | 33 +++++++++++++++++-- .../collections/MCollPlaceSheet.test.tsx | 26 +++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/client/src/mobile/screens/collections/MCollPlaceSheet.tsx b/client/src/mobile/screens/collections/MCollPlaceSheet.tsx index 92faf9be3..e0705778b 100644 --- a/client/src/mobile/screens/collections/MCollPlaceSheet.tsx +++ b/client/src/mobile/screens/collections/MCollPlaceSheet.tsx @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react' import Markdown from 'react-markdown' import remarkGfm from 'remark-gfm' import remarkBreaks from 'remark-breaks' -import { Camera, Check, Copy, ExternalLink, Loader2, MapPin, Pencil, Trash2, X } from 'lucide-react' +import { Camera, Check, Copy, ExternalLink, Loader2, MapPin, Navigation, Pencil, Trash2, X } from 'lucide-react' import type { CollectionLabel, CollectionLink, CollectionPlace, CollectionStatus } from '@trek/shared' import type { Category, TranslationFn } from '../../../types' import { mapsApi } from '../../../api/client' @@ -16,6 +16,8 @@ import MCollCategoryPicker from './MCollCategoryPicker' import MCollLinksEditor from './MCollLinksEditor' import { STATUS_SPEC } from './collectionsMobileModel' import { CancelPill, Eyebrow, INPUT_CLS, PrimaryPill, TEXTAREA_CLS } from './MCollSheetKit' +import { getNavigationTargets, navigationTargetLabel, openNavigationTarget } from '../../../components/Planner/placeNavigation' +import { NavigationMenu } from '../../../components/shared/NavigationMenu' function linkHost(url: string): string { try { return new URL(url).hostname.replace(/^www\./, '') } catch { return url } @@ -70,6 +72,8 @@ export default function MCollPlaceSheet({ const [labelIds, setLabelIds] = useState([]) const [saving, setSaving] = useState(false) const [fetchedPhoto, setFetchedPhoto] = useState(null) + const [navOpen, setNavOpen] = useState(false) + const navBtnRef = useRef(null) const heldId = held?.id // Reseed the form + cover fetch when a different place is opened. @@ -150,6 +154,7 @@ export default function MCollPlaceSheet({ const assignedLabels = labels.filter(l => (held?.label_ids ?? []).includes(l.id)) const toggleLabel = (id: number) => setLabelIds(labelIds.includes(id) ? labelIds.filter(x => x !== id) : [...labelIds, id]) + const navTargets = getNavigationTargets(held) const actionBtn = 'flex flex-1 items-center justify-center gap-[6px] rounded-[13px] border border-[color:var(--m-rowbr)] bg-[color:var(--m-sheet)] px-2 py-[11px] text-[0.78125rem] font-semibold text-m-ink' @@ -329,7 +334,31 @@ export default function MCollPlaceSheet({ ))} )} -
+ {/* Collections are a store of places to go to, so the way there leads + the actions, as it does in the trip's place sheet (#2091). One + app offered opens straight away; more open the same picker. */} + {navTargets.length > 0 && ( + <> + + {navOpen && ( + setNavOpen(false)} + title={t('inspector.openWith')} + /> + )} + + )} +
0 ? 'mt-2' : 'mt-[14px]'} flex gap-2`}> {canEdit && (