diff --git a/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx b/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx index ac83ed463..ee641f212 100644 --- a/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx +++ b/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx @@ -11,6 +11,7 @@ import type { JourneyDetail } from '../../store/journeyStore' import { pickGradient } from '../../pages/journeyDetail/JourneyDetailPage.helpers' import { AddTripDialog } from './JourneyDetailPageAddTripDialog' import { normalizeImageFile } from '../../utils/convertHeic' +import ToggleSwitch from '../Settings/ToggleSwitch' export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite, onRefresh, onRestoreSuggestions }: { journey: JourneyDetail @@ -188,25 +189,17 @@ export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite, {/* Trip GPX tracks on the journey map (#2194) */}
- + { if (!savingTracks) handleTracksToggle() }} + label={t('journey.settings.showTripTracks')} + /> +
{/* The three fields a journey may put away (discussion #2299) */} @@ -221,21 +214,17 @@ export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite, ] as const).map(([field, label]) => { const on = journey[field] !== 0 return ( - + {label} + { if (savingField === null) handleFieldToggle(field) }} + label={label} + /> + ) })} diff --git a/client/src/mobile/screens/journey/MJourneyDetail.tsx b/client/src/mobile/screens/journey/MJourneyDetail.tsx index 3ca4485a8..e0a707cc7 100644 --- a/client/src/mobile/screens/journey/MJourneyDetail.tsx +++ b/client/src/mobile/screens/journey/MJourneyDetail.tsx @@ -204,8 +204,31 @@ export default function MJourneyDetail() { const [pickerProvider, setPickerProvider] = useState(null) const dawarichEnabled = useAddonStore(state => state.isEnabled)('dawarich') const [dawarichOpen, setDawarichOpen] = useState(false) + /** + * How tall the card rail over the dock currently is. + * + * Measured rather than written down: the rail is a day scrubber over a row of covers, + * and a cover grows from 152 to 180px when it becomes the active one. The Dawarich + * button above it used to clear a hard-coded 128px, which was short of the rail on any + * screen and left the button sitting over the cards. Zero while there is no rail, which + * is also the empty-journal case, and the button then sits straight above the dock. + */ + const [railHeight, setRailHeight] = useState(0) + const railRef = useRef(null) const [uploading, setUploading] = useState(false) + useEffect(() => { + const node = railRef.current + if (!node) { setRailHeight(0); return } + // Observed rather than read once: the rail changes height when the active card grows, + // and a height read at mount would be the wrong one from the first swipe onwards. + if (typeof ResizeObserver === 'undefined') { setRailHeight(node.offsetHeight); return } + const observer = new ResizeObserver(() => setRailHeight(node.offsetHeight)) + observer.observe(node) + setRailHeight(node.offsetHeight) + return () => observer.disconnect() + }, [view, entries.length]) + const openUpload = useCallback(() => { if (availableProviders.length > 0) setShowUploadMenu(true) else galleryFileRef.current?.click() @@ -450,7 +473,10 @@ export default function MJourneyDetail() { type="button" onClick={() => setDawarichOpen(true)} aria-label={t('dawarich.suggestions.title')} - className="absolute right-4 z-[9] flex h-[46px] w-[46px] items-center justify-center overflow-hidden rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-sheet)] shadow-[0_6px_18px_-8px_rgba(0,0,0,.35)] bottom-[calc(var(--bottom-nav-h,84px)+16px+128px)]" + className="absolute right-4 z-[9] flex h-[46px] w-[46px] items-center justify-center overflow-hidden rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-sheet)] shadow-[0_6px_18px_-8px_rgba(0,0,0,.35)]" + // The rail's own offset over the dock, its measured height, then a gap. The 128px + // this used to guess at was short of the rail, so the button lay on the cards. + style={{ bottom: `calc(var(--bottom-nav-h, 84px) + 2px + ${railHeight}px + 12px)` }} > @@ -487,7 +513,7 @@ export default function MJourneyDetail() { nothing between the cards and it; two pixels keeps a hair of daylight and gives the strip the rest. */} {view === 'timeline' && entries.length > 0 && ( -
+