Skip to content

armgit / TREK

Public Imported from GitHub
0

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.

Merge branch 'dev' into feat/comaps-integration

Konstantinos Thermos0e7c51627914
diff --cc client/src/components/Planner/DayPlanSidebar.test.tsx
index eb0d2d992,666b28a7f..088882147
--- a/client/src/components/Planner/DayPlanSidebar.test.tsx
+++ b/client/src/components/Planner/DayPlanSidebar.test.tsx
@@@ -184,14 -183,19 +184,20 @@@ beforeEach(() =>
// otherwise leak into the ones after them.
vi.mocked(calculateRouteWithLegs).mockImplementation(waypoints => Promise.resolve({
coordinates: [], distance: 0, duration: 0,
- legs: Array.from({ length: Math.max(0, (waypoints?.length ?? 0) - 1) }, () => ({
- mid: [0, 0] as [number, number], from: [0, 0] as [number, number], to: [0, 0] as [number, number],
- distance: 2000, duration: 600, distanceText: '2 km', durationText: '10 min',
- drivingText: '10 min', walkingText: '25 min',
- })),
+ // Each leg carries its endpoint coordinates (mirrors the real RouteCalculator), so
+ // connector-driven features that read seg.from/seg.to see faithful [lat, lng] pairs.
+ legs: Array.from({ length: Math.max(0, (waypoints?.length ?? 0) - 1) }, (_, i) => {
+ const a = waypoints[i], b = waypoints[i + 1]
+ return {
+ mid: [(a.lat + b.lat) / 2, (a.lng + b.lng) / 2] as [number, number],
+ from: [a.lat, a.lng] as [number, number], to: [b.lat, b.lng] as [number, number],
+ distance: 2000, duration: 600, distanceText: '2 km', durationText: '10 min',
+ drivingText: '10 min', walkingText: '25 min',
+ }
+ }),
}))
vi.mocked(generateGoogleMapsUrl).mockReturnValue('https://maps.google.com/...')
+ vi.mocked(generateCoMapsUrl).mockReturnValue('https://comaps.at/...')
sessionStorage.clear()
localStorage.clear()
// Cost totals fetch FX rates for their base currency; keep the suite hermetic.
diff --cc client/src/components/Planner/DayPlanSidebar.tsx
index b3460fad9,28b68ee31..3845ce953
--- a/client/src/components/Planner/DayPlanSidebar.tsx
+++ b/client/src/components/Planner/DayPlanSidebar.tsx
@@@ -4,9 -4,10 +4,10 @@@ declare global { interface Window { __d
import React, { useState, useEffect, useLayoutEffect, useRef, useMemo, useCallback } from 'react'
import { avatarSrc } from '../../utils/avatarSrc'
-import { ChevronDown, ChevronRight, ChevronUp, Navigation, RotateCcw, ExternalLink, Clock, Pencil, GripVertical, Ticket, Plus, FileText, Trash2, Car, Lock, Hotel, Footprints, Route as RouteIcon, Bookmark, TramFront, Zap } from 'lucide-react'
+import { ChevronDown, ChevronRight, ChevronUp, Compass, Navigation, RotateCcw, ExternalLink, Clock, Pencil, GripVertical, Ticket, Plus, FileText, Trash2, Car, Lock, Hotel, Footprints, Route as RouteIcon, Bookmark, TramFront, Zap } from 'lucide-react'
+ import { type PickedPlace } from './TransitSearchPanel'
import { assignmentsApi, reservationsApi, daysApi } from '../../api/client'
-import { calculateRouteWithLegs, optimizeRoute, generateGoogleMapsUrl } from '../Map/RouteCalculator'
+import { calculateRouteWithLegs, optimizeRoute, generateGoogleMapsUrl, generateCoMapsUrl, type NamedWaypoint } from '../Map/RouteCalculator'
import PlaceAvatar from '../shared/PlaceAvatar'
import ConfirmDialog from '../shared/ConfirmDialog'
import { useContextMenu, ContextMenu } from '../shared/ContextMenu'