From 502f604ca23e2c45a030a5907e1f6999e17aaa00 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 27 Jul 2026 17:36:45 +0200 Subject: [PATCH] Reach the track colour from the mobile sheet MPlaceSheet had no relation to route_geometry at all, so the section is new. It saves through the single-field patch the sheet already uses for the image, which keeps it clear of the edit form and its prefill. The browse list gets the same colour stroke as the desktop sidebar. It matters more here: the mobile map is full-bleed with no sidebar next to it, so without the stroke a coloured line has nothing to tie it to. --- .../screens/trip/places/MPlacesBrowser.tsx | 10 ++++ .../screens/trip/sheets/MPlaceSheet.tsx | 51 ++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx b/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx index 02301be56..394d46549 100644 --- a/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx +++ b/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx @@ -8,6 +8,7 @@ import { useTripStore } from '../../../../store/tripStore' import { useAddonStore } from '../../../../store/addonStore' import PlaceAvatar from '../../../../components/shared/PlaceAvatar' import { getCategoryIcon } from '../../../../components/shared/categoryIcons' +import { resolveTrackColor } from '../../../../components/Map/trackColors' import MConfirmSheet from '../../settings/MConfirmSheet' import type { MPlacesBrowserProps } from '../MTripShell' import type { Place } from '../../../../types' @@ -290,6 +291,15 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps) + {/* Stroke in the track's colour — the mobile map is full-bleed + with no sidebar, so this is the only thing tying a line to + a row (#776). */} + {place.route_geometry && ( + + )} {place.name} diff --git a/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsx b/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsx index f0053d8bf..001e63fa5 100644 --- a/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsx @@ -1,7 +1,7 @@ import { useMemo, useRef, useState } from 'react' import { Bookmark, Camera, ExternalLink, Loader2, Map as MapIcon, Navigation, Paperclip, - Pencil, Phone, Plus, Trash2, Upload, X, + Pencil, Phone, Plus, Route, Trash2, Upload, X, } from 'lucide-react' import MSheet from '../../../components/MSheet' import type { MTripSheetsProps } from '../MTripShell' @@ -14,6 +14,8 @@ import { useSaveToCollectionStore } from '../../../../store/saveToCollectionStor import { collectionTargetFromPlace } from '../lib/collectionTarget' import { getCategoryIcon } from '../../../../components/shared/categoryIcons' import PlaceRating from '../../../../components/shared/StarRating' +import TrackColorPicker from '../../../../components/shared/TrackColorPicker' +import { resolveTrackColor, inheritedTrackColor } from '../../../../components/Map/trackColors' import { avatarSrc } from '../../../../utils/avatarSrc' import { openFile } from '../../../../utils/fileDownload' import { getGoogleMapsUrlForPlace } from '../../../../components/Planner/placeGoogleMaps' @@ -42,6 +44,7 @@ export default function MPlaceSheet({ planner, shell }: MTripSheetsProps) { const [participantPickerOpen, setParticipantPickerOpen] = useState(false) const [uploading, setUploading] = useState(false) const [imgBusy, setImgBusy] = useState(false) + const [colorPickerOpen, setColorPickerOpen] = useState(false) const fileInputRef = useRef(null) const imageInputRef = useRef(null) @@ -132,6 +135,15 @@ export default function MPlaceSheet({ planner, shell }: MTripSheetsProps) { } } + const handleTrackColor = async (color: string | null) => { + if (!place) return + try { + await planner.tripActions.updatePlace(planner.tripId, place.id, { route_color: color }) + } catch (err: unknown) { + planner.toast.error(translateApiError(t, err, 'common.unknownError')) + } + } + const handleImageRemove = async () => { if (!place) return setImgBusy(true) @@ -290,6 +302,43 @@ export default function MPlaceSheet({ planner, shell }: MTripSheetsProps) { )} + {/* ── Track colour (#776) ── */} + {place.route_geometry && ( + <> + {t('inspector.trackColor')} +
+ + {colorPickerOpen && ( +
+ +
+ )} +
+ + )} + {/* ── Day assignments ── */} {t('mobileTrip.assignedDays')}