From d18077d171ec11f92692fb580708ca8b103a9290 Mon Sep 17 00:00:00 2001 From: Maurice Date: Thu, 17 Sep 2026 14:10:52 +0200 Subject: [PATCH] fix(journey): the Dawarich button clears the card rail, and the settings switches read in the dark Two on the journal. The phone's Dawarich button floated a hard-coded 128px over the dock, which is short of the rail underneath it: a day scrubber over a row of covers, and a cover grows from 152 to 180px when it becomes the active one. The button sat on the cards. It now clears the rail's measured height, observed rather than read once, because that height changes with every swipe. No rail, as on an empty journal, means no offset. The settings dialog drew its four switches by hand in emerald and zinc, with a white knob. In dark mode that is white on near-white: the screenshot is three pills where neither the state nor the knob can be made out. They are the shared `ToggleSwitch` now, which is the component every other switch in the app uses and which solved this exact problem with `--accent-text` on the knob. The row is no longer one big button, since a button cannot hold another: text left, switch right, the layout the settings screens use. --- .../JourneyDetailPageSettingsDialog.tsx | 49 +++++++------------ .../mobile/screens/journey/MJourneyDetail.tsx | 30 +++++++++++- 2 files changed, 47 insertions(+), 32 deletions(-) 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 && ( -
+