The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(journey): the card under the finger grows while swiping, and the zoom buttons really go on touch screens
Maurice77b9252577b4
diff --git a/client/src/components/Journey/JourneyEntryCover.tsx b/client/src/components/Journey/JourneyEntryCover.tsxindex 2d23eb7d9..1f5934ff9 100644--- a/client/src/components/Journey/JourneyEntryCover.tsx+++ b/client/src/components/Journey/JourneyEntryCover.tsx@@ -108,7 +108,7 @@ export default function JourneyEntryCover({// growing its box moved every card after it once a swipe had landed, and the// snap then pulled the strip again, which read as a jolt (carousels keep the// room for it with their gap and top padding).- className={`relative h-[152px] w-[136px] flex-none origin-bottom overflow-hidden rounded-[18px] text-start transition-[transform,box-shadow] duration-300 ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none ${+ className={`relative h-[152px] w-[136px] flex-none origin-bottom overflow-hidden rounded-[18px] text-start transition-[transform,box-shadow] duration-200 ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none ${isActive ? 'z-[1] scale-[1.18] shadow-[0_18px_40px_-16px_rgba(0,0,0,.55)]' : 'scale-100 shadow-[0_10px_24px_-14px_rgba(0,0,0,.5)]'} ${src ? '' : emptyGround} ${isSuggestion ? 'opacity-90' : ''}`}// backgroundImage, not background: the shorthand would drop the opaque colourdiff --git a/client/src/components/Journey/JourneyMap.tsx b/client/src/components/Journey/JourneyMap.tsxindex 06f088531..c3178c79b 100644--- a/client/src/components/Journey/JourneyMap.tsx+++ b/client/src/components/Journey/JourneyMap.tsx@@ -693,8 +693,10 @@ function JourneyMap(/>{/* A finger zooms with a pinch, and on a phone these sat under the bottom bar (#3001). */}<div- className="[@media(pointer:coarse)]:hidden"- style={{ position: 'absolute', bottom: 12, right: 12, zIndex: 400, display: 'flex', flexDirection: 'column', gap: 4 }}+ // The display lives in the classes, not the style: an inline display beat the+ // hidden class and left the buttons on phones.+ className="flex flex-col gap-1 [@media(pointer:coarse)]:hidden"+ style={{ position: 'absolute', bottom: 12, right: 12, zIndex: 400 }}><button type="button" onClick={() => zoom(true)} style={zoomButtonStyle(dark)}>+</button><button type="button" onClick={() => zoom(false)} style={zoomButtonStyle(dark)}>−</button>diff --git a/client/src/components/Journey/MobileMapTimeline.tsx b/client/src/components/Journey/MobileMapTimeline.tsxindex b675a2053..4cb3a5865 100644--- a/client/src/components/Journey/MobileMapTimeline.tsx+++ b/client/src/components/Journey/MobileMapTimeline.tsx@@ -69,7 +69,7 @@ export default function MobileMapTimeline({controlsTop,}: Props) {const {- mapRef, carouselRef, cardRefs, activeIndex, setActiveIndex, scrubberDays,+ mapRef, carouselRef, cardRefs, activeIndex, focusIndex, setActiveIndex, scrubberDays,syncMapToCard: syncMapToCarousel, handleMarkerClick, handleCardTap, openEntryById, jumpToDay,} = useJourneyCarouselSync({ entries, mapEntries, onOpenEntry: onEntryClick })// The delayed initial focus reads both through refs so it always works off@@ -207,7 +207,7 @@ export default function MobileMapTimeline({<JourneyEntryCoverentry={entry}dayColor={dayColorOf(scrubberDays, entry.entry_date)}- isActive={i === activeIndex}+ isActive={i === focusIndex}onClick={() => handleCardTap(entry, i)}showMood={showMood}showWeather={showWeather}diff --git a/client/src/components/Journey/useJourneyCarouselSync.test.ts b/client/src/components/Journey/useJourneyCarouselSync.test.tsindex c8d5bb9e2..726abeabb 100644--- a/client/src/components/Journey/useJourneyCarouselSync.test.ts+++ b/client/src/components/Journey/useJourneyCarouselSync.test.ts@@ -129,7 +129,7 @@ describe('useJourneyCarouselSync', () => {carousel.dispatchEvent(new Event('scroll'));act(() => vi.advanceTimersByTime(100));carousel.dispatchEvent(new Event('scroll'));- act(() => vi.advanceTimersByTime(149));+ act(() => vi.advanceTimersByTime(89));expect(hook.result.current.activeIndex).toBe(0);act(() => vi.advanceTimersByTime(1));// Centre 250: card 1 spans 200 to 300.@@ -170,7 +170,7 @@ describe('useJourneyCarouselSync', () => {Object.defineProperty(carousel, 'scrollLeft', { value: scrollLeft, configurable: true });carousel.dispatchEvent(new Event('scroll'));act(() => {- vi.advanceTimersByTime(150);+ vi.advanceTimersByTime(90);});};diff --git a/client/src/components/Journey/useJourneyCarouselSync.ts b/client/src/components/Journey/useJourneyCarouselSync.tsindex 6042598cc..2668a3cca 100644--- a/client/src/components/Journey/useJourneyCarouselSync.ts+++ b/client/src/components/Journey/useJourneyCarouselSync.ts@@ -25,6 +25,13 @@ export interface JourneyCarouselSyncOptions<E extends CarouselEntry> {* once scrolling settles, and the map follows it; a marker, a day on the scrubber or a* tap brings its card to the centre.*/+/**+ * How long the strip has to be still before the swipe counts as landed: long+ * enough to see past the gaps between scroll events of a momentum swipe, short+ * enough that the map follows the card without a noticeable wait.+ */+const SETTLE_MS = 90;+export function useJourneyCarouselSync<E extends CarouselEntry>({entries,mapEntries,@@ -35,6 +42,10 @@ export function useJourneyCarouselSync<E extends CarouselEntry>({const carouselRef = useRef<HTMLDivElement>(null);const cardRefs = useRef<Map<number, HTMLDivElement>>(new Map());const [activeIndex, setActiveIndex] = useState(0);+ // The card nearest the centre while a swipe is still moving: drawn larger at+ // once (a transform, so nothing reflows), while the active card and the map+ // only follow once the strip settles. Null when not swiping.+ const [liveIndex, setLiveIndex] = useState<number | null>(null);const scrubberDays = useMemo(() => journeyDays(entries), [entries]);@@ -57,9 +68,9 @@ export function useJourneyCarouselSync<E extends CarouselEntry>({// Pick the card closest to the horizontal centre. More stable than// IntersectionObserver thresholds when the active card can drift toward the// viewport edge with proximity snapping.- const pickNearestCard = useCallback(() => {+ const nearestCard = useCallback((): number | null => {const el = carouselRef.current;- if (!el) return;+ if (!el) return null;const center = el.getBoundingClientRect().left + el.clientWidth / 2;let bestIdx = 0;let bestDist = Infinity;@@ -79,11 +90,18 @@ export function useJourneyCarouselSync<E extends CarouselEntry>({const scrolled = Math.abs(el.scrollLeft);if (travel > 1 && scrolled >= travel - 1) bestIdx = cardRefs.current.size - 1;else if (travel > 1 && scrolled <= 0) bestIdx = 0;+ return bestIdx;+ }, []);++ const pickNearestCard = useCallback(() => {+ const bestIdx = nearestCard();+ if (bestIdx == null) return;+ setLiveIndex(null);setActiveIndex((prev) => {if (prev !== bestIdx) syncMapToCard(bestIdx);return bestIdx;});- }, [syncMapToCard]);+ }, [nearestCard, syncMapToCard]);// Defer every state update until scrolling settles: updating the active card// mid swipe resizes the cards and reflows the layout on every frame.@@ -91,9 +109,16 @@ export function useJourneyCarouselSync<E extends CarouselEntry>({const el = carouselRef.current;if (!el || entries.length === 0) return;let settleTimer: number | null = null;+ let frame: number | null = null;const onScroll = () => {+ if (frame == null) {+ frame = window.requestAnimationFrame(() => {+ frame = null;+ setLiveIndex(nearestCard());+ });+ }if (settleTimer != null) window.clearTimeout(settleTimer);- settleTimer = window.setTimeout(pickNearestCard, 150);+ settleTimer = window.setTimeout(pickNearestCard, SETTLE_MS);};// Where the browser says when the snap has landed, the card grows right then// instead of a beat later; the timer stays for the ones that do not.@@ -108,8 +133,9 @@ export function useJourneyCarouselSync<E extends CarouselEntry>({el.removeEventListener('scroll', onScroll);el.removeEventListener('scrollend', onScrollEnd);if (settleTimer != null) window.clearTimeout(settleTimer);+ if (frame != null) window.cancelAnimationFrame(frame);};- }, [entries.length, pickNearestCard]);+ }, [entries.length, pickNearestCard, nearestCard]);const scrollCardIntoCenter = useCallback((idx: number) => {cardRefs.current.get(idx)?.scrollIntoView({ behavior: 'smooth', inline: 'center', block: 'nearest' });@@ -168,6 +194,8 @@ export function useJourneyCarouselSync<E extends CarouselEntry>({carouselRef,cardRefs,activeIndex,+ /** The card to draw as the active one: the one at the centre while swiping, else the active card. */+ focusIndex: liveIndex ?? activeIndex,setActiveIndex,scrubberDays,syncMapToCard,diff --git a/client/src/mobile/screens/journey/MJourneyDetail.tsx b/client/src/mobile/screens/journey/MJourneyDetail.tsxindex ea346b810..c99515426 100644--- a/client/src/mobile/screens/journey/MJourneyDetail.tsx+++ b/client/src/mobile/screens/journey/MJourneyDetail.tsx@@ -102,7 +102,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD)const {- mapRef, carouselRef, cardRefs, activeIndex, setActiveIndex, scrubberDays,+ mapRef, carouselRef, cardRefs, activeIndex, focusIndex, setActiveIndex, scrubberDays,syncMapToCard, handleMarkerClick, handleCardTap, openEntryById, jumpToDay,} = useJourneyCarouselSync<JourneyEntry>({ entries, mapEntries: sidebarMapItems, onOpenEntry: setEditingEntry, syncMapOnTap: true })@@ -510,7 +510,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD<JourneyEntryCoverentry={entry}dayColor={dayColorOf(scrubberDays, entry.entry_date)}- isActive={i === activeIndex}+ isActive={i === focusIndex}onClick={() => handleCardTap(entry, i)}showMood={current.show_mood !== 0}showWeather={current.show_weather !== 0}diff --git a/client/src/native/widgetOnline.ts b/client/src/native/widgetOnline.tsindex 375cc62cf..0763511ee 100644--- a/client/src/native/widgetOnline.ts+++ b/client/src/native/widgetOnline.ts@@ -78,7 +78,8 @@ export async function packingDetail(const grams = b.total_weight_grams ?? inBag.reduce((sum, i) => sum + (i.weight_grams ?? 0) * (i.quantity ?? 1), 0);return {name: b.name,- color: HEX.test(b.color) ? b.color : '#4A7DDB',+ // Empty when the bag has no usable colour: the widget then uses its own blue.+ color: HEX.test(b.color) ? b.color : '',grams,...(b.weight_limit_grams ? { limit: b.weight_limit_grams } : {}),packed: inBag.filter((i) => i.checked).length,