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
feat(tours): stops that stand for places of the trip (PR1-10)
Maurice7a484a09d478
diff --git a/client/src/components/Tours/TourWorkspaceRail.tsx b/client/src/components/Tours/TourWorkspaceRail.tsxindex 25593cd61..f92bb99a2 100644--- a/client/src/components/Tours/TourWorkspaceRail.tsx+++ b/client/src/components/Tours/TourWorkspaceRail.tsx@@ -24,10 +24,13 @@ export default function TourWorkspaceRail({workspace,canEdit,canAssign,+ tourPlaceIds,}: {workspace: TourWorkspaceRailParts;canEdit: boolean;canAssign: boolean;+ /** The trip's tours, never offered as a stop of another tour (PR1-10). */+ tourPlaceIds?: ReadonlySet<number>;}) {const {tourPlanner,@@ -48,6 +51,7 @@ export default function TourWorkspaceRail({recordedTrack={recordedTrack}trackPaddlePlan={trackPaddlePlan}paddleChecklist={paddleChecklist}+ tourPlaceIds={tourPlaceIds}onOpenWanderer={wanderer.enabled ? wanderer.openBrowser : undefined}/>);diff --git a/client/src/components/Tours/planner/TourPlannerPanels.tsx b/client/src/components/Tours/planner/TourPlannerPanels.tsxindex e87e635ca..8065b88f2 100644--- a/client/src/components/Tours/planner/TourPlannerPanels.tsx+++ b/client/src/components/Tours/planner/TourPlannerPanels.tsx@@ -359,7 +359,7 @@ export function TourPlannerRail({ planner,onOpenWanderer,conversion,paddleChecklist,- recordedTrack, trackPaddlePlan, canEdit: editPermission, canAssign: assignPermission }: { planner: TourPlannerController+ recordedTrack, trackPaddlePlan, tourPlaceIds, canEdit: editPermission, canAssign: assignPermission }: { planner: TourPlannerController/** Planning an editable tour from the import in view. */conversion?: GpxConversion/** The way back to the recorded track of an import planned over in place. */@@ -370,6 +370,8 @@ export function TourPlannerRail({ planner,paddleChecklist?: PaddleChecklist/** Browse the user's wanderer trails instead; offered while nothing is being edited. */onOpenWanderer?: () => void+ /** The trip's tours, never offered as a stop of another tour (PR1-10). */+ tourPlaceIds?: ReadonlySet<number>} & TourPermissionProps) {const { canEdit } = useTourPermissions({ canEdit: editPermission ?? planner.canEdit, canAssign: assignPermission ?? planner.canAssign })const { t } = useTranslation()@@ -428,7 +430,7 @@ export function TourPlannerRail({ planner,{recordedTrack?.available && <RecordedTrackCard recordedTrack={recordedTrack} disabled={isSaving} />}- <TourWaypointList planner={planner} canEdit={canEdit} isSaving={isSaving} />+ <TourWaypointList planner={planner} canEdit={canEdit} isSaving={isSaving} tourPlaceIds={tourPlaceIds} /><PaddleEditorCards planner={planner} locked={locked} checklist={paddleChecklist} />diff --git a/client/src/components/Tours/planner/TourWaypointList.tsx b/client/src/components/Tours/planner/TourWaypointList.tsxindex 167734bd9..4343d40ab 100644--- a/client/src/components/Tours/planner/TourWaypointList.tsx+++ b/client/src/components/Tours/planner/TourWaypointList.tsx@@ -11,6 +11,7 @@ import {ArrowUp,GripVertical,MapPin,+ MapPinned,MapPinPlus,MoreHorizontal,Navigation,@@ -18,6 +19,7 @@ import {Repeat,Spline,Trash2,+ Unlink,Waves,} from 'lucide-react';import { Fragment, useState, type MouseEvent, type ReactNode } from 'react';@@ -47,11 +49,16 @@ import { RailCard } from '../tourParts';import { paddlePlanPoints, paddleRolesById } from './paddlePlanOf';import type { PaddleLegFailure } from './paddleRouting';import { lineLengthM } from './tourFixedLegs';+import { TripPlacePicker } from './TripPlacePicker';import type { TourPlannerController } from './useTourPlanner';+import { useTripPlaceWaypoints } from './useTripPlaceWaypoints';import { useWaypointPlaceNames } from './useWaypointPlaceNames';type DropTarget = { id: string; placement: 'before' | 'after' };+/** No tours known: every place with a spot is offered. */+const NO_TOUR_PLACES: ReadonlySet<number> = new Set();+const ROLE_KEY = {start: 'tours.planner.start',via: 'tours.planner.via',@@ -289,12 +296,15 @@ function WaypointRowLabel({placeName,loopEnd,paddleRole,+ linked = false,}: {point: TourPlannerController['waypoints'][number];placeName: string | undefined;loopEnd: boolean;/** On a paddle tour the badge names the point for the paddler: put-in, take-out, re-entry, final take-out. */paddleRole?: PaddleRole | null;+ /** PR1-10: the point stands for this place of the trip, named after it. */+ linked?: boolean;}) {const { t } = useTranslation();const coordinates = `${point.lat.toFixed(5)}, ${point.lng.toFixed(5)}`;@@ -322,14 +332,29 @@ function WaypointRowLabel({)}{point.auto && <AutoPointPill />}</span>- {name && !loopEnd && (- <span- data-testid="tour-planner-waypoint-coordinates"- className="block min-w-0 truncate font-geist tabular-nums leading-tight text-content-faint"- style={fs(10.5)}- >- {coordinates}- </span>+ {linked && !loopEnd ? (+ // A stop standing for a place of the trip says so where the coordinates would be (PR1-10).+ <Tooltip label={t('tours.placePicker.linkedHint')}>+ <span+ data-testid="tour-planner-waypoint-linked"+ className="flex min-w-0 items-center gap-1 leading-tight text-content-faint"+ style={fs(10.5)}+ >+ <MapPinned size={10} strokeWidth={2.2} className="flex-none" />+ <span className="min-w-0 truncate">{t('tours.placePicker.linked')}</span>+ </span>+ </Tooltip>+ ) : (+ name &&+ !loopEnd && (+ <span+ data-testid="tour-planner-waypoint-coordinates"+ className="block min-w-0 truncate font-geist tabular-nums leading-tight text-content-faint"+ style={fs(10.5)}+ >+ {coordinates}+ </span>+ ))}</>);@@ -425,6 +450,7 @@ function WaypointRowActions({lastIndex,selected,isSaving,+ onUnlink,}: {planner: TourPlannerController;point: WaypointPoint;@@ -432,6 +458,8 @@ function WaypointRowActions({lastIndex: number;selected: boolean;isSaving: boolean;+ /** PR1-10: given for a point that stands for a place; the place itself stays. */+ onUnlink?: () => void;}) {const { t } = useTranslation();const menu = useContextMenu();@@ -451,6 +479,9 @@ function WaypointRowActions({},...routeMenuItems(planner, point, index, lastIndex, t),...(planner.isPaddle ? paddleMenuItems(paddle, point, index < lastIndex, t) : []),+ ...(onUnlink+ ? [{ divider: true } as const, { label: t('tours.placePicker.unlink'), icon: Unlink, onClick: onUnlink }]+ : []),];return (<span@@ -530,22 +561,49 @@ function PaddleRowExtras({* planner shows, the same switch as the one in the map's layer pill; while it* is on, the row says where to click and a second click turns it off again.*/-function AddPointRow({ disabled }: { disabled: boolean }) {+function AddPointRow({+ disabled,+ placesOpen,+ onTogglePlaces,+}: {+ disabled: boolean;+ /** PR1-10: whether the trip's places are unfolded to pick a stop from. */+ placesOpen: boolean;+ onTogglePlaces: () => void;+}) {const { t } = useTranslation();const active = useTourPlaceToolStore((state) => state.placing[state.mode]);+ const look = (on: boolean) =>+ `flex min-w-0 items-center justify-center gap-1.5 rounded-[12px] border border-dashed px-3 py-2.5 font-semibold transition-colors disabled:cursor-default disabled:opacity-40 ${on ? 'border-accent bg-surface-card text-content' : 'border-edge text-content-muted enabled:hover:border-content-faint enabled:hover:text-content'}`;return (- <button- type="button"- data-testid="tour-planner-add-point"- aria-pressed={active}- disabled={disabled}- onClick={() => toggleTourPlacing()}- className={`mt-1.5 flex w-full items-center justify-center gap-1.5 rounded-[12px] border border-dashed px-3 py-2.5 font-semibold transition-colors disabled:cursor-default disabled:opacity-40 ${active ? 'border-accent bg-surface-card text-content' : 'border-edge text-content-muted enabled:hover:border-content-faint enabled:hover:text-content'}`}- style={fs(12, 'body')}- >- <MapPinPlus size={14} strokeWidth={2} className="flex-none" />- <span className="min-w-0 truncate">{t(active ? 'tours.planner.addPointActive' : 'tours.planner.addPoint')}</span>- </button>+ <div className="mt-1.5 grid grid-cols-[minmax(0,1fr)_auto] gap-1.5">+ <button+ type="button"+ data-testid="tour-planner-add-point"+ aria-pressed={active}+ disabled={disabled}+ onClick={() => toggleTourPlacing()}+ className={look(active)}+ style={fs(12, 'body')}+ >+ <MapPinPlus size={14} strokeWidth={2} className="flex-none" />+ <span className="min-w-0 truncate">+ {t(active ? 'tours.planner.addPointActive' : 'tours.planner.addPoint')}+ </span>+ </button>+ <button+ type="button"+ data-testid="tour-planner-add-place"+ aria-expanded={placesOpen}+ disabled={disabled}+ onClick={onTogglePlaces}+ className={look(placesOpen)}+ style={fs(12, 'body')}+ >+ <MapPinned size={14} strokeWidth={2} className="flex-none" />+ <span className="min-w-0 truncate">{t('tours.placePicker.open')}</span>+ </button>+ </div>);}@@ -706,12 +764,23 @@ export default function TourWaypointList({planner,canEdit,isSaving,+ tourPlaceIds = NO_TOUR_PLACES,}: {planner: TourPlannerController;canEdit: boolean;isSaving: boolean;+ /** The trip's tours, which are never offered as a stop (PR1-10). */+ tourPlaceIds?: ReadonlySet<number>;}) {const { t } = useTranslation();+ const tripPlaces = useTripPlaceWaypoints(planner, tourPlaceIds);+ const [placesOpen, setPlacesOpen] = useState(false);+ const addRows = canEdit && (+ <>+ <AddPointRow disabled={isSaving} placesOpen={placesOpen} onTogglePlaces={() => setPlacesOpen((open) => !open)} />+ {placesOpen && !isSaving && <TripPlacePicker picker={tripPlaces} onClose={() => setPlacesOpen(false)} />}+ </>+ );const [draggedWaypointId, setDraggedWaypointId] = useState<string | null>(null);const [dropTarget, setDropTarget] = useState<DropTarget | null>(null);const placeNames = useWaypointPlaceNames(planner.waypoints);@@ -767,7 +836,7 @@ export default function TourWaypointList({return card(<><WaypointEmptyState />- {canEdit && <AddPointRow disabled={isSaving} />}+ {addRows}</>);}@@ -779,6 +848,7 @@ export default function TourWaypointList({const selected = planner.selectedWaypointId === point.id;const isDropTarget = dropTarget?.id === point.id && draggedWaypointId !== point.id;const loopEnd = planner.isLoop && index === lastIndex;+ const linkedPlace = tripPlaces.linkedPlaceOf(point);return (<Fragment key={point.id}><li@@ -849,9 +919,10 @@ export default function TourWaypointList({><WaypointRowLabelpoint={point}- placeName={placeNames[point.id]}+ placeName={linkedPlace?.name ?? placeNames[point.id]}loopEnd={loopEnd}paddleRole={paddleRoleOf(point.id)}+ linked={!!linkedPlace}/></button>{canEdit && (@@ -862,6 +933,7 @@ export default function TourWaypointList({lastIndex={lastIndex}selected={selected}isSaving={isSaving}+ onUnlink={point.linkedPlaceId ? () => tripPlaces.unlink(point.id) : undefined}/>)}</div>@@ -881,7 +953,7 @@ export default function TourWaypointList({);})}</ol>- {canEdit && <AddPointRow disabled={isSaving} />}+ {addRows}<ShapeOnLineHint planner={planner} canEdit={canEdit} /></>);diff --git a/client/src/components/Tours/planner/TripPlacePicker.tsx b/client/src/components/Tours/planner/TripPlacePicker.tsxnew file mode 100644index 000000000..9d6c4648e--- /dev/null+++ b/client/src/components/Tours/planner/TripPlacePicker.tsx@@ -0,0 +1,176 @@+import { Check, MapPinned, Search, X } from 'lucide-react';+import { useId, useMemo, useState } from 'react';+import { useTranslation } from '../../../i18n';+import { useSettingsStore } from '../../../store/settingsStore';+import { formatDistance } from '../../../utils/units';+import { SoftPill } from '../../Planner/planParts';+import { fs } from '../../shared/DialogShell';+import PlaceAvatar from '../../shared/PlaceAvatar';+import { NEAR_TOUR_M, type TripPlaceCandidate, type TripPlaceWaypoints } from './useTripPlaceWaypoints';++/** How a distance from the tour reads: metres up close, kilometres beyond. */+function distanceLabel(metres: number, unit: 'metric' | 'imperial'): string {+ return formatDistance(metres / 1000, unit);+}++function CandidateRow({+ candidate,+ onPick,+ unit,+}: {+ candidate: TripPlaceCandidate;+ onPick: () => void;+ unit: 'metric' | 'imperial';+}) {+ const { t } = useTranslation();+ const { place, category, distanceM, used } = candidate;+ return (+ <li>+ <button+ type="button"+ onClick={onPick}+ disabled={used}+ data-testid="trip-place-candidate"+ className="flex w-full items-center gap-2.5 rounded-[10px] px-2 py-1.5 text-start transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent enabled:hover:bg-surface-hover disabled:cursor-default"+ >+ <PlaceAvatar place={place} category={category} size={28} />+ <span className="flex min-w-0 flex-1 flex-col">+ <span+ className={`min-w-0 truncate font-semibold ${used ? 'text-content-muted' : 'text-content'}`}+ style={fs(12.5, 'body')}+ >+ {place.name}+ </span>+ {category && (+ <span className="min-w-0 truncate text-content-faint" style={fs(10.5, 'body')}>+ {category.name}+ </span>+ )}+ </span>+ {used ? (+ <SoftPill icon={<Check size={10} strokeWidth={2.4} className="flex-none" />}>+ {t('tours.placePicker.inTour')}+ </SoftPill>+ ) : (+ distanceM != null && <SoftPill className="tabular-nums">{distanceLabel(distanceM, unit)}</SoftPill>+ )}+ </button>+ </li>+ );+}++function CandidateGroup({+ title,+ candidates,+ picker,+ unit,+}: {+ title: string;+ candidates: TripPlaceCandidate[];+ picker: TripPlaceWaypoints;+ unit: 'metric' | 'imperial';+}) {+ if (candidates.length === 0) return null;+ return (+ <section>+ <h4+ className="m-0 px-2 pb-1 pt-2 font-semibold uppercase tracking-[0.06em] text-content-faint"+ style={fs(9.5, 'caption')}+ >+ {title}+ </h4>+ <ul className="m-0 flex list-none flex-col gap-px p-0">+ {candidates.map((candidate) => (+ <CandidateRow+ key={candidate.place.id}+ candidate={candidate}+ unit={unit}+ onPick={() => picker.add(candidate.place)}+ />+ ))}+ </ul>+ </section>+ );+}++/**+ * PR1-10: the trip's places to make stops of the tour, unfolded under the+ * waypoints. Searchable, nearest to the tour first and in two groups (near the+ * tour, the rest of the trip); a place a point already stands for says so and+ * is not offered twice. A pick adds the stop and leaves the list open, so a+ * day's huts and lakes go in one after the other.+ */+export function TripPlacePicker({ picker, onClose }: { picker: TripPlaceWaypoints; onClose: () => void }) {+ const { t } = useTranslation();+ const unit = useSettingsStore((state) => state.settings.distance_unit) ?? 'metric';+ const [query, setQuery] = useState('');+ const searchId = useId();+ const matches = useMemo(() => {+ const needle = query.trim().toLocaleLowerCase();+ if (!needle) return picker.candidates;+ return picker.candidates.filter(({ place, category }) =>+ `${place.name} ${category?.name ?? ''} ${place.address ?? ''}`.toLocaleLowerCase().includes(needle)+ );+ }, [picker.candidates, query]);+ const near = matches.filter((candidate) => candidate.distanceM != null && candidate.distanceM <= NEAR_TOUR_M);+ const further = matches.filter((candidate) => !near.includes(candidate));++ return (+ <div+ data-testid="trip-place-picker"+ className="mt-1.5 overflow-hidden rounded-[12px] bg-surface-card shadow-sm ring-1 ring-inset ring-edge-faint"+ onKeyDown={(event) => {+ if (event.key === 'Escape') {+ event.stopPropagation();+ onClose();+ }+ }}+ >+ <div className="flex items-center gap-2 border-b border-edge-faint px-2.5 py-2">+ <Search size={13} strokeWidth={2.2} className="flex-none text-content-faint" />+ <label htmlFor={searchId} className="sr-only">+ {t('tours.placePicker.search')}+ </label>+ <input+ id={searchId}+ autoFocus+ value={query}+ onChange={(event) => setQuery(event.target.value)}+ placeholder={t('tours.placePicker.search')}+ className="min-w-0 flex-1 border-0 bg-transparent text-content outline-none placeholder:text-content-faint"+ style={fs(12.5, 'body')}+ />+ <button+ type="button"+ onClick={onClose}+ aria-label={t('common.close')}+ className="grid h-6 w-6 flex-none place-items-center rounded-full text-content-faint transition-colors hover:bg-surface-hover hover:text-content"+ >+ <X size={13} strokeWidth={2.2} />+ </button>+ </div>+ <div className="max-h-[280px] overflow-y-auto overscroll-contain p-1">+ {picker.candidates.length === 0 ? (+ <p className="m-0 flex items-start gap-2 px-2 py-3 text-content-muted" style={fs(12, 'body')}>+ <MapPinned size={14} strokeWidth={2} className="mt-0.5 flex-none text-content-faint" />+ {t('tours.placePicker.empty')}+ </p>+ ) : matches.length === 0 ? (+ <p className="m-0 px-2 py-3 text-content-muted" style={fs(12, 'body')}>+ {t('tours.placePicker.noMatch')}+ </p>+ ) : (+ <>+ <CandidateGroup title={t('tours.placePicker.near')} candidates={near} picker={picker} unit={unit} />+ <CandidateGroup+ title={near.length > 0 ? t('tours.placePicker.further') : t('tours.placePicker.all')}+ candidates={further}+ picker={picker}+ unit={unit}+ />+ </>+ )}+ </div>+ </div>+ );+}diff --git a/client/src/components/Tours/planner/tourPlannerWaypoints.ts b/client/src/components/Tours/planner/tourPlannerWaypoints.tsindex a83f7f1dc..a6dc6442f 100644--- a/client/src/components/Tours/planner/tourPlannerWaypoints.ts+++ b/client/src/components/Tours/planner/tourPlannerWaypoints.ts@@ -19,6 +19,8 @@ export interface TourPlannerWaypoint {auto?: AutoBase;/** PAD-03: at the last point, the boat is carried on to the next point once it is set; never saved. */carryNext?: boolean;+ /** PR1-10: the place of the trip this point stands for, chosen on purpose; the point keeps its own spot. */+ linkedPlaceId?: number;}/** A saved tour's waypoints as the editor holds them, each under a fresh id. */@@ -31,6 +33,7 @@ export function plannerWaypointsOf(saved: readonly TourWaypoint[], newId: () =>...(point.fixed_leg ? { fixedLeg: point.fixed_leg } : {}),...(point.lock ? { lock: point.lock } : {}),...(point.shaping ? { shaping: true } : {}),+ ...(point.linked_place_id ? { linkedPlaceId: point.linked_place_id } : {}),}));}@@ -48,9 +51,17 @@ export function savedWaypointsOf(points: readonly TourPlannerWaypoint[]): TourWa...(point.fixedLeg ? { fixed_leg: point.fixedLeg } : {}),...(point.lock ? { lock: point.lock } : {}),...(point.shaping ? { shaping: true } : {}),+ ...(point.linkedPlaceId ? { linked_place_id: point.linkedPlaceId } : {}),}));}+/** PR1-10: the point no longer standing for a place; moved away from it, it is a point of its own. */+export function unlinkedPoint<T extends TourPlannerWaypoint>(point: T): T {+ if (!point.linkedPlaceId) return point;+ const { linkedPlaceId: _place, ...free } = point;+ return free as T;+}+/** Roles from the order; free legs follow their points, and a paddle tour keeps its portages and locks. */export function normalizePlannerWaypoints(points: TourPlannerWaypoint[], paddle = false): TourPlannerWaypoint[] {return keepJoinedFixedLegs(alignFreeLegs(points, paddle)).map((point, index) => ({@@ -74,7 +85,10 @@ export function tourWaypointKey(points: TourPlannerWaypoint[]): string {.join('|');}-/** The line, and what a paddler planned along it that draws no line: a portage's time, a lock, a point the router set. */+/**+ * The line, and what was planned along it that draws no line: a portage's+ * time, a lock, a point the router set, the place a point stands for.+ */export function sameWaypointSnapshot(a: TourPlannerWaypoint[], b: TourPlannerWaypoint[]): boolean {const extras = (points: TourPlannerWaypoint[]) =>JSON.stringify(@@ -83,6 +97,7 @@ export function sameWaypointSnapshot(a: TourPlannerWaypoint[], b: TourPlannerWaypoint.lock ?? null,!!point.auto,!!point.carryNext,+ point.linkedPlaceId ?? null,]));return tourWaypointKey(a) === tourWaypointKey(b) && extras(a) === extras(b);diff --git a/client/src/components/Tours/planner/tourRouteActions.ts b/client/src/components/Tours/planner/tourRouteActions.tsindex 4419dab19..1cb1b3e46 100644--- a/client/src/components/Tours/planner/tourRouteActions.ts+++ b/client/src/components/Tours/planner/tourRouteActions.ts@@ -40,6 +40,18 @@ export function isClosedLoop(points: readonly { lat: number; lng: number }[]): breturn points.length >= 3 && !!first && !!last && sameSpot(first, last);}+/**+ * A new point at the end of the tour; a loop keeps returning to its start,+ * so there the point goes in before the way back.+ */+export function withPointAppended<T extends { lat: number; lng: number; role: string }>(+ points: readonly T[],+ point: T+): T[] {+ if (!isClosedLoop(points)) return [...points, { ...point, role: 'end' }];+ return [...points.slice(0, -1), { ...point, role: 'via' }, points[points.length - 1]];+}+/*** The tour taken back from its last point to its start: one end point on the* start's spot, not a second copy of the start among the stops. `newId` namesdiff --git a/client/src/components/Tours/planner/tripPlaces.test.tsx b/client/src/components/Tours/planner/tripPlaces.test.tsxnew file mode 100644index 000000000..af2a4df34--- /dev/null+++ b/client/src/components/Tours/planner/tripPlaces.test.tsx@@ -0,0 +1,131 @@+import { act, fireEvent, render, renderHook, screen } from '@testing-library/react';+import { beforeEach, describe, expect, it, vi } from 'vitest';+import { buildCategory, buildPlace } from '../../../../tests/helpers/factories';+import { resetAllStores, seedStore } from '../../../../tests/helpers/store';+import { useTripStore } from '../../../store/tripStore';+import {+ plannerWaypointsOf,+ sameWaypointSnapshot,+ savedWaypointsOf,+ unlinkedPoint,+ type TourPlannerWaypoint,+} from './tourPlannerWaypoints';+import { withPointAppended } from './tourRouteActions';+import { TripPlacePicker } from './TripPlacePicker';+import type { TourPlannerController } from './useTourPlanner';+import { useTripPlaceWaypoints } from './useTripPlaceWaypoints';++const hut = buildPlace({ id: 11, name: 'Höllentalangerhütte', lat: 47.425, lng: 11.03, category_id: 3 });+const lake = buildPlace({ id: 12, name: 'Eibsee', lat: 47.457, lng: 10.97, category_id: null });+const unplaced = buildPlace({ id: 13, name: 'Somewhere', lat: null, lng: null });+const tour = buildPlace({ id: 14, name: 'Another tour', lat: 47.42, lng: 11.02 });++const start: TourPlannerWaypoint = { id: 'a', lat: 47.42, lng: 11.02, role: 'start' };+const end: TourPlannerWaypoint = { id: 'b', lat: 47.43, lng: 11.04, role: 'end' };++function plannerWith(points: TourPlannerWaypoint[]) {+ let current = points;+ const planner = {+ waypoints: points,+ route: null,+ editWaypoints: vi.fn((change: (list: TourPlannerWaypoint[]) => TourPlannerWaypoint[]) => {+ current = change(current);+ }),+ setSelectedWaypointId: vi.fn(),+ } as unknown as TourPlannerController;+ return { planner, points: () => current };+}++beforeEach(() => {+ resetAllStores();+ seedStore(useTripStore, { places: [hut, lake, unplaced, tour], categories: [buildCategory({ id: 3, name: 'Hut' })] });+});++describe('waypoints that stand for a place (PR1-10)', () => {+ it('carry the place through saving and opening, and lose it once moved', () => {+ const linked = { ...end, linkedPlaceId: 11 };+ const saved = savedWaypointsOf([start, linked]);+ expect(saved[1]).toMatchObject({ linked_place_id: 11 });+ expect(saved[0]).not.toHaveProperty('linked_place_id');+ expect(plannerWaypointsOf(saved, () => 'x')[1]).toMatchObject({ linkedPlaceId: 11 });+ expect(unlinkedPoint(linked)).not.toHaveProperty('linkedPlaceId');+ expect(unlinkedPoint(start)).toBe(start);+ // Linking or unlinking alone is a change of the tour.+ expect(sameWaypointSnapshot([start, end], [start, linked])).toBe(false);+ });++ it('a new point goes at the end, or before the way back of a loop', () => {+ const point = { id: 'c', lat: 1, lng: 1, role: 'end' as const };+ expect(withPointAppended([start, end], point).map((p) => [p.id, p.role])).toEqual([+ ['a', 'start'],+ ['b', 'end'],+ ['c', 'end'],+ ]);+ const loop = [start, end, { ...start, id: 'back', role: 'end' as const }];+ expect(withPointAppended(loop, point).map((p) => p.id)).toEqual(['a', 'b', 'c', 'back']);+ });+});++describe('useTripPlaceWaypoints (PR1-10)', () => {+ it('offers places with a spot and no tour, nearest to the tour first, and knows the ones in use', () => {+ const { planner } = plannerWith([start, { ...end, linkedPlaceId: 12 }]);+ const { result } = renderHook(() => useTripPlaceWaypoints(planner, new Set([14])));+ expect(result.current.candidates.map((c) => c.place.id)).toEqual([11, 12]);+ expect(result.current.candidates[0]).toMatchObject({ used: false, category: { name: 'Hut' } });+ expect(result.current.candidates[0].distanceM).toBeLessThan(1_000);+ expect(result.current.candidates[1].used).toBe(true);+ expect(result.current.linkedPlaceOf({ linkedPlaceId: 12 })?.name).toBe('Eibsee');+ expect(result.current.linkedPlaceOf({ linkedPlaceId: 99 })).toBeNull();+ expect(result.current.linkedPlaceOf({})).toBeNull();+ });++ it('adds a stop on the place, as one step, and unlinks it without touching the place', () => {+ const { planner, points } = plannerWith([start, end]);+ const { result } = renderHook(() => useTripPlaceWaypoints(planner, new Set()));+ act(() => result.current.add(hut));+ expect(points()[2]).toMatchObject({ lat: 47.425, lng: 11.03, linkedPlaceId: 11, role: 'end' });+ expect(planner.setSelectedWaypointId).toHaveBeenCalledWith(points()[2].id);+ act(() => result.current.unlink(points()[2].id));+ expect(points()[2]).not.toHaveProperty('linkedPlaceId');+ expect(useTripStore.getState().places).toContain(hut);+ act(() => result.current.add(unplaced));+ expect(points()).toHaveLength(3);+ });++ it('measures from the points while the tour has no route, and from nothing while it has none', () => {+ const empty = plannerWith([]);+ const { result } = renderHook(() => useTripPlaceWaypoints(empty.planner, new Set()));+ expect(result.current.candidates.every((c) => c.distanceM === null)).toBe(true);+ const single = plannerWith([start]);+ const one = renderHook(() => useTripPlaceWaypoints(single.planner, new Set()));+ expect(one.result.current.candidates[0].distanceM).not.toBeNull();+ });+});++describe('TripPlacePicker (PR1-10)', () => {+ function renderPicker(points: TourPlannerWaypoint[]) {+ const { planner } = plannerWith(points);+ const picker = renderHook(() => useTripPlaceWaypoints(planner, new Set([14]))).result.current;+ const onClose = vi.fn();+ render(<TripPlacePicker picker={{ ...picker, add: vi.fn() }} onClose={onClose} />);+ return { onClose };+ }++ it('groups the places near the tour apart, searches them, and closes on Escape', () => {+ const { onClose } = renderPicker([start, end]);+ expect(screen.getByText('tours.placePicker.near')).toBeInTheDocument();+ expect(screen.getAllByTestId('trip-place-candidate')).toHaveLength(2);+ fireEvent.change(screen.getByPlaceholderText('tours.placePicker.search'), { target: { value: 'eib' } });+ expect(screen.getAllByTestId('trip-place-candidate')).toHaveLength(1);+ fireEvent.change(screen.getByPlaceholderText('tours.placePicker.search'), { target: { value: 'zzz' } });+ expect(screen.getByText('tours.placePicker.noMatch')).toBeInTheDocument();+ fireEvent.keyDown(screen.getByTestId('trip-place-picker'), { key: 'Escape' });+ expect(onClose).toHaveBeenCalled();+ });++ it('says so when the trip has no place to offer', () => {+ seedStore(useTripStore, { places: [unplaced] });+ renderPicker([]);+ expect(screen.getByText('tours.placePicker.empty')).toBeInTheDocument();+ });+});diff --git a/client/src/components/Tours/planner/useTourPlanner.ts b/client/src/components/Tours/planner/useTourPlanner.tsindex cb3b11850..8c638e4a0 100644--- a/client/src/components/Tours/planner/useTourPlanner.ts+++ b/client/src/components/Tours/planner/useTourPlanner.ts@@ -5,8 +5,8 @@ import { tourRepo } from '../../../repo/tourRepo'import { randomId } from '../../../utils/randomId'import { analyzeRouteGeometry, type RouteProfileFocus } from '../../../utils/routeGeometry'import { enrichTourElevations, routeWalkingTour, type TourElevationPoint, type TourRoutePart } from './tourRouting'-import { closeLoop, isClosedLoop, reverseRoute, toggleFreeLeg } from './tourRouteActions'-import { normalizePlannerWaypoints, plannerWaypointsOf, sameWaypointSnapshot, savedWaypointsOf, tourWaypointKey, type TourPlannerWaypoint } from './tourPlannerWaypoints'+import { closeLoop, isClosedLoop, reverseRoute, toggleFreeLeg, withPointAppended } from './tourRouteActions'+import { normalizePlannerWaypoints, plannerWaypointsOf, sameWaypointSnapshot, savedWaypointsOf, tourWaypointKey, unlinkedPoint, type TourPlannerWaypoint } from './tourPlannerWaypoints'import { tourPlannerFacts } from './tourPlannerFacts'import { usePlannerHistory } from './usePlannerHistory'import { useTourDraftStorage } from './useTourDraftStorage'@@ -254,10 +254,7 @@ export function useTourPlanner({ tripId, active = true, onSaved, canEdit: editPeconst addWaypoint = useCallback((lat: number, lng: number) => {if (!editPermissionRef.current) returnconst id = randomId()- // A loop keeps returning to its start: the new point goes in before the way back.- commitWaypoints(current => isClosedLoop(current)- ? [...current.slice(0, -1), { id, lat, lng, role: 'via' }, current[current.length - 1]]- : [...current, { id, lat, lng, role: 'end' }])+ commitWaypoints(current => withPointAppended<TourPlannerWaypoint>(current, { id, lat, lng, role: 'end' }))setSelectedWaypointId(id)}, [commitWaypoints])@@ -290,7 +287,8 @@ export function useTourPlanner({ tripId, active = true, onSaved, canEdit: editPeconst loopEnds = isClosedLoop(points) && (id === points[0].id || id === points[points.length - 1].id)? new Set([points[0].id, points[points.length - 1].id]): new Set([id])- commitWaypoints(list => list.map(point => loopEnds.has(point.id) ? { ...point, lat, lng } : point))+ // A point moved stands for no place any more (PR1-10): it is where the hand put it.+ commitWaypoints(list => list.map(point => loopEnds.has(point.id) ? unlinkedPoint({ ...point, lat, lng }) : point))return true}, [commitWaypoints])@@ -908,7 +906,7 @@ export function useTourPlanner({ tripId, active = true, onSaved, canEdit: editPebreakAdditionalMinutes, setBreakAdditionalMinutes, breakAdditionalInvalid,walkingDurationMinutes, plannedTotalMinutes, plannedTotalInvalid,waypoints, selectedWaypointId, setSelectedWaypointId,- addWaypoint, appendFixedLeg, setWaypointPosition, removeWaypoint, moveWaypoint, reorderWaypoint,+ addWaypoint, appendFixedLeg, setWaypointPosition, removeWaypoint, moveWaypoint, reorderWaypoint, editWaypoints: commitWaypoints,reverse, returnToStart, isLoop: isClosedLoop(waypoints), toggleWaypointFreeLeg, editPaddlePoints, amendWaypoints, paddleEstimate,...shaping, paddleRoute, routeCurrent: routeForKey === waypointKey,undo, redo, canUndo: history.canUndo, canRedo: history.canRedo,diff --git a/client/src/components/Tours/planner/useTripPlaceWaypoints.ts b/client/src/components/Tours/planner/useTripPlaceWaypoints.tsnew file mode 100644index 000000000..f78f2c504--- /dev/null+++ b/client/src/components/Tours/planner/useTripPlaceWaypoints.ts@@ -0,0 +1,100 @@+import { nearnessToLine } from '@trek/shared';+import { useCallback, useMemo } from 'react';+import { useTripStore } from '../../../store/tripStore';+import type { Category, Place } from '../../../types';+import { randomId } from '../../../utils/randomId';+import { unlinkedPoint, type TourPlannerWaypoint } from './tourPlannerWaypoints';+import { withPointAppended } from './tourRouteActions';+import type { TourPlannerController } from './useTourPlanner';++/** A place of the trip as the picker offers it. */+export interface TripPlaceCandidate {+ place: Place;+ category: Category | null;+ /** Metres from the tour as it stands (its route, else its points); null while the tour has no point. */+ distanceM: number | null;+ /** A point of the tour stands for it already. */+ used: boolean;+}++const NO_PLACES: Place[] = [];+const NO_CATEGORIES: Category[] = [];++/** Within this distance of the tour a place counts as near it, and the picker says so. */+export const NEAR_TOUR_M = 2_000;++/** The line a place is measured against: the route while there is one, else the points as set. */+function tourLine(planner: Pick<TourPlannerController, 'route' | 'waypoints'>): Array<[number, number]> {+ if (planner.route && planner.route.length >= 2) return planner.route;+ return planner.waypoints.map((point): [number, number] => [point.lat, point.lng]);+}++function distanceFrom(place: Place, line: Array<[number, number]>): number | null {+ if (line.length === 0 || place.lat == null || place.lng == null) return null;+ if (line.length === 1)+ return nearnessToLine(place as { lat: number; lng: number }, [line[0], line[0]])?.distanceM ?? null;+ return nearnessToLine(place as { lat: number; lng: number }, line)?.distanceM ?? null;+}++/**+ * PR1-10: the trip's places as stops of a tour, chosen on purpose. A place is+ * offered once it has a spot and is no tour itself, nearest to the tour first;+ * picking one adds a point on its spot that stands for it, as one step of the+ * history. The point keeps its own coordinates from then on, the place stays a+ * place of its own, and its days are left alone. Removing or unlinking the+ * point never touches the place.+ */+export function useTripPlaceWaypoints(planner: TourPlannerController, tourPlaceIds: ReadonlySet<number>) {+ const places = useTripStore((state) => state.places) ?? NO_PLACES;+ const categories = useTripStore((state) => state.categories) ?? NO_CATEGORIES;+ const { editWaypoints, setSelectedWaypointId, waypoints, route } = planner;++ const placesById = useMemo(() => new Map(places.map((place) => [place.id, place])), [places]);++ const candidates = useMemo((): TripPlaceCandidate[] => {+ const line = tourLine({ route, waypoints });+ const used = new Set(waypoints.flatMap((point) => (point.linkedPlaceId ? [point.linkedPlaceId] : [])));+ const categoryOf = new Map(categories.map((category) => [category.id, category]));+ return places+ .filter((place) => place.lat != null && place.lng != null && !tourPlaceIds.has(place.id))+ .map((place) => ({+ place,+ category: place.category_id != null ? (categoryOf.get(place.category_id) ?? null) : null,+ distanceM: distanceFrom(place, line),+ used: used.has(place.id),+ }))+ .sort(+ (a, b) =>+ (a.distanceM ?? Number.POSITIVE_INFINITY) - (b.distanceM ?? Number.POSITIVE_INFINITY) ||+ a.place.name.localeCompare(b.place.name)+ );+ }, [categories, places, route, tourPlaceIds, waypoints]);++ const add = useCallback(+ (place: Place) => {+ if (place.lat == null || place.lng == null) return;+ const id = randomId();+ const point: TourPlannerWaypoint = { id, lat: place.lat, lng: place.lng, role: 'end', linkedPlaceId: place.id };+ editWaypoints((current) => withPointAppended(current, point));+ setSelectedWaypointId(id);+ },+ [editWaypoints, setSelectedWaypointId]+ );++ const unlink = useCallback(+ (pointId: string) =>+ editWaypoints((current) => current.map((point) => (point.id === pointId ? unlinkedPoint(point) : point))),+ [editWaypoints]+ );++ /** The place a point stands for while the trip still has it. */+ const linkedPlaceOf = useCallback(+ (point: Pick<TourPlannerWaypoint, 'linkedPlaceId'>) =>+ point.linkedPlaceId ? (placesById.get(point.linkedPlaceId) ?? null) : null,+ [placesById]+ );++ return { candidates, add, unlink, linkedPlaceOf };+}++export type TripPlaceWaypoints = ReturnType<typeof useTripPlaceWaypoints>;diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsxindex b13ef9470..104288341 100644--- a/client/src/pages/TripPlannerPage.tsx+++ b/client/src/pages/TripPlannerPage.tsx@@ -646,7 +646,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {transition: 'width 0.25s ease', opacity: leftHidden ? 0 : 1,}}>{!leftHidden && <PanelResizeHandle side="left" width={leftWidth} min={resizeMin} max={resizeMax} onStart={startResizeLeft} onNudge={nudgeLeft} />}- <LazyPanel id="tour-planner-rail"><TourWorkspaceRail workspace={pageState} canEdit={canPlaceEdit} canAssign={canDayEdit} /></LazyPanel>+ <LazyPanel id="tour-planner-rail"><TourWorkspaceRail workspace={pageState} canEdit={canPlaceEdit} canAssign={canDayEdit} tourPlaceIds={tourPlaceIds} /></LazyPanel></div></div><div className="absolute bottom-[10px] right-[10px] top-[10px] z-20 hidden md:block">diff --git a/client/tests/helpers/tourPlannerStub.ts b/client/tests/helpers/tourPlannerStub.tsindex 6d3fa2dbb..a67fcc4b1 100644--- a/client/tests/helpers/tourPlannerStub.ts+++ b/client/tests/helpers/tourPlannerStub.ts@@ -44,5 +44,20 @@ export function hikePlannerDefaults() {routeParts: null,mapOverlays: new Set<string>(),toggleMapOverlay: vi.fn(),+ tripId: 1,+ editWaypoints: vi.fn(),+ // P2C-03: a tour opened at its first revision, with nothing known about others.+ revision: {+ base: null,+ baseRef: { current: null },+ conflict: null,+ remote: null,+ adopt: vi.fn(),+ notice: vi.fn(() => false),+ refuse: vi.fn(() => false),+ takeOver: vi.fn(),+ dismissConflict: vi.fn(),+ dismissRemote: vi.fn(),+ },};}diff --git a/server/src/db/entities/Places.entity.ts b/server/src/db/entities/Places.entity.tsindex 3d98b9231..8e5a8b7d9 100644--- a/server/src/db/entities/Places.entity.ts+++ b/server/src/db/entities/Places.entity.ts@@ -14,6 +14,7 @@ import { PlaceRegions } from './PlaceRegions.entity';import { Reservations } from './Reservations.entity';import { RoadtripDayTracks } from './RoadtripDayTracks.entity';import { Tags } from './Tags.entity';+import { TourWaypoints } from './TourWaypoints.entity';import { Tours } from './Tours.entity';import { TripFiles } from './TripFiles.entity';import { Trips } from './Trips.entity';@@ -68,6 +69,7 @@ export class Places {place_regions: Ref<PlaceRegions> | null = null;reservations_collection = new Collection<Reservations>(this);roadtrip_day_tracks_collection = new Collection<RoadtripDayTracks>(this);+ tour_waypoints_collection = new Collection<TourWaypoints>(this);tours: Ref<Tours> | null = null;tours_collection = new Collection<Tours>(this);trip_files_collection = new Collection<TripFiles>(this);@@ -125,6 +127,7 @@ export const PlacesSchema = defineEntity({place_regions: () => p.oneToOne(PlaceRegions).ref().mappedBy('place').hidden(),reservations_collection: () => p.oneToMany(Reservations).mappedBy('place').hidden(),roadtrip_day_tracks_collection: () => p.oneToMany(RoadtripDayTracks).mappedBy('place').hidden(),+ tour_waypoints_collection: () => p.oneToMany(TourWaypoints).mappedBy('linkedPlace').hidden(),tours: () => p.oneToOne(Tours).ref().mappedBy('place').hidden(),tours_collection: () => p.oneToMany(Tours).mappedBy('derivedFromPlace').hidden(),trip_files_collection: () => p.oneToMany(TripFiles).mappedBy('place').hidden(),diff --git a/server/src/db/entities/TourWaypoints.entity.ts b/server/src/db/entities/TourWaypoints.entity.tsindex f7d477058..aded39365 100644--- a/server/src/db/entities/TourWaypoints.entity.ts+++ b/server/src/db/entities/TourWaypoints.entity.ts@@ -1,5 +1,6 @@import { EntityRepositoryType, type Opt, type Ref, defineEntity, p } from '@mikro-orm/core';import { TourWaypointsRepository } from '../repositories/TourWaypoints.repository';+import { Places } from './Places.entity';import { Tours } from './Tours.entity';export class TourWaypoints {@@ -14,11 +15,20 @@ export class TourWaypoints {fixed_leg?: string | null;lock?: string | null;shaping: number & Opt = 0;+ linkedPlace?: Ref<Places> | null;+ linked_place_id?: number | null;}export const TourWaypointsSchema = defineEntity({class: TourWaypoints,repository: () => TourWaypointsRepository,+ indexes: [+ {+ name: 'idx_tour_waypoints_linked_place',+ where: 'linked_place_id IS NOT NULL',+ properties: ['linked_place_id'],+ },+ ],uniques: [{ properties: ['place', 'sequence'] }],checks: [{ name: 'tour_waypoints_shaping_check', expression: 'shaping IN (0, 1)' },@@ -34,5 +44,7 @@ export const TourWaypointsSchema = defineEntity({fixed_leg: p.text().nullable(),lock: p.text().nullable(),shaping: p.integer().default(0),+ linkedPlace: () => p.manyToOne(Places).ref().nullable().hidden(),+ linked_place_id: p.integer().nullable().persist(false),},});diff --git a/server/src/db/kysely/TourWaypoints.table.ts b/server/src/db/kysely/TourWaypoints.table.tsindex 9ce349556..589902158 100644--- a/server/src/db/kysely/TourWaypoints.table.ts+++ b/server/src/db/kysely/TourWaypoints.table.ts@@ -12,4 +12,5 @@ export interface TourWaypointsTable {fixed_leg: InsertOptional<string | null>;lock: InsertOptional<string | null>;shaping: InsertOptional<number>;+ linked_place_id: InsertOptional<number | null>;}diff --git a/server/src/db/migrations/Migration20200101044900_a_tour_waypoint_can_be_a_place_of_the_trip.ts b/server/src/db/migrations/Migration20200101044900_a_tour_waypoint_can_be_a_place_of_the_trip.tsnew file mode 100644index 000000000..9e2f151f6--- /dev/null+++ b/server/src/db/migrations/Migration20200101044900_a_tour_waypoint_can_be_a_place_of_the_trip.ts@@ -0,0 +1,20 @@+import { Migration } from '@mikro-orm/migrations';++/**+ * PR1-10: a waypoint of a tour can stand for a place of its trip, chosen on+ * purpose. The waypoint keeps its own coordinates; the place stays a place of+ * its own. Deleting the place only drops the link, never the waypoint, and the+ * partial index serves that delete.+ */+export class Migration20200101044900_a_tour_waypoint_can_be_a_place_of_the_trip extends Migration {+ override name = 'Migration20200101044900_a_tour_waypoint_can_be_a_place_of_the_trip';++ override up(): void {+ this.addSql(+ 'ALTER TABLE tour_waypoints ADD COLUMN linked_place_id INTEGER REFERENCES places(id) ON DELETE SET NULL',+ );+ this.addSql(+ 'CREATE INDEX idx_tour_waypoints_linked_place ON tour_waypoints (linked_place_id) WHERE linked_place_id IS NOT NULL',+ );+ }+}diff --git a/server/src/db/repositories/TourWaypoints.repository.ts b/server/src/db/repositories/TourWaypoints.repository.tsindex 87ee058a9..ea6d9abbc 100644--- a/server/src/db/repositories/TourWaypoints.repository.ts+++ b/server/src/db/repositories/TourWaypoints.repository.ts@@ -17,6 +17,8 @@ export interface TourWaypointRow {lock?: PaddleLock | null;/** P2A-03: a shaping point, steering the route only; absent for a stop. */shaping?: boolean;+ /** PR1-10: the place of the trip this point stands for; absent for a free point. */+ linked_place_id?: number | null;}/** The row as stored, the fixed leg still JSON text. */@@ -28,10 +30,11 @@ interface StoredWaypoint {fixed_leg: string | null;lock: string | null;shaping: number;+ linked_place_id: number | null;}/** A stored row as callers read it: the fixed leg, the lock and the shaping flag, each left out entirely where there is none. */-function readWaypoint({ fixed_leg, lock, shaping, ...point }: StoredWaypoint): TourWaypointRow {+function readWaypoint({ fixed_leg, lock, shaping, linked_place_id, ...point }: StoredWaypoint): TourWaypointRow {const leg = decodeJson(TOUR_WAYPOINT_FIXED_LEG, fixed_leg, 'tour waypoint');const stop = decodeJson(TOUR_WAYPOINT_LOCK, lock, 'tour waypoint');return {@@ -39,6 +42,7 @@ function readWaypoint({ fixed_leg, lock, shaping, ...point }: StoredWaypoint): T...(leg ? { fixed_leg: leg } : {}),...(stop ? { lock: stop } : {}),...(shaping ? { shaping: true } : {}),+ ...(linked_place_id != null ? { linked_place_id } : {}),};}@@ -48,7 +52,7 @@ export interface TourWaypointWithPlaceRow extends TourWaypointRow {}/** `role` narrowed to the three values the column's CHECK constraint allows. */-type TourWaypointsKyselyDB = Pick<DB, 'places'> & {+type TourWaypointsKyselyDB = Pick<DB, 'places' | 'tours'> & {tour_waypoints: Omit<DB['tour_waypoints'], 'role'> & { role: TourWaypointRow['role'] };};@@ -66,7 +70,7 @@ export class TourWaypointsRepository extends TrekRepository<TourWaypoints> {async listForPlace(place_id: number): Promise<TourWaypointRow[]> {const rows = await this.db().selectFrom('tour_waypoints')- .select(['lat', 'lng', 'role', 'sequence', 'fixed_leg', 'lock', 'shaping'])+ .select(['lat', 'lng', 'role', 'sequence', 'fixed_leg', 'lock', 'shaping', 'linked_place_id']).where('place_id', '=', place_id).orderBy('sequence', 'asc').execute();@@ -78,7 +82,17 @@ export class TourWaypointsRepository extends TrekRepository<TourWaypoints> {const rows = await this.db().selectFrom('tour_waypoints as tw').innerJoin('places as p', 'p.id', 'tw.place_id')- .select(['tw.place_id', 'tw.lat', 'tw.lng', 'tw.role', 'tw.sequence', 'tw.fixed_leg', 'tw.lock', 'tw.shaping'])+ .select([+ 'tw.place_id',+ 'tw.lat',+ 'tw.lng',+ 'tw.role',+ 'tw.sequence',+ 'tw.fixed_leg',+ 'tw.lock',+ 'tw.shaping',+ 'tw.linked_place_id',+ ]).where('p.trip_id', '=', trip_id).orderBy('tw.place_id', 'asc').orderBy('tw.sequence', 'asc')@@ -103,10 +117,42 @@ export class TourWaypointsRepository extends TrekRepository<TourWaypoints> {fixed_leg: w.fixed_leg ? encodeJson(TOUR_WAYPOINT_FIXED_LEG, w.fixed_leg) : null,lock: w.lock ? encodeJson(TOUR_WAYPOINT_LOCK, w.lock) : null,shaping: w.shaping ? 1 : 0,+ linkedPlace: w.linked_place_id ?? null,})),);}+ /**+ * PR1-10: which of these ids name a place of the trip a waypoint may stand+ * for: a place of that trip that is not itself a tour. An id of another+ * trip, of no place or of a tour is left out alike.+ */+ async linkablePlaceIds(trip_id: number, ids: readonly number[]): Promise<Set<number>> {+ if (ids.length === 0) return new Set();+ const rows = await this.db()+ .selectFrom('places as p')+ .select('p.id')+ .where('p.trip_id', '=', trip_id)+ .where('p.id', 'in', [...new Set(ids)])+ .where((eb) =>+ eb.not(eb.exists(eb.selectFrom('tours as t').select('t.place_id').whereRef('t.place_id', '=', 'p.id'))),+ )+ .execute();+ return new Set(rows.map((row) => row.id));+ }++ /** PR1-10: the names of the places of a trip the given ids stand for, for a reader of the tour. */+ async placeNames(trip_id: number, ids: readonly number[]): Promise<Map<number, string>> {+ if (ids.length === 0) return new Map();+ const rows = await this.db()+ .selectFrom('places as p')+ .select(['p.id', 'p.name'])+ .where('p.trip_id', '=', trip_id)+ .where('p.id', 'in', [...new Set(ids)])+ .execute();+ return new Map(rows.map((row) => [row.id, row.name]));+ }+/** TW4 — `DELETE FROM tour_waypoints WHERE place_id = ?`. */async deleteForPlace(place_id: number): Promise<void> {await this.nativeDelete({ place: place_id });diff --git a/server/src/nest/tours/tour-gpx-export.service.ts b/server/src/nest/tours/tour-gpx-export.service.tsindex a56d64444..f06a36917 100644--- a/server/src/nest/tours/tour-gpx-export.service.ts+++ b/server/src/nest/tours/tour-gpx-export.service.ts@@ -1,6 +1,8 @@import { Places } from '../../db/entities/Places.entity';+import { TourWaypoints } from '../../db/entities/TourWaypoints.entity';import { Tours } from '../../db/entities/Tours.entity';import type { PlacesRepository } from '../../db/repositories/Places.repository';+import type { TourWaypointsRepository } from '../../db/repositories/TourWaypoints.repository';import type { ToursRepository } from '../../db/repositories/Tours.repository';import { DomainError } from '../common/domain-error';import { toRowId } from '../common/row-id';@@ -24,7 +26,7 @@ export function gpxActivityOf(type: string, boat: string | null): string {/*** PR1-06A: one saved tour as a GPX file, its whole saved line with the heights- * it has. A read: nothing about the tour, its days or where it came from+ * it has, and the points that stand for a place of the trip as named waypoints. A read: nothing about the tour, its days or where it came from* changes, and a tour without a line of its own is refused rather than written* as a file that imports as nothing.*/@@ -33,6 +35,7 @@ export class TourGpxExportService {constructor(@InjectRepository(Tours) private readonly toursRepo: ToursRepository,@InjectRepository(Places) private readonly placesRepo: PlacesRepository,+ @InjectRepository(TourWaypoints) private readonly waypointsRepo: TourWaypointsRepository,private readonly placeImport: PlaceImportService,) {}@@ -41,7 +44,8 @@ export class TourGpxExportService {const pid = toRowId(placeId);const tour = tid !== null && pid !== null ? await this.toursRepo.findInTrip(tid, pid) : undefined;const place = tour && tid !== null ? await this.placesRepo.findInTrip(tour.place_id, tid) : undefined;- if (!tour || !place) throw new NotFoundException('Tour not found');+ if (!tour || !place || tid === null) throw new NotFoundException('Tour not found');+ const stops = await this.namedStops(tid, tour.place_id);const gpx = this.placeImport.writeTourGpx({name: tour.name,@@ -49,11 +53,27 @@ export class TourGpxExportService {website: tour.website ?? null,activity: gpxActivityOf(tour.tour_type, tour.boat_type),route_geometry: place.route_geometry ?? null,- stops: [],+ stops,});if (!gpx) {throw new DomainError(422, 'This tour has no route to export', { code: 'tour_without_route' });}return { gpx, filename: this.placeImport.tourGpxFilename(tour.name) };}++ /** The points that stand for a place of the trip (PR1-10), named after it, as the file's waypoints. */+ private async namedStops(+ tripId: number,+ placeId: number,+ ): Promise<Array<{ name: string; lat: number; lng: number }>> {+ const points = (await this.waypointsRepo.listForPlace(placeId)).filter((point) => point.linked_place_id);+ const names = await this.waypointsRepo.placeNames(+ tripId,+ points.map((point) => point.linked_place_id as number),+ );+ return points.flatMap((point) => {+ const name = names.get(point.linked_place_id as number);+ return name ? [{ name, lat: point.lat, lng: point.lng }] : [];+ });+ }}diff --git a/server/src/nest/tours/tours.mcp.ts b/server/src/nest/tours/tours.mcp.tsindex d1700feaa..d6cdeed8a 100644--- a/server/src/nest/tours/tours.mcp.ts+++ b/server/src/nest/tours/tours.mcp.ts@@ -63,7 +63,7 @@ export class ToursMcp {@Tool({name: 'get_tour_plan',description:- 'Read one saved tour of a trip: its facts, its ordered control points (start, via and end; an import without its own shows the two ends of its track), where it came from (provenance) and the days it is on. A control point whose fixed_leg is set leads to the next one along a line the router did not plan: kind ferrata follows a via ferrata, kind free is drawn by hand and was checked by nothing. A paddle tour also carries its obstacle checklist (obstacle_check): the obstacles of the OpenStreetMap data along its line, the decisions the travellers made about them and their own portages and locks; a planning aid, never a safety or legal clearance. The full track geometry is not included.',+ 'Read one saved tour of a trip: its facts, its ordered control points (start, via and end; an import without its own shows the two ends of its track), where it came from (provenance) and the days it is on. A control point with linked_place_id stands for that place of the trip (linked_place_name names it); it keeps its own coordinates. A control point whose fixed_leg is set leads to the next one along a line the router did not plan: kind ferrata follows a via ferrata, kind free is drawn by hand and was checked by nothing. A paddle tour also carries its obstacle checklist (obstacle_check): the obstacles of the OpenStreetMap data along its line, the decisions the travellers made about them and their own portages and locks; a planning aid, never a safety or legal clearance. The full track geometry is not included.',inputSchema: { tripId: idSchema, placeId: idSchema.describe('The place id of the tour, as list_tours gives it') },annotations: TOOL_ANNOTATIONS_READONLY,when: addonGate(ADDON_IDS.TOURS),@@ -76,7 +76,12 @@ export class ToursMcp {this.tours.getTour(String(tripId), String(placeId)),this.daysByTour(tripId),]);- return ok({ ...detail, tour: withDays(detail.tour, days) });+ // A point standing for a place of the trip (PR1-10) says which, by name.+ const names = await this.tours.linkedPlaceNames(tripId, detail.waypoints);+ const waypoints = detail.waypoints.map((point) =>+ point.linked_place_id ? { ...point, linked_place_name: names.get(point.linked_place_id) ?? null } : point,+ );+ return ok({ ...detail, waypoints, tour: withDays(detail.tour, days) });} catch (err: unknown) {if (err instanceof NotFoundException) return errorResult('Tour not found.');throw err;diff --git a/server/src/nest/tours/tours.service.ts b/server/src/nest/tours/tours.service.tsindex 94a64d985..26ad2954b 100644--- a/server/src/nest/tours/tours.service.ts+++ b/server/src/nest/tours/tours.service.ts@@ -294,7 +294,7 @@ export class ToursService {break_additional_minutes: fields.break_additional_minutes ?? null,derived_from_place_id: derivedFrom,});- await this.waypointsRepo.insertForPlace(id, input.waypoints);+ await this.waypointsRepo.insertForPlace(id, await this.linkedWaypoints(tid, input.waypoints));return id;});@@ -496,7 +496,7 @@ export class ToursService {if (!placeUpdated) throw new NotFoundException('Tour not found');if (!(await this.toursRepo.updateInTrip(tid, pid, fields))) throw new NotFoundException('Tour not found');await this.waypointsRepo.deleteForPlace(pid);- await this.waypointsRepo.insertForPlace(pid, input.waypoints);+ await this.waypointsRepo.insertForPlace(pid, await this.linkedWaypoints(tid, input.waypoints));});const result = await this.getTour(tripId, placeId);@@ -511,6 +511,39 @@ export class ToursService {return result;}+ /** PR1-10: the names of the places the points stand for, for a reader that wants them spelled out. */+ async linkedPlaceNames(tripId: number, waypoints: readonly TourWaypoint[]): Promise<Map<number, string>> {+ return await this.waypointsRepo.placeNames(+ tripId,+ waypoints.flatMap((point) => (point.linked_place_id ? [point.linked_place_id] : [])),+ );+ }++ /**+ * PR1-10: the points of a write with their links checked, inside its+ * transaction. A point may stand for a place of the tour's trip that is not+ * a tour itself; naming a tour of the trip is refused. A place that is gone,+ * or one this trip does not have, leaves the point unlinked, the same either+ * way, so a draft or a queued write that outlived its place still saves and+ * no answer tells another trip's ids apart.+ */+ private async linkedWaypoints(tripId: number, waypoints: TourWaypoint[]): Promise<TourWaypoint[]> {+ const ids = waypoints.flatMap((point) => (point.linked_place_id ? [point.linked_place_id] : []));+ if (ids.length === 0) return waypoints;+ const linkable = await this.waypointsRepo.linkablePlaceIds(tripId, ids);+ for (const id of ids) {+ if (!linkable.has(id) && (await this.toursRepo.findInTrip(tripId, id))) {+ throw new DomainError(400, 'A waypoint cannot stand for a tour', {+ code: 'waypoint_links_a_tour',+ details: { code: 'waypoint_links_a_tour' },+ });+ }+ }+ return waypoints.map((point) =>+ point.linked_place_id && !linkable.has(point.linked_place_id) ? { ...point, linked_place_id: null } : point,+ );+ }+/** Tells the trip's other clients to reload these tours; a failed notice never fails the committed write. */broadcastToursChanged(tripId: string, placeIds: number[], socketId?: string): void {try {diff --git a/server/src/nest/trips/trips.service.ts b/server/src/nest/trips/trips.service.tsindex 8ffab7832..6a99229fa 100644--- a/server/src/nest/trips/trips.service.ts+++ b/server/src/nest/trips/trips.service.ts@@ -754,7 +754,11 @@ export class TripsService {waypointsByPlace.set(place_id, list);}for (const [placeId, waypoints] of waypointsByPlace) {- await this.tourWaypointsRepo.insertForPlace(placeMap.get(placeId)!, waypoints);+ // A point standing for a place of the trip stands for that place's copy (PR1-10).+ const remapped = waypoints.map((point) =>+ point.linked_place_id ? { ...point, linked_place_id: placeMap.get(point.linked_place_id) ?? null } : point,+ );+ await this.tourWaypointsRepo.insertForPlace(placeMap.get(placeId)!, remapped);}const oldAssignments = await this.dayAssignmentsRepo.listAllForTrip(sourceTripId); // TP48diff --git a/server/tests/e2e/tours-planned.e2e.test.ts b/server/tests/e2e/tours-planned.e2e.test.tsindex 7bf4f59b0..867fa950a 100644--- a/server/tests/e2e/tours-planned.e2e.test.ts+++ b/server/tests/e2e/tours-planned.e2e.test.ts@@ -21,7 +21,7 @@ import { RealtimeService } from '../../src/nest/realtime/realtime.service';import { ToursModule } from '../../src/nest/tours/tours.module';import { createSnapshotTestDb } from '../helpers/db-mock';import { makePlace } from '../helpers/factories/places';-import { deleteRows, findRow, insertRows } from '../helpers/factories/rows';+import { countRows, deleteRows, findRow, insertRows } from '../helpers/factories/rows';import { setAddonEnabled } from '../helpers/factories/settings';import { makeTour } from '../helpers/factories/tours';import { addTripMember } from '../helpers/factories/trips';@@ -349,4 +349,80 @@ describe('Tours planned e2e (real guards + temp SQLite)', () => {expect((await put(placeId, tourBody({ expected_revision: 0 }))).status).toBe(400);});});++ describe('trip places as waypoints (PR1-10)', () => {+ const linked = (placeId: number | null) => [+ { lat: 47, lng: 11, role: 'start', sequence: 0 },+ { lat: 47.01, lng: 11.01, role: 'via', sequence: 1, linked_place_id: placeId },+ { lat: 47.02, lng: 11.02, role: 'end', sequence: 2 },+ ];++ it('a waypoint stands for a place of the trip, read back with it, and the place stays as it was', async () => {+ const hut = await makePlace(orm, 5, { name: 'Höllentalangerhütte', lat: 47.4, lng: 11.0 });+ const placeId = await createViaApi(5, tourBody({ waypoints: linked(hut.id) }));+ const detail = await request(server).get(`/api/trips/5/tours/${placeId}`).set('Cookie', sessionCookie(OWNER));+ expect(detail.body.waypoints.map((point: { linked_place_id?: number }) => point.linked_place_id ?? null)).toEqual(+ [null, hut.id, null],+ );+ // The waypoint keeps its own coordinates; the place keeps its own.+ expect(detail.body.waypoints[1]).toMatchObject({ lat: 47.01, lng: 11.01 });+ expect(await findRow(orm, Places, { id: hut.id })).toMatchObject({ name: 'Höllentalangerhütte', lat: 47.4 });+ expect(await countRows(orm, DayAssignments, { place: hut.id })).toBe(0);+ });++ it('a place of another trip, or one that is gone, leaves the point unlinked; a tour cannot be stood for', async () => {+ const foreign = await makePlace(orm, 6, { name: 'Elsewhere' });+ const placeId = await createViaApi(5, tourBody({ waypoints: linked(foreign.id) }));+ const detail = await request(server).get(`/api/trips/5/tours/${placeId}`).set('Cookie', sessionCookie(OWNER));+ expect(detail.body.waypoints[1].linked_place_id).toBeUndefined();++ const missing = await request(server)+ .put(`/api/trips/5/tours/${placeId}`)+ .set('Cookie', sessionCookie(OWNER))+ .send(tourBody({ waypoints: linked(999_999) }));+ expect(missing.status).toBe(200);+ expect(missing.body.waypoints[1].linked_place_id).toBeUndefined();++ const otherTour = await createViaApi();+ const refused = await request(server)+ .put(`/api/trips/5/tours/${placeId}`)+ .set('Cookie', sessionCookie(OWNER))+ .send(tourBody({ waypoints: linked(otherTour) }));+ expect(refused.status).toBe(400);+ expect(refused.body).toEqual({ error: 'A waypoint cannot stand for a tour', code: 'waypoint_links_a_tour' });+ });++ it('deleting the place keeps the waypoint and only drops the link; the GPX names the stops that stand for a place', async () => {+ const hut = await makePlace(orm, 5, { name: 'Kreuzeckhaus' });+ const lake = await makePlace(orm, 5, { name: 'Eibsee' });+ const placeId = await createViaApi(+ 5,+ tourBody({+ waypoints: [+ { lat: 47, lng: 11, role: 'start', sequence: 0, linked_place_id: lake.id },+ { lat: 47.01, lng: 11.01, role: 'via', sequence: 1, linked_place_id: hut.id },+ { lat: 47.02, lng: 11.02, role: 'end', sequence: 2 },+ ],+ }),+ );+ const gpx = await request(server)+ .get(`/api/trips/5/tours/${placeId}/export.gpx`)+ .set('Cookie', sessionCookie(OWNER))+ .buffer(true)+ .parse((res, done) => {+ let text = '';+ res.setEncoding('utf8');+ res.on('data', (chunk: string) => (text += chunk));+ res.on('end', () => done(null, text));+ });+ expect((gpx.body as string).match(/<wpt /g)).toHaveLength(2);+ expect(gpx.body).toContain('<name>Kreuzeckhaus</name>');++ await deleteRows(orm, Places, { id: hut.id });+ const detail = await request(server).get(`/api/trips/5/tours/${placeId}`).set('Cookie', sessionCookie(OWNER));+ expect(detail.body.waypoints).toHaveLength(3);+ expect(detail.body.waypoints[1].linked_place_id).toBeUndefined();+ expect(detail.body.waypoints[0].linked_place_id).toBe(lake.id);+ });+ });});diff --git a/server/tests/e2e/tours.e2e.test.ts b/server/tests/e2e/tours.e2e.test.tsindex acc9c3afb..efcbd6530 100644--- a/server/tests/e2e/tours.e2e.test.ts+++ b/server/tests/e2e/tours.e2e.test.ts@@ -1394,6 +1394,33 @@ describe('Tours e2e (real guards + temp SQLite)', () => {expect(await countRows(orm, TourWaypoints, { place: placeId })).toBe(3);});+ it('copying the trip points a waypoint that stands for a place at the copied place (PR1-10)', async () => {+ const hut = await makePlace(orm, 5, { name: 'Hut' });+ const placeId = await createViaApi(+ 5,+ tourBody({+ waypoints: [+ { lat: 47, lng: 11, role: 'start', sequence: 0, linked_place_id: hut.id },+ { lat: 47.02, lng: 11.02, role: 'end', sequence: 1 },+ ],+ }),+ );+ const res = await request(server)+ .post('/api/trips/5/copy')+ .set('Cookie', sessionCookie(OWNER))+ .send({ title: 'Alps again' });+ const copyId = res.body.trip.id as number;+ const copiedHut = await findRow(orm, Places, { trip: copyId, name: 'Hut' });+ const list = await request(server).get(`/api/trips/${copyId}/tours`).set('Cookie', sessionCookie(OWNER));+ const detail = await request(server)+ .get(`/api/trips/${copyId}/tours/${list.body.tours[0].place_id}`)+ .set('Cookie', sessionCookie(OWNER));+ expect(copiedHut?.id).toBeDefined();+ expect(copiedHut?.id).not.toBe(hut.id);+ expect(detail.body.waypoints[0].linked_place_id).toBe(copiedHut?.id);+ expect(await countRows(orm, TourWaypoints, { place: placeId, linkedPlace: hut.id })).toBe(1);+ });+it('deleting the place removes its tour and waypoints and reports the tour id', async () => {const placeId = await createViaApi();const res = await request(server).delete(`/api/trips/5/places/${placeId}`).set('Cookie', sessionCookie(OWNER));diff --git a/server/tests/unit/db/legacy-baseline.test.ts b/server/tests/unit/db/legacy-baseline.test.tsindex 58f5d4d34..b7a791c53 100644--- a/server/tests/unit/db/legacy-baseline.test.ts+++ b/server/tests/unit/db/legacy-baseline.test.ts@@ -60,6 +60,7 @@ const UNNUMBERED = ['Migration20200101044600_a_paddle_tour_remembers_how_it_crosses_lakes','Migration20200101044700_paddle_water_data_loads_where_a_paddler_plans','Migration20200101044800_a_tour_counts_its_revisions',+ 'Migration20200101044900_a_tour_waypoint_can_be_a_place_of_the_trip',];// The last step the positional runner ever had; planLegacyBaseline refuses a// schema_version past it.diff --git a/server/tests/unit/db/repositories/TourWaypoints.repository.test.ts b/server/tests/unit/db/repositories/TourWaypoints.repository.test.tsindex 9494844cc..132b7448d 100644--- a/server/tests/unit/db/repositories/TourWaypoints.repository.test.ts+++ b/server/tests/unit/db/repositories/TourWaypoints.repository.test.ts@@ -138,4 +138,26 @@ describe('TourWaypointsRepository', () => {expect(points[1]).toEqual({ lat: 47.05, lng: 11.05, role: 'via', sequence: 1, shaping: true });expect(points[0]).not.toHaveProperty('shaping');});++ it('TWREPO-008: a point that stands for a place keeps it, and the place lists as linkable only in its own trip (PR1-10)', async () => {+ const { trip, place } = tourInTrip();+ const hut = createPlace(testDb, trip.id, { name: 'Hut' });+ const otherTour = createPlace(testDb, trip.id, { name: 'Other tour' });+ createTour(testDb, otherTour.id);+ const { user } = createUser(testDb);+ const elsewhere = createPlace(testDb, createTrip(testDb, user.id).id, { name: 'Elsewhere' });++ await repo.insertForPlace(place.id, [+ { lat: 47, lng: 11, role: 'start', sequence: 0, linked_place_id: hut.id },+ { lat: 47.1, lng: 11.1, role: 'end', sequence: 1 },+ ]);+ expect((await repo.listForPlace(place.id)).map((point) => point.linked_place_id ?? null)).toEqual([hut.id, null]);+ expect((await repo.listForTrip(trip.id))[0]).toMatchObject({ linked_place_id: hut.id });++ const linkable = await repo.linkablePlaceIds(trip.id, [hut.id, otherTour.id, elsewhere.id, 999_999, hut.id]);+ expect([...linkable]).toEqual([hut.id]);+ expect(await repo.linkablePlaceIds(trip.id, [])).toEqual(new Set());+ expect(await repo.placeNames(trip.id, [hut.id, elsewhere.id])).toEqual(new Map([[hut.id, 'Hut']]));+ expect(await repo.placeNames(trip.id, [])).toEqual(new Map());+ });});diff --git a/server/tests/unit/nest/tours.mcp.test.ts b/server/tests/unit/nest/tours.mcp.test.tsindex 2da35e708..b49e628af 100644--- a/server/tests/unit/nest/tours.mcp.test.ts+++ b/server/tests/unit/nest/tours.mcp.test.ts@@ -5,6 +5,7 @@* registry's and is covered with the other addon-gated tools.*/import { Places } from '../../../src/db/entities/Places.entity';+import { TourWaypoints } from '../../../src/db/entities/TourWaypoints.entity';import type { McpContext } from '../../../src/nest-mcp';import { ToursMcp } from '../../../src/nest/tours/tours.mcp';import { ToursModule } from '../../../src/nest/tours/tours.module';@@ -18,7 +19,7 @@ import {createTrip,createUser,} from '../../helpers/factories';-import { updateRows } from '../../helpers/factories/rows';+import { insertRows, updateRows } from '../../helpers/factories/rows';import { resetTestDb } from '../../helpers/test-db';import { createTestModule, type TestModule } from '../../helpers/test-module';import { createTestOrm } from '../../helpers/test-orm';@@ -158,4 +159,18 @@ describe('ToursMcp', () => {error: 'Tour not found.',});});++ it('TOURS-MCP-007: get_tour_plan names the place a control point stands for (PR1-10)', async () => {+ const { user, trip, ridge } = fixture();+ const hut = createPlace(db, trip.id, { name: 'Hut' });+ const orm = await createTestOrm(db);+ await insertRows(orm, TourWaypoints, [+ { place: ridge.id, lat: 47, lng: 11, role: 'start', sequence: 0, linkedPlace: hut.id },+ { place: ridge.id, lat: 47.1, lng: 11.1, role: 'end', sequence: 1 },+ ]);+ await orm.close();+ const plan = read(await mcp.getTourPlan({ tripId: trip.id, placeId: ridge.id }, ctx(user.id)));+ expect(plan.waypoints[0]).toMatchObject({ linked_place_id: hut.id, linked_place_name: 'Hut' });+ expect(plan.waypoints[1].linked_place_name).toBeUndefined();+ });});diff --git a/shared/src/i18n/ar/tours.ts b/shared/src/i18n/ar/tours.tsindex 659684abe..8c22f1641 100644--- a/shared/src/i18n/ar/tours.ts+++ b/shared/src/i18n/ar/tours.ts@@ -302,6 +302,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'حفظ كجولة جديدة','tours.revision.mineName': '{name} (نسختي)','tours.revision.reloaded': 'حُفظت هذه الجولة في مكان آخر وتظهر الآن نسختها الأحدث.',+ 'tours.placePicker.open': 'أماكن الرحلة',+ 'tours.placePicker.search': 'ابحث في أماكن الرحلة',+ 'tours.placePicker.near': 'قرب الجولة',+ 'tours.placePicker.further': 'أماكن أخرى في الرحلة',+ 'tours.placePicker.all': 'أماكن الرحلة',+ 'tours.placePicker.inTour': 'في الجولة',+ 'tours.placePicker.empty': 'لا توجد في هذه الرحلة بعد أماكن ذات موقع على الخريطة.',+ 'tours.placePicker.noMatch': 'لا يوجد مكان يطابق البحث.',+ 'tours.placePicker.linked': 'مكان من الرحلة',+ 'tours.placePicker.linkedHint': 'تمثّل هذه المحطة مكانًا في الرحلة. حذفها أو فك الربط لا يغيّر المكان.',+ 'tours.placePicker.unlink': 'فك الربط بالمكان','tours.planner.tourType': 'نوع الجولة','tours.paddle.boat': 'القارب','tours.paddle.boat.kayak': 'كاياك',diff --git a/shared/src/i18n/az/tours.ts b/shared/src/i18n/az/tours.tsindex a27a21ea2..dda79f2ea 100644--- a/shared/src/i18n/az/tours.ts+++ b/shared/src/i18n/az/tours.ts@@ -292,6 +292,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Yeni tur kimi saxla','tours.revision.mineName': '{name} (mənim versiyam)','tours.revision.reloaded': 'Bu tur başqa yerdə saxlanıb və indi yeni versiyası göstərilir.',+ 'tours.placePicker.open': 'Səfər yerləri',+ 'tours.placePicker.search': 'Səfərin yerlərində axtar',+ 'tours.placePicker.near': 'Tura yaxın',+ 'tours.placePicker.further': 'Səfərin digər yerləri',+ 'tours.placePicker.all': 'Səfərin yerləri',+ 'tours.placePicker.inTour': 'Turda',+ 'tours.placePicker.empty': 'Bu səfərdə hələ xəritədə yeri olan məkan yoxdur.',+ 'tours.placePicker.noMatch': 'Axtarışa uyğun yer yoxdur.',+ 'tours.placePicker.linked': 'Səfərin yeri',+ 'tours.placePicker.linkedHint':+ 'Bu dayanacaq səfərin bir yerini göstərir. Silmək və ya əlaqəni ləğv etmək yerin özünü dəyişmir.',+ 'tours.placePicker.unlink': 'Yerlə əlaqəni ləğv et','tours.planner.tourType': 'Tur növü','tours.paddle.boat': 'Qayıq','tours.paddle.boat.kayak': 'Kayak', // same-as-endiff --git a/shared/src/i18n/br/tours.ts b/shared/src/i18n/br/tours.tsindex fd988d563..d5c005398 100644--- a/shared/src/i18n/br/tours.ts+++ b/shared/src/i18n/br/tours.ts@@ -298,6 +298,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Salvar como novo passeio','tours.revision.mineName': '{name} (minha versão)','tours.revision.reloaded': 'Este passeio foi salvo em outro lugar e agora mostra a versão mais nova.',+ 'tours.placePicker.open': 'Locais da viagem',+ 'tours.placePicker.search': 'Buscar nos locais da viagem',+ 'tours.placePicker.near': 'Perto do passeio',+ 'tours.placePicker.further': 'Outros locais da viagem',+ 'tours.placePicker.all': 'Locais da viagem',+ 'tours.placePicker.inTour': 'No passeio',+ 'tours.placePicker.empty': 'Esta viagem ainda não tem locais com posição no mapa.',+ 'tours.placePicker.noMatch': 'Nenhum local corresponde à busca.',+ 'tours.placePicker.linked': 'Local da viagem',+ 'tours.placePicker.linkedHint':+ 'Esta parada representa um local da viagem. Removê-la ou desfazer o vínculo não altera o local.',+ 'tours.placePicker.unlink': 'Desvincular do local','tours.planner.tourType': 'Tipo de passeio','tours.paddle.boat': 'Embarcação','tours.paddle.boat.kayak': 'Caiaque',diff --git a/shared/src/i18n/ca/tours.ts b/shared/src/i18n/ca/tours.tsindex 0825975c7..68d5b7fe1 100644--- a/shared/src/i18n/ca/tours.ts+++ b/shared/src/i18n/ca/tours.ts@@ -298,6 +298,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Desa com a nova excursió','tours.revision.mineName': '{name} (la meva versió)','tours.revision.reloaded': 'Aquesta excursió s’ha desat en un altre lloc i ara en mostra la versió més nova.',+ 'tours.placePicker.open': 'Llocs del viatge',+ 'tours.placePicker.search': 'Cerca als llocs del viatge',+ 'tours.placePicker.near': 'A prop de l’excursió',+ 'tours.placePicker.further': 'Més llocs del viatge',+ 'tours.placePicker.all': 'Llocs del viatge',+ 'tours.placePicker.inTour': 'A l’excursió',+ 'tours.placePicker.empty': 'Aquest viatge encara no té llocs amb posició al mapa.',+ 'tours.placePicker.noMatch': 'Cap lloc no coincideix amb la cerca.',+ 'tours.placePicker.linked': 'Lloc del viatge',+ 'tours.placePicker.linkedHint':+ 'Aquesta parada representa un lloc del viatge. Treure-la o desfer l’enllaç no canvia el lloc.',+ 'tours.placePicker.unlink': 'Desenllaça del lloc','tours.planner.tourType': 'Tipus de ruta','tours.paddle.boat': 'Embarcació','tours.paddle.boat.kayak': 'Caiac',diff --git a/shared/src/i18n/cs/tours.ts b/shared/src/i18n/cs/tours.tsindex a2e249793..1f6f07884 100644--- a/shared/src/i18n/cs/tours.ts+++ b/shared/src/i18n/cs/tours.ts@@ -292,6 +292,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Uložit jako novou túru','tours.revision.mineName': '{name} (moje verze)','tours.revision.reloaded': 'Túra byla uložena jinde a teď zobrazuje novější verzi.',+ 'tours.placePicker.open': 'Místa cesty',+ 'tours.placePicker.search': 'Hledat v místech cesty',+ 'tours.placePicker.near': 'Blízko túry',+ 'tours.placePicker.further': 'Další místa cesty',+ 'tours.placePicker.all': 'Místa cesty',+ 'tours.placePicker.inTour': 'V túře',+ 'tours.placePicker.empty': 'Tato cesta zatím nemá místa s polohou na mapě.',+ 'tours.placePicker.noMatch': 'Hledání neodpovídá žádné místo.',+ 'tours.placePicker.linked': 'Místo cesty',+ 'tours.placePicker.linkedHint':+ 'Tato zastávka představuje místo cesty. Odebrání nebo zrušení propojení místo nezmění.',+ 'tours.placePicker.unlink': 'Odpojit od místa','tours.planner.tourType': 'Typ túry','tours.paddle.boat': 'Loď','tours.paddle.boat.kayak': 'Kajak',diff --git a/shared/src/i18n/de/tours.ts b/shared/src/i18n/de/tours.tsindex 209bbe193..2b6232937 100644--- a/shared/src/i18n/de/tours.ts+++ b/shared/src/i18n/de/tours.ts@@ -300,6 +300,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Als neue Tour speichern','tours.revision.mineName': '{name} (meine Fassung)','tours.revision.reloaded': 'Diese Tour wurde woanders gespeichert und zeigt jetzt die neuere Fassung.',+ 'tours.placePicker.open': 'Reise-Orte',+ 'tours.placePicker.search': 'Orte der Reise durchsuchen',+ 'tours.placePicker.near': 'Nahe der Tour',+ 'tours.placePicker.further': 'Weitere Orte der Reise',+ 'tours.placePicker.all': 'Orte der Reise',+ 'tours.placePicker.inTour': 'In der Tour',+ 'tours.placePicker.empty': 'Diese Reise hat noch keine Orte mit Lage auf der Karte.',+ 'tours.placePicker.noMatch': 'Kein Ort passt zur Suche.',+ 'tours.placePicker.linked': 'Ort der Reise',+ 'tours.placePicker.linkedHint':+ 'Diese Station steht für einen Ort der Reise. Entfernen oder Lösen ändert den Ort nicht.',+ 'tours.placePicker.unlink': 'Vom Ort lösen','tours.planner.tourType': 'Tourtyp','tours.paddle.boat': 'Boot','tours.paddle.boat.kayak': 'Kajak',diff --git a/shared/src/i18n/en/tours.ts b/shared/src/i18n/en/tours.tsindex 40911c7ff..94fcaa0b1 100644--- a/shared/src/i18n/en/tours.ts+++ b/shared/src/i18n/en/tours.ts@@ -291,6 +291,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Save as new tour','tours.revision.mineName': '{name} (my version)','tours.revision.reloaded': 'This tour was saved elsewhere and now shows its newer version.',+ 'tours.placePicker.open': 'Trip places',+ 'tours.placePicker.search': "Search the trip's places",+ 'tours.placePicker.near': 'Near the tour',+ 'tours.placePicker.further': 'More places of the trip',+ 'tours.placePicker.all': 'Places of the trip',+ 'tours.placePicker.inTour': 'In the tour',+ 'tours.placePicker.empty': 'This trip has no places with a spot on the map yet.',+ 'tours.placePicker.noMatch': 'No place matches the search.',+ 'tours.placePicker.linked': 'Place of the trip',+ 'tours.placePicker.linkedHint':+ 'This stop stands for a place of the trip. Removing it, or undoing the link, leaves the place as it is.',+ 'tours.placePicker.unlink': 'Unlink from the place','tours.planner.tourType': 'Tour type','tours.paddle.boat': 'Boat','tours.paddle.boat.kayak': 'Kayak',diff --git a/shared/src/i18n/es/tours.ts b/shared/src/i18n/es/tours.tsindex dbe8967d8..842a0e8fd 100644--- a/shared/src/i18n/es/tours.ts+++ b/shared/src/i18n/es/tours.ts@@ -297,6 +297,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Guardar como nueva excursión','tours.revision.mineName': '{name} (mi versión)','tours.revision.reloaded': 'Esta excursión se guardó en otro lugar y ahora muestra su versión más reciente.',+ 'tours.placePicker.open': 'Lugares del viaje',+ 'tours.placePicker.search': 'Buscar en los lugares del viaje',+ 'tours.placePicker.near': 'Cerca de la excursión',+ 'tours.placePicker.further': 'Más lugares del viaje',+ 'tours.placePicker.all': 'Lugares del viaje',+ 'tours.placePicker.inTour': 'En la excursión',+ 'tours.placePicker.empty': 'Este viaje aún no tiene lugares con posición en el mapa.',+ 'tours.placePicker.noMatch': 'Ningún lugar coincide con la búsqueda.',+ 'tours.placePicker.linked': 'Lugar del viaje',+ 'tours.placePicker.linkedHint':+ 'Esta parada representa un lugar del viaje. Quitarla o deshacer el vínculo no cambia el lugar.',+ 'tours.placePicker.unlink': 'Desvincular del lugar','tours.planner.tourType': 'Tipo de ruta','tours.paddle.boat': 'Embarcación','tours.paddle.boat.kayak': 'Kayak', // same-as-endiff --git a/shared/src/i18n/et/tours.ts b/shared/src/i18n/et/tours.tsindex 6fe509078..310180be6 100644--- a/shared/src/i18n/et/tours.ts+++ b/shared/src/i18n/et/tours.ts@@ -294,6 +294,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Salvesta uue matkana','tours.revision.mineName': '{name} (minu versioon)','tours.revision.reloaded': 'Seda matka salvestati mujal ja nüüd on näha uuem versioon.',+ 'tours.placePicker.open': 'Reisi kohad',+ 'tours.placePicker.search': 'Otsi reisi kohtadest',+ 'tours.placePicker.near': 'Matka lähedal',+ 'tours.placePicker.further': 'Reisi muud kohad',+ 'tours.placePicker.all': 'Reisi kohad',+ 'tours.placePicker.inTour': 'Matkas',+ 'tours.placePicker.empty': 'Sellel reisil pole veel kaardil asukohaga kohti.',+ 'tours.placePicker.noMatch': 'Otsingule ei vasta ükski koht.',+ 'tours.placePicker.linked': 'Reisi koht',+ 'tours.placePicker.linkedHint': 'See peatus tähistab reisi kohta. Eemaldamine või seose lõpetamine kohta ei muuda.',+ 'tours.placePicker.unlink': 'Eemalda seos kohaga','tours.planner.tourType': 'Matka tüüp','tours.paddle.boat': 'Paat','tours.paddle.boat.kayak': 'Süst',diff --git a/shared/src/i18n/fr/tours.ts b/shared/src/i18n/fr/tours.tsindex da7dfa993..0ef96e50e 100644--- a/shared/src/i18n/fr/tours.ts+++ b/shared/src/i18n/fr/tours.ts@@ -303,6 +303,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Enregistrer comme nouvelle sortie','tours.revision.mineName': '{name} (ma version)','tours.revision.reloaded': 'Cette sortie a été enregistrée ailleurs et affiche maintenant sa version récente.',+ 'tours.placePicker.open': 'Lieux du voyage',+ 'tours.placePicker.search': 'Chercher dans les lieux du voyage',+ 'tours.placePicker.near': 'Près de la sortie',+ 'tours.placePicker.further': 'Autres lieux du voyage',+ 'tours.placePicker.all': 'Lieux du voyage',+ 'tours.placePicker.inTour': 'Dans la sortie',+ 'tours.placePicker.empty': 'Ce voyage n’a pas encore de lieux situés sur la carte.',+ 'tours.placePicker.noMatch': 'Aucun lieu ne correspond à la recherche.',+ 'tours.placePicker.linked': 'Lieu du voyage',+ 'tours.placePicker.linkedHint':+ 'Cette étape représente un lieu du voyage. La retirer ou défaire le lien ne modifie pas le lieu.',+ 'tours.placePicker.unlink': 'Détacher du lieu','tours.planner.tourType': 'Type de sortie','tours.paddle.boat': 'Embarcation','tours.paddle.boat.kayak': 'Kayak', // same-as-endiff --git a/shared/src/i18n/gr/tours.ts b/shared/src/i18n/gr/tours.tsindex bc32de41d..f1ccbfe97 100644--- a/shared/src/i18n/gr/tours.ts+++ b/shared/src/i18n/gr/tours.ts@@ -304,6 +304,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Αποθήκευση ως νέα εκδρομή','tours.revision.mineName': '{name} (η δική μου έκδοση)','tours.revision.reloaded': 'Η εκδρομή αποθηκεύτηκε αλλού και τώρα δείχνει τη νεότερη έκδοση.',+ 'tours.placePicker.open': 'Μέρη ταξιδιού',+ 'tours.placePicker.search': 'Αναζήτηση στα μέρη του ταξιδιού',+ 'tours.placePicker.near': 'Κοντά στην εκδρομή',+ 'tours.placePicker.further': 'Άλλα μέρη του ταξιδιού',+ 'tours.placePicker.all': 'Μέρη του ταξιδιού',+ 'tours.placePicker.inTour': 'Στην εκδρομή',+ 'tours.placePicker.empty': 'Αυτό το ταξίδι δεν έχει ακόμη μέρη με θέση στον χάρτη.',+ 'tours.placePicker.noMatch': 'Κανένα μέρος δεν ταιριάζει με την αναζήτηση.',+ 'tours.placePicker.linked': 'Μέρος του ταξιδιού',+ 'tours.placePicker.linkedHint':+ 'Αυτή η στάση αντιστοιχεί σε ένα μέρος του ταξιδιού. Η αφαίρεση ή η αποσύνδεση δεν αλλάζει το μέρος.',+ 'tours.placePicker.unlink': 'Αποσύνδεση από το μέρος','tours.planner.tourType': 'Τύπος διαδρομής','tours.paddle.boat': 'Σκάφος','tours.paddle.boat.kayak': 'Καγιάκ',diff --git a/shared/src/i18n/hu/tours.ts b/shared/src/i18n/hu/tours.tsindex 40477da39..2778707d0 100644--- a/shared/src/i18n/hu/tours.ts+++ b/shared/src/i18n/hu/tours.ts@@ -298,6 +298,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Mentés új túraként','tours.revision.mineName': '{name} (saját változat)','tours.revision.reloaded': 'Ezt a túrát máshol mentették, most az újabb változat látszik.',+ 'tours.placePicker.open': 'Út helyei',+ 'tours.placePicker.search': 'Keresés az út helyei között',+ 'tours.placePicker.near': 'A túra közelében',+ 'tours.placePicker.further': 'Az út további helyei',+ 'tours.placePicker.all': 'Az út helyei',+ 'tours.placePicker.inTour': 'A túrában',+ 'tours.placePicker.empty': 'Ennek az útnak még nincs térképen elhelyezett helye.',+ 'tours.placePicker.noMatch': 'Egy hely sem felel meg a keresésnek.',+ 'tours.placePicker.linked': 'Az út helye',+ 'tours.placePicker.linkedHint':+ 'Ez a megálló az út egy helyét jelöli. Eltávolítása vagy a kapcsolat bontása nem változtat a helyen.',+ 'tours.placePicker.unlink': 'Leválasztás a helyről','tours.planner.tourType': 'Túratípus','tours.paddle.boat': 'Hajó','tours.paddle.boat.kayak': 'Kajak',diff --git a/shared/src/i18n/id/tours.ts b/shared/src/i18n/id/tours.tsindex 287553d37..7078ef9a3 100644--- a/shared/src/i18n/id/tours.ts+++ b/shared/src/i18n/id/tours.ts@@ -291,6 +291,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Simpan sebagai tur baru','tours.revision.mineName': '{name} (versiku)','tours.revision.reloaded': 'Tur ini disimpan di tempat lain dan kini menampilkan versi terbaru.',+ 'tours.placePicker.open': 'Tempat perjalanan',+ 'tours.placePicker.search': 'Cari tempat perjalanan',+ 'tours.placePicker.near': 'Dekat tur',+ 'tours.placePicker.further': 'Tempat lain dalam perjalanan',+ 'tours.placePicker.all': 'Tempat dalam perjalanan',+ 'tours.placePicker.inTour': 'Di tur',+ 'tours.placePicker.empty': 'Perjalanan ini belum punya tempat dengan lokasi di peta.',+ 'tours.placePicker.noMatch': 'Tidak ada tempat yang cocok.',+ 'tours.placePicker.linked': 'Tempat perjalanan',+ 'tours.placePicker.linkedHint':+ 'Pemberhentian ini mewakili tempat dalam perjalanan. Menghapus atau melepas tautannya tidak mengubah tempat itu.',+ 'tours.placePicker.unlink': 'Lepas dari tempat','tours.planner.tourType': 'Jenis tur','tours.paddle.boat': 'Perahu','tours.paddle.boat.kayak': 'Kayak', // same-as-endiff --git a/shared/src/i18n/it/tours.ts b/shared/src/i18n/it/tours.tsindex e1a252e4d..afd8ce7b7 100644--- a/shared/src/i18n/it/tours.ts+++ b/shared/src/i18n/it/tours.ts@@ -298,6 +298,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Salva come nuovo tour','tours.revision.mineName': '{name} (la mia versione)','tours.revision.reloaded': 'Questo tour è stato salvato altrove e ora mostra la versione più recente.',+ 'tours.placePicker.open': 'Luoghi del viaggio',+ 'tours.placePicker.search': 'Cerca tra i luoghi del viaggio',+ 'tours.placePicker.near': 'Vicino al tour',+ 'tours.placePicker.further': 'Altri luoghi del viaggio',+ 'tours.placePicker.all': 'Luoghi del viaggio',+ 'tours.placePicker.inTour': 'Nel tour',+ 'tours.placePicker.empty': 'Questo viaggio non ha ancora luoghi con una posizione sulla mappa.',+ 'tours.placePicker.noMatch': 'Nessun luogo corrisponde alla ricerca.',+ 'tours.placePicker.linked': 'Luogo del viaggio',+ 'tours.placePicker.linkedHint':+ 'Questa tappa rappresenta un luogo del viaggio. Toglierla o sciogliere il collegamento non cambia il luogo.',+ 'tours.placePicker.unlink': 'Scollega dal luogo','tours.planner.tourType': 'Tipo di tour','tours.paddle.boat': 'Imbarcazione','tours.paddle.boat.kayak': 'Kayak', // same-as-endiff --git a/shared/src/i18n/ja/tours.ts b/shared/src/i18n/ja/tours.tsindex 369762e2a..813317983 100644--- a/shared/src/i18n/ja/tours.ts+++ b/shared/src/i18n/ja/tours.ts@@ -284,6 +284,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': '新しいツアーとして保存','tours.revision.mineName': '{name}(自分の版)','tours.revision.reloaded': 'このツアーは別の場所で保存されたため、新しい版を表示しています。',+ 'tours.placePicker.open': '旅の場所',+ 'tours.placePicker.search': '旅の場所を検索',+ 'tours.placePicker.near': 'ツアーの近く',+ 'tours.placePicker.further': '旅のその他の場所',+ 'tours.placePicker.all': '旅の場所',+ 'tours.placePicker.inTour': 'ツアー内',+ 'tours.placePicker.empty': 'この旅にはまだ地図上の位置がある場所がありません。',+ 'tours.placePicker.noMatch': '検索に一致する場所はありません。',+ 'tours.placePicker.linked': '旅の場所',+ 'tours.placePicker.linkedHint': 'この地点は旅の場所を表しています。削除やリンク解除をしても場所は変わりません。',+ 'tours.placePicker.unlink': '場所とのリンクを解除','tours.planner.tourType': 'ツアーの種類','tours.paddle.boat': 'ボート','tours.paddle.boat.kayak': 'カヤック',diff --git a/shared/src/i18n/ko/tours.ts b/shared/src/i18n/ko/tours.tsindex 129dcc2e8..9db09c52f 100644--- a/shared/src/i18n/ko/tours.ts+++ b/shared/src/i18n/ko/tours.ts@@ -283,6 +283,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': '새 투어로 저장','tours.revision.mineName': '{name} (내 버전)','tours.revision.reloaded': '이 투어가 다른 곳에서 저장되어 새 버전을 표시합니다.',+ 'tours.placePicker.open': '여행 장소',+ 'tours.placePicker.search': '여행 장소 검색',+ 'tours.placePicker.near': '투어 근처',+ 'tours.placePicker.further': '여행의 다른 장소',+ 'tours.placePicker.all': '여행 장소',+ 'tours.placePicker.inTour': '투어에 있음',+ 'tours.placePicker.empty': '이 여행에는 아직 지도에 위치가 있는 장소가 없습니다.',+ 'tours.placePicker.noMatch': '검색과 일치하는 장소가 없습니다.',+ 'tours.placePicker.linked': '여행 장소',+ 'tours.placePicker.linkedHint': '이 정류지는 여행 장소를 나타냅니다. 지우거나 연결을 풀어도 장소는 바뀌지 않습니다.',+ 'tours.placePicker.unlink': '장소와 연결 해제','tours.planner.tourType': '투어 유형','tours.paddle.boat': '보트','tours.paddle.boat.kayak': '카약',diff --git a/shared/src/i18n/nl/tours.ts b/shared/src/i18n/nl/tours.tsindex 0a4e4f1e7..f21728c79 100644--- a/shared/src/i18n/nl/tours.ts+++ b/shared/src/i18n/nl/tours.ts@@ -299,6 +299,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Opslaan als nieuwe tocht','tours.revision.mineName': '{name} (mijn versie)','tours.revision.reloaded': 'Deze tocht is elders opgeslagen en toont nu de nieuwere versie.',+ 'tours.placePicker.open': 'Reisplekken',+ 'tours.placePicker.search': 'Plekken van de reis doorzoeken',+ 'tours.placePicker.near': 'Dicht bij de tocht',+ 'tours.placePicker.further': 'Meer plekken van de reis',+ 'tours.placePicker.all': 'Plekken van de reis',+ 'tours.placePicker.inTour': 'In de tocht',+ 'tours.placePicker.empty': 'Deze reis heeft nog geen plekken met een locatie op de kaart.',+ 'tours.placePicker.noMatch': 'Geen plek past bij de zoekopdracht.',+ 'tours.placePicker.linked': 'Plek van de reis',+ 'tours.placePicker.linkedHint':+ 'Deze stop staat voor een plek van de reis. Verwijderen of de koppeling opheffen laat de plek zoals ze is.',+ 'tours.placePicker.unlink': 'Loskoppelen van de plek','tours.planner.tourType': 'Soort tocht','tours.paddle.boat': 'Boot','tours.paddle.boat.kayak': 'Kajak',diff --git a/shared/src/i18n/pl/tours.ts b/shared/src/i18n/pl/tours.tsindex f2758038d..56f79f318 100644--- a/shared/src/i18n/pl/tours.ts+++ b/shared/src/i18n/pl/tours.ts@@ -305,6 +305,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Zapisz jako nową trasę','tours.revision.mineName': '{name} (moja wersja)','tours.revision.reloaded': 'Ta trasa została zapisana gdzie indziej i teraz pokazuje nowszą wersję.',+ 'tours.placePicker.open': 'Miejsca podróży',+ 'tours.placePicker.search': 'Szukaj w miejscach podróży',+ 'tours.placePicker.near': 'W pobliżu trasy',+ 'tours.placePicker.further': 'Inne miejsca podróży',+ 'tours.placePicker.all': 'Miejsca podróży',+ 'tours.placePicker.inTour': 'W trasie',+ 'tours.placePicker.empty': 'Ta podróż nie ma jeszcze miejsc z lokalizacją na mapie.',+ 'tours.placePicker.noMatch': 'Żadne miejsce nie pasuje do wyszukiwania.',+ 'tours.placePicker.linked': 'Miejsce podróży',+ 'tours.placePicker.linkedHint':+ 'Ten przystanek oznacza miejsce podróży. Usunięcie go lub rozłączenie nie zmienia miejsca.',+ 'tours.placePicker.unlink': 'Odłącz od miejsca','tours.planner.tourType': 'Rodzaj wycieczki','tours.paddle.boat': 'Łódź','tours.paddle.boat.kayak': 'Kajak',diff --git a/shared/src/i18n/ru/tours.ts b/shared/src/i18n/ru/tours.tsindex ae102e7c2..dd18786b5 100644--- a/shared/src/i18n/ru/tours.ts+++ b/shared/src/i18n/ru/tours.ts@@ -308,6 +308,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Сохранить как новый поход','tours.revision.mineName': '{name} (моя версия)','tours.revision.reloaded': 'Этот поход сохранили в другом месте, теперь показана новая версия.',+ 'tours.placePicker.open': 'Места поездки',+ 'tours.placePicker.search': 'Поиск по местам поездки',+ 'tours.placePicker.near': 'Рядом с походом',+ 'tours.placePicker.further': 'Другие места поездки',+ 'tours.placePicker.all': 'Места поездки',+ 'tours.placePicker.inTour': 'В походе',+ 'tours.placePicker.empty': 'В этой поездке пока нет мест с положением на карте.',+ 'tours.placePicker.noMatch': 'Ни одно место не подходит под поиск.',+ 'tours.placePicker.linked': 'Место поездки',+ 'tours.placePicker.linkedHint': 'Эта остановка обозначает место поездки. Удаление или отвязка не меняют само место.',+ 'tours.placePicker.unlink': 'Отвязать от места','tours.planner.tourType': 'Тип тура','tours.paddle.boat': 'Лодка','tours.paddle.boat.kayak': 'Каяк',diff --git a/shared/src/i18n/sk/tours.ts b/shared/src/i18n/sk/tours.tsindex 7f0faaf20..b3d6d86a7 100644--- a/shared/src/i18n/sk/tours.ts+++ b/shared/src/i18n/sk/tours.ts@@ -293,6 +293,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Uložiť ako novú túru','tours.revision.mineName': '{name} (moja verzia)','tours.revision.reloaded': 'Túra bola uložená inde a teraz zobrazuje novšiu verziu.',+ 'tours.placePicker.open': 'Miesta cesty',+ 'tours.placePicker.search': 'Hľadať v miestach cesty',+ 'tours.placePicker.near': 'Blízko túry',+ 'tours.placePicker.further': 'Ďalšie miesta cesty',+ 'tours.placePicker.all': 'Miesta cesty',+ 'tours.placePicker.inTour': 'V túre',+ 'tours.placePicker.empty': 'Táto cesta zatiaľ nemá miesta s polohou na mape.',+ 'tours.placePicker.noMatch': 'Hľadaniu nezodpovedá žiadne miesto.',+ 'tours.placePicker.linked': 'Miesto cesty',+ 'tours.placePicker.linkedHint':+ 'Táto zastávka predstavuje miesto cesty. Odstránenie alebo zrušenie prepojenia miesto nezmení.',+ 'tours.placePicker.unlink': 'Odpojiť od miesta','tours.planner.tourType': 'Typ túry','tours.paddle.boat': 'Loď','tours.paddle.boat.kayak': 'Kajak',diff --git a/shared/src/i18n/sv/tours.ts b/shared/src/i18n/sv/tours.tsindex ff8197e2c..e2f170b0f 100644--- a/shared/src/i18n/sv/tours.ts+++ b/shared/src/i18n/sv/tours.ts@@ -290,6 +290,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Spara som ny tur','tours.revision.mineName': '{name} (min version)','tours.revision.reloaded': 'Turen sparades någon annanstans och visar nu den nyare versionen.',+ 'tours.placePicker.open': 'Resans platser',+ 'tours.placePicker.search': 'Sök bland resans platser',+ 'tours.placePicker.near': 'Nära turen',+ 'tours.placePicker.further': 'Fler platser på resan',+ 'tours.placePicker.all': 'Resans platser',+ 'tours.placePicker.inTour': 'I turen',+ 'tours.placePicker.empty': 'Den här resan har inga platser med läge på kartan än.',+ 'tours.placePicker.noMatch': 'Ingen plats matchar sökningen.',+ 'tours.placePicker.linked': 'Plats på resan',+ 'tours.placePicker.linkedHint':+ 'Det här stoppet står för en plats på resan. Att ta bort det eller lösa kopplingen ändrar inte platsen.',+ 'tours.placePicker.unlink': 'Lossa från platsen','tours.planner.tourType': 'Turtyp','tours.paddle.boat': 'Båt','tours.paddle.boat.kayak': 'Kajak',diff --git a/shared/src/i18n/th/tours.ts b/shared/src/i18n/th/tours.tsindex 694bf718d..201c014ec 100644--- a/shared/src/i18n/th/tours.ts+++ b/shared/src/i18n/th/tours.ts@@ -279,6 +279,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'บันทึกเป็นทัวร์ใหม่','tours.revision.mineName': '{name} (เวอร์ชันของฉัน)','tours.revision.reloaded': 'ทัวร์นี้ถูกบันทึกจากที่อื่น ตอนนี้แสดงเวอร์ชันที่ใหม่กว่า',+ 'tours.placePicker.open': 'สถานที่ในทริป',+ 'tours.placePicker.search': 'ค้นหาสถานที่ในทริป',+ 'tours.placePicker.near': 'ใกล้ทัวร์',+ 'tours.placePicker.further': 'สถานที่อื่นในทริป',+ 'tours.placePicker.all': 'สถานที่ในทริป',+ 'tours.placePicker.inTour': 'อยู่ในทัวร์',+ 'tours.placePicker.empty': 'ทริปนี้ยังไม่มีสถานที่ที่มีตำแหน่งบนแผนที่',+ 'tours.placePicker.noMatch': 'ไม่มีสถานที่ที่ตรงกับการค้นหา',+ 'tours.placePicker.linked': 'สถานที่ในทริป',+ 'tours.placePicker.linkedHint': 'จุดแวะนี้แทนสถานที่หนึ่งในทริป การลบหรือยกเลิกการเชื่อมโยงจะไม่เปลี่ยนสถานที่นั้น',+ 'tours.placePicker.unlink': 'ยกเลิกการเชื่อมกับสถานที่','tours.planner.tourType': 'ประเภททริป','tours.paddle.boat': 'เรือ','tours.paddle.boat.kayak': 'เรือคายัก',diff --git a/shared/src/i18n/tr/tours.ts b/shared/src/i18n/tr/tours.tsindex 6eee9f414..780e1b7f1 100644--- a/shared/src/i18n/tr/tours.ts+++ b/shared/src/i18n/tr/tours.ts@@ -292,6 +292,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Yeni tur olarak kaydet','tours.revision.mineName': '{name} (benim sürümüm)','tours.revision.reloaded': 'Bu tur başka yerde kaydedildi ve şimdi daha yeni sürümü gösteriliyor.',+ 'tours.placePicker.open': 'Gezi yerleri',+ 'tours.placePicker.search': 'Gezinin yerlerinde ara',+ 'tours.placePicker.near': 'Tura yakın',+ 'tours.placePicker.further': 'Gezinin diğer yerleri',+ 'tours.placePicker.all': 'Gezinin yerleri',+ 'tours.placePicker.inTour': 'Turda',+ 'tours.placePicker.empty': 'Bu gezide henüz haritada konumu olan yer yok.',+ 'tours.placePicker.noMatch': 'Aramayla eşleşen yer yok.',+ 'tours.placePicker.linked': 'Gezinin yeri',+ 'tours.placePicker.linkedHint':+ 'Bu durak gezinin bir yerini temsil eder. Kaldırmak ya da bağlantıyı çözmek yeri değiştirmez.',+ 'tours.placePicker.unlink': 'Yerden ayır','tours.planner.tourType': 'Tur türü','tours.paddle.boat': 'Tekne','tours.paddle.boat.kayak': 'Kano (kayak)',diff --git a/shared/src/i18n/uk/tours.ts b/shared/src/i18n/uk/tours.tsindex 361f12059..60fa05f2d 100644--- a/shared/src/i18n/uk/tours.ts+++ b/shared/src/i18n/uk/tours.ts@@ -305,6 +305,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Зберегти як новий похід','tours.revision.mineName': '{name} (моя версія)','tours.revision.reloaded': 'Цей похід збережено деінде, тепер показано новішу версію.',+ 'tours.placePicker.open': 'Місця подорожі',+ 'tours.placePicker.search': 'Пошук серед місць подорожі',+ 'tours.placePicker.near': 'Поблизу походу',+ 'tours.placePicker.further': 'Інші місця подорожі',+ 'tours.placePicker.all': 'Місця подорожі',+ 'tours.placePicker.inTour': 'У поході',+ 'tours.placePicker.empty': 'У цій подорожі ще немає місць із розташуванням на мапі.',+ 'tours.placePicker.noMatch': 'Жодне місце не відповідає пошуку.',+ 'tours.placePicker.linked': 'Місце подорожі',+ 'tours.placePicker.linkedHint':+ 'Ця зупинка позначає місце подорожі. Видалення чи відв’язування не змінює саме місце.',+ 'tours.placePicker.unlink': 'Відв’язати від місця','tours.planner.tourType': 'Тип туру','tours.paddle.boat': 'Човен','tours.paddle.boat.kayak': 'Каяк',diff --git a/shared/src/i18n/vi/tours.ts b/shared/src/i18n/vi/tours.tsindex 9c381ce83..9b73e6ff7 100644--- a/shared/src/i18n/vi/tours.ts+++ b/shared/src/i18n/vi/tours.ts@@ -292,6 +292,18 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': 'Lưu thành chuyến mới','tours.revision.mineName': '{name} (bản của tôi)','tours.revision.reloaded': 'Chuyến đi bộ này đã được lưu ở nơi khác và giờ hiển thị bản mới hơn.',+ 'tours.placePicker.open': 'Địa điểm chuyến đi',+ 'tours.placePicker.search': 'Tìm trong địa điểm chuyến đi',+ 'tours.placePicker.near': 'Gần chuyến đi bộ',+ 'tours.placePicker.further': 'Địa điểm khác của chuyến đi',+ 'tours.placePicker.all': 'Địa điểm của chuyến đi',+ 'tours.placePicker.inTour': 'Trong chuyến',+ 'tours.placePicker.empty': 'Chuyến đi này chưa có địa điểm nào có vị trí trên bản đồ.',+ 'tours.placePicker.noMatch': 'Không có địa điểm nào khớp với tìm kiếm.',+ 'tours.placePicker.linked': 'Địa điểm của chuyến đi',+ 'tours.placePicker.linkedHint':+ 'Điểm dừng này đại diện cho một địa điểm của chuyến đi. Xóa hoặc bỏ liên kết không làm thay đổi địa điểm.',+ 'tours.placePicker.unlink': 'Bỏ liên kết với địa điểm','tours.planner.tourType': 'Loại chuyến','tours.paddle.boat': 'Thuyền','tours.paddle.boat.kayak': 'Thuyền kayak',diff --git a/shared/src/i18n/zh-TW/tours.ts b/shared/src/i18n/zh-TW/tours.tsindex 9cf3ba7be..de968464a 100644--- a/shared/src/i18n/zh-TW/tours.ts+++ b/shared/src/i18n/zh-TW/tours.ts@@ -267,6 +267,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': '另存為新遊程','tours.revision.mineName': '{name}(我的版本)','tours.revision.reloaded': '這個遊程已在別處儲存,現在顯示較新的版本。',+ 'tours.placePicker.open': '行程地點',+ 'tours.placePicker.search': '搜尋行程地點',+ 'tours.placePicker.near': '遊程附近',+ 'tours.placePicker.further': '行程中的其他地點',+ 'tours.placePicker.all': '行程地點',+ 'tours.placePicker.inTour': '已在遊程中',+ 'tours.placePicker.empty': '這個行程還沒有在地圖上有位置的地點。',+ 'tours.placePicker.noMatch': '沒有符合搜尋的地點。',+ 'tours.placePicker.linked': '行程地點',+ 'tours.placePicker.linkedHint': '此站點代表行程中的一個地點。移除或解除連結不會改變該地點。',+ 'tours.placePicker.unlink': '解除與地點的連結','tours.planner.tourType': '路線類型','tours.paddle.boat': '船隻','tours.paddle.boat.kayak': '獨木舟(Kayak)',diff --git a/shared/src/i18n/zh/tours.ts b/shared/src/i18n/zh/tours.tsindex 884a54163..4fce09eb7 100644--- a/shared/src/i18n/zh/tours.ts+++ b/shared/src/i18n/zh/tours.ts@@ -268,6 +268,17 @@ const tours: TranslationStrings = {'tours.revision.saveAsNew': '另存为新路线','tours.revision.mineName': '{name}(我的版本)','tours.revision.reloaded': '这条路线已在别处保存,现在显示较新的版本。',+ 'tours.placePicker.open': '行程地点',+ 'tours.placePicker.search': '搜索行程地点',+ 'tours.placePicker.near': '路线附近',+ 'tours.placePicker.further': '行程中的其他地点',+ 'tours.placePicker.all': '行程地点',+ 'tours.placePicker.inTour': '已在路线中',+ 'tours.placePicker.empty': '这个行程还没有在地图上有位置的地点。',+ 'tours.placePicker.noMatch': '没有符合搜索的地点。',+ 'tours.placePicker.linked': '行程地点',+ 'tours.placePicker.linkedHint': '此站点代表行程中的一个地点。移除或解除关联不会改变该地点。',+ 'tours.placePicker.unlink': '解除与地点的关联','tours.planner.tourType': '路线类型','tours.paddle.boat': '船只','tours.paddle.boat.kayak': '皮划艇',diff --git a/shared/src/index.ts b/shared/src/index.tsindex 94d008a34..d0e03499a 100644--- a/shared/src/index.ts+++ b/shared/src/index.ts@@ -63,6 +63,7 @@ export * from './tours/paddle-plan';export * from './tours/paddle-check.schema';export * from './tours/paddle-check-basis';export * from './tours/paddle-check';+export * from './tours/route-corridor';export * from './wanderer/wanderer.schema';export * from './geo/haversine';export * from './collection/collection.schema';diff --git a/shared/src/tours/route-corridor.spec.ts b/shared/src/tours/route-corridor.spec.tsnew file mode 100644index 000000000..f5b733708--- /dev/null+++ b/shared/src/tours/route-corridor.spec.ts@@ -0,0 +1,43 @@+import { nearnessToLine } from './route-corridor';++import { describe, expect, it } from 'vitest';++describe('nearnessToLine', () => {+ // A line running north along 11° E for about 2.2 km.+ const line = [+ [47, 11],+ [47.01, 11],+ [47.02, 11],+ ];++ it('measures a point beside the line square to it, and how far along its foot lies', () => {+ const near = nearnessToLine({ lat: 47.015, lng: 11.001 }, line);+ expect(near?.distanceM).toBeGreaterThan(70);+ expect(near?.distanceM).toBeLessThan(80);+ expect(near?.alongM).toBeGreaterThan(1650);+ expect(near?.alongM).toBeLessThan(1690);+ });++ it('measures a point past an end from that end', () => {+ const near = nearnessToLine({ lat: 46.99, lng: 11 }, line);+ expect(near?.alongM).toBe(0);+ expect(near?.distanceM).toBeGreaterThan(1100);+ expect(near?.distanceM).toBeLessThan(1120);+ });++ it('takes heights along without minding them, and answers nothing for a line too short', () => {+ expect(+ nearnessToLine({ lat: 47, lng: 11 }, [+ [47, 11, 900],+ [47.01, 11, 950],+ ])?.distanceM,+ ).toBe(0);+ expect(nearnessToLine({ lat: 47, lng: 11 }, [[47, 11]])).toBeNull();+ expect(+ nearnessToLine({ lat: 47, lng: 11 }, [+ [47, 11],+ [47, 11],+ ])?.distanceM,+ ).toBe(0);+ });+});diff --git a/shared/src/tours/route-corridor.ts b/shared/src/tours/route-corridor.tsnew file mode 100644index 000000000..8795bd47c--- /dev/null+++ b/shared/src/tours/route-corridor.ts@@ -0,0 +1,50 @@+/**+ * Where a point lies against a route: how far it is from the line and how far+ * along the line its nearest spot is, both in metres. A tour spans a few tens+ * of kilometres at most, so the line is laid flat around its own latitude,+ * which is exact to well under a metre at that span.+ *+ * Shared by the planner's place picker (PR1-10) and the search for places+ * along a route (PR1-11A), so both measure the corridor the same way.+ */++const EARTH_M = 6_371_000;+const RAD = Math.PI / 180;++type Coordinate = readonly [number, number, ...number[]] | readonly number[];++export interface RouteNearness {+ /** Metres from the point to the nearest spot of the line. */+ distanceM: number;+ /** Metres along the line to that spot. */+ alongM: number;+}++function flatten(line: readonly Coordinate[]) {+ const meanLat = line.reduce((sum, p) => sum + Number(p[0]), 0) / Math.max(line.length, 1);+ const kx = Math.cos(meanLat * RAD) * EARTH_M * RAD;+ const ky = EARTH_M * RAD;+ return (lat: number, lng: number): [number, number] => [lng * kx, lat * ky];+}++/** How near the point is to a line of `[lat, lng]` points; null for a line of fewer than two. */+export function nearnessToLine(point: { lat: number; lng: number }, line: readonly Coordinate[]): RouteNearness | null {+ if (line.length < 2) return null;+ const flat = flatten(line);+ const [px, py] = flat(point.lat, point.lng);+ let best: RouteNearness | null = null;+ let walked = 0;+ const points = line.map((p) => flat(Number(p[0]), Number(p[1])));+ for (let i = 1; i < points.length; i += 1) {+ const [ax, ay] = points[i - 1] as [number, number];+ const [bx, by] = points[i] as [number, number];+ const dx = bx - ax;+ const dy = by - ay;+ const length2 = dx * dx + dy * dy;+ const t = length2 === 0 ? 0 : Math.max(0, Math.min(1, ((px - ax) * dx + (py - ay) * dy) / length2));+ const distanceM = Math.hypot(px - (ax + t * dx), py - (ay + t * dy));+ if (!best || distanceM < best.distanceM) best = { distanceM, alongM: walked + t * Math.sqrt(length2) };+ walked += Math.sqrt(length2);+ }+ return best;+}diff --git a/shared/src/tours/tours.schema.ts b/shared/src/tours/tours.schema.tsindex 64c28c121..de42db7c0 100644--- a/shared/src/tours/tours.schema.ts+++ b/shared/src/tours/tours.schema.ts@@ -258,6 +258,12 @@ export const tourWaypointSchema = z.object({* to get in or out. Absent means a stop, as every point saved before was.*/shaping: z.boolean().optional(),+ /**+ * PR1-10: the place of the trip this point stands for, chosen on purpose.+ * The point keeps its own coordinates and the place stays a place; a place+ * that is gone (or not of this trip) leaves the point unlinked.+ */+ linked_place_id: z.number().int().positive().nullable().optional(),});export type TourWaypoint = z.infer<typeof tourWaypointSchema>;