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(ci): the carousel tests at the 90 ms settle, the search type, the hook back under its line limit
Maurice8f3a8bd6706b
diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.jsonindex 17f834070..e412118b1 100644--- a/client/scripts/eslint-baseline.json+++ b/client/scripts/eslint-baseline.json@@ -35,7 +35,7 @@},"tests": {"@typescript-eslint/no-explicit-any": 489,- "@typescript-eslint/no-non-null-assertion": 1913,+ "@typescript-eslint/no-non-null-assertion": 1912,"@typescript-eslint/no-misused-promises": 22,"@typescript-eslint/no-unused-vars": 51,"@typescript-eslint/no-floating-promises": 33,diff --git a/client/src/components/Journey/JourneyEntryCover.test.tsx b/client/src/components/Journey/JourneyEntryCover.test.tsxindex cbab5a8f3..9f4a98815 100644--- a/client/src/components/Journey/JourneyEntryCover.test.tsx+++ b/client/src/components/Journey/JourneyEntryCover.test.tsx@@ -88,8 +88,8 @@ describe('JourneyEntryCover', () => {rerender(<JourneyEntryCover entry={buildEntry()} dayColor="#6366f1" isActive onClick={() => {}} />)// Drawn larger, not laid out larger: the box stays, so nothing beside it moves.- expect(container.querySelector('button')!.className).toContain('scale-[1.18]')- expect(container.querySelector('button')!.className).toContain('w-[136px]')+ expect(container.querySelector('button')?.className).toContain('scale-[1.18]')+ expect(container.querySelector('button')?.className).toContain('w-[136px]')})it('FE-JRN-COVER-007: a shared journey serves its photos through the share token', () => {diff --git a/client/src/components/Journey/MobileMapTimeline.test.tsx b/client/src/components/Journey/MobileMapTimeline.test.tsxindex 6399907a7..03af2a111 100644--- a/client/src/components/Journey/MobileMapTimeline.test.tsx+++ b/client/src/components/Journey/MobileMapTimeline.test.tsx@@ -285,13 +285,14 @@ describe('MobileMapTimeline', () => {carousel.getBoundingClientRect = () => fakeRect(0, 300)cards.forEach((c, i) => { c.getBoundingClientRect = () => fakeRect(i === 2 ? 30 : -400, 240) })+ // The strip counts as landed 90 ms after its last scroll event.fireEvent.scroll(carousel)- act(() => { vi.advanceTimersByTime(100) })+ act(() => { vi.advanceTimersByTime(60) })fireEvent.scroll(carousel)- act(() => { vi.advanceTimersByTime(100) })+ act(() => { vi.advanceTimersByTime(60) })expect(lastMapProps.current.activeMarkerId).toBe('1')- act(() => { vi.advanceTimersByTime(100) })+ act(() => { vi.advanceTimersByTime(40) })expect(lastMapProps.current.activeMarkerId).toBe('3')} finally {vi.useRealTimers()diff --git a/client/src/components/Journey/useJourneyCarouselSync.test.ts b/client/src/components/Journey/useJourneyCarouselSync.test.tsindex 726abeabb..bf6e7e55c 100644--- a/client/src/components/Journey/useJourneyCarouselSync.test.ts+++ b/client/src/components/Journey/useJourneyCarouselSync.test.ts@@ -127,7 +127,7 @@ describe('useJourneyCarouselSync', () => {});carousel.dispatchEvent(new Event('scroll'));- act(() => vi.advanceTimersByTime(100));+ act(() => vi.advanceTimersByTime(60));carousel.dispatchEvent(new Event('scroll'));act(() => vi.advanceTimersByTime(89));expect(hook.result.current.activeIndex).toBe(0);diff --git a/client/src/components/Journey/useJourneyCarouselSync.ts b/client/src/components/Journey/useJourneyCarouselSync.tsindex 2668a3cca..78351a828 100644--- a/client/src/components/Journey/useJourneyCarouselSync.ts+++ b/client/src/components/Journey/useJourneyCarouselSync.ts@@ -20,11 +20,34 @@ export interface JourneyCarouselSyncOptions<E extends CarouselEntry> {}/**- * The card carousel over the journey map, behind both the phone journey screen and the- * narrow desktop and public timeline: the active card is the one nearest the centre- * once scrolling settles, and the map follows it; a marker, a day on the scrubber or a- * tap brings its card to the centre.+ * The card closest to the strip's horizontal centre. More stable than+ * IntersectionObserver thresholds when the active card can drift toward the+ * viewport edge with proximity snapping.*/+function nearestCardIndex(el: HTMLDivElement | null, cards: Map<number, HTMLDivElement>): number | null {+ if (!el) return null;+ const center = el.getBoundingClientRect().left + el.clientWidth / 2;+ let bestIdx = 0;+ let bestDist = Infinity;+ cards.forEach((node, idx) => {+ const r = node.getBoundingClientRect();+ const d = Math.abs(r.left + r.width / 2 - center);+ if (d < bestDist) {+ bestDist = d;+ bestIdx = idx;+ }+ });+ // The first and the last card can never reach the centre, so a carousel scrolled+ // as far as it goes means the card at that end: without this, opening on the+ // latest day settled on the one before it (#2851). Measured from the start in+ // either direction: in a right-to-left layout scrollLeft runs negative.+ const travel = el.scrollWidth - el.clientWidth;+ const scrolled = Math.abs(el.scrollLeft);+ if (travel > 1 && scrolled >= travel - 1) bestIdx = cards.size - 1;+ else if (travel > 1 && scrolled <= 0) bestIdx = 0;+ return bestIdx;+}+/*** 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@@ -32,6 +55,12 @@ export interface JourneyCarouselSyncOptions<E extends CarouselEntry> {*/const SETTLE_MS = 90;+/**+ * The card carousel over the journey map, behind both the phone journey screen and the+ * narrow desktop and public timeline: the active card is the one nearest the centre+ * once scrolling settles, and the map follows it; a marker, a day on the scrubber or a+ * tap brings its card to the centre.+ */export function useJourneyCarouselSync<E extends CarouselEntry>({entries,mapEntries,@@ -65,33 +94,7 @@ export function useJourneyCarouselSync<E extends CarouselEntry>({[entries, mapEntries]);- // 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 nearestCard = useCallback((): number | null => {- const el = carouselRef.current;- if (!el) return null;- const center = el.getBoundingClientRect().left + el.clientWidth / 2;- let bestIdx = 0;- let bestDist = Infinity;- cardRefs.current.forEach((node, idx) => {- const r = node.getBoundingClientRect();- const d = Math.abs(r.left + r.width / 2 - center);- if (d < bestDist) {- bestDist = d;- bestIdx = idx;- }- });- // The first and the last card can never reach the centre, so a carousel scrolled- // as far as it goes means the card at that end: without this, opening on the- // latest day settled on the one before it (#2851). Measured from the start in- // either direction: in a right-to-left layout scrollLeft runs negative.- const travel = el.scrollWidth - el.clientWidth;- 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 nearestCard = useCallback(() => nearestCardIndex(carouselRef.current, cardRefs.current), []);const pickNearestCard = useCallback(() => {const bestIdx = nearestCard();diff --git a/client/src/components/Journey/useJourneyEntryForm.test.ts b/client/src/components/Journey/useJourneyEntryForm.test.tsindex 6f5ae0840..8ce860c73 100644--- a/client/src/components/Journey/useJourneyEntryForm.test.ts+++ b/client/src/components/Journey/useJourneyEntryForm.test.ts@@ -281,6 +281,8 @@ describe('useJourneyEntryForm', () => {vi.useFakeTimers();const places = Array.from({ length: 8 }, (_, i) => ({ name: `P${i}`, lat: String(i), lng: '1' }));const search = vi.spyOn(mapsApi, 'search').mockResolvedValue({ places } as never);+ // No suggestions: the full search answers.+ vi.spyOn(mapsApi, 'autocomplete').mockResolvedValue({ suggestions: [], source: 'none' } as never);const { result } = setup();act(() => result.current.searchLocation('R'));expect(result.current.showLocationResults).toBe(true);diff --git a/client/src/components/Journey/useJourneyEntryForm.ts b/client/src/components/Journey/useJourneyEntryForm.tsindex a03af5447..ee78cd82d 100644--- a/client/src/components/Journey/useJourneyEntryForm.ts+++ b/client/src/components/Journey/useJourneyEntryForm.ts@@ -1,3 +1,4 @@+import type { MapsAutocompleteResult } from '@trek/shared';import type React from 'react';import { useEffect, useMemo, useRef, useState } from 'react';@@ -477,8 +478,8 @@ export function useJourneyEntryForm({controller.signal,placesSessionRef.current.current())- .then((r) => r.suggestions ?? [])- .catch(() => []);+ .then((r): MapsAutocompleteResult['suggestions'] => r.suggestions ?? [])+ .catch((): MapsAutocompleteResult['suggestions'] => []);if (seq !== locationSearchSeqRef.current) return;if (suggested.length > 0) {setLocationResults(diff --git a/client/src/native/widgetOnline.ts b/client/src/native/widgetOnline.tsindex e3f478410..21b3f875b 100644--- a/client/src/native/widgetOnline.ts+++ b/client/src/native/widgetOnline.ts@@ -9,7 +9,7 @@ import type { PackingItem } from '../types';* client/ios/App/TREKWidgets/WidgetSnapshot.swift reads the shapes.*/-export interface WidgetBag {+interface WidgetBag {name: string;color: string;grams: number;