Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(tours): keep the place card open while its position is picked, with slots, a map preview and undo

Maurice377619abd169
diff --git a/client/src/components/Map/useMapCardDismiss.test.tsx b/client/src/components/Map/useMapCardDismiss.test.tsx
new file mode 100644
index 000000000..c8463599b
--- /dev/null
+++ b/client/src/components/Map/useMapCardDismiss.test.tsx
@@ -0,0 +1,75 @@
+import { useRef, useState } from 'react';
+import { describe, expect, it, vi } from 'vitest';
+import { fireEvent, render, screen, within } from '../../../tests/helpers/render';
+import { PillSelect } from '../shared/dialogParts';
+import { useMapCardDismiss } from './useMapCardDismiss';
+
+// FE-MAP-CARD-DISMISS-001 to FE-MAP-CARD-DISMISS-004
+
+const OPTIONS = [
+ { value: 'a', label: 'First' },
+ { value: 'b', label: 'Last' },
+];
+
+/** A card over the map with a pick list in it, as the place card has its position. */
+function Card({ onClose, onOutsidePress }: { onClose: () => void; onOutsidePress?: () => void }) {
+ const ref = useRef<HTMLDivElement>(null);
+ const [value, setValue] = useState('a');
+ useMapCardDismiss(ref, true, onClose, onOutsidePress);
+ return (
+ <>
+ <div ref={ref} data-testid="card">
+ <PillSelect label="Position" value={value} options={OPTIONS} onChange={setValue} />
+ <span data-testid="value">{value}</span>
+ </div>
+ <button type="button">elsewhere</button>
+ </>
+ );
+}
+
+describe('useMapCardDismiss', () => {
+ it('FE-MAP-CARD-DISMISS-001: a press inside the card leaves it open', () => {
+ const onClose = vi.fn();
+ render(<Card onClose={onClose} />);
+ fireEvent.pointerDown(screen.getByTestId('value'));
+ expect(onClose).not.toHaveBeenCalled();
+ });
+
+ it('FE-MAP-CARD-DISMISS-002: picking from a list the card opened is no press outside, whichever option it is', () => {
+ const onClose = vi.fn();
+ const onOutsidePress = vi.fn();
+ render(<Card onClose={onClose} onOutsidePress={onOutsidePress} />);
+ fireEvent.click(within(screen.getByTestId('card')).getByRole('button', { name: /Position/ }));
+ const list = screen.getByRole('group', { name: 'Position' });
+ // The list is laid over the page, outside the card.
+ expect(screen.getByTestId('card')).not.toContainElement(list);
+ const last = within(list).getByRole('button', { name: 'Last' });
+ fireEvent.pointerDown(last);
+ fireEvent.mouseDown(last);
+ fireEvent.click(last);
+ expect(onClose).not.toHaveBeenCalled();
+ expect(onOutsidePress).not.toHaveBeenCalled();
+ expect(screen.getByTestId('value')).toHaveTextContent('b');
+ });
+
+ it('FE-MAP-CARD-DISMISS-003: a press outside both closes the card and is handed on', () => {
+ const onClose = vi.fn();
+ const onOutsidePress = vi.fn();
+ render(<Card onClose={onClose} onOutsidePress={onOutsidePress} />);
+ fireEvent.click(within(screen.getByTestId('card')).getByRole('button', { name: /Position/ }));
+ fireEvent.pointerDown(screen.getByRole('button', { name: 'elsewhere' }));
+ expect(onClose).toHaveBeenCalledTimes(1);
+ expect(onOutsidePress).toHaveBeenCalledTimes(1);
+ });
+
+ it('FE-MAP-CARD-DISMISS-004: Escape closes the open list first and the card only on the next one', () => {
+ const onClose = vi.fn();
+ render(<Card onClose={onClose} />);
+ fireEvent.click(within(screen.getByTestId('card')).getByRole('button', { name: /Position/ }));
+ fireEvent.keyDown(screen.getByRole('group', { name: 'Position' }), { key: 'Escape' });
+ expect(screen.queryByRole('group', { name: 'Position' })).not.toBeInTheDocument();
+ expect(onClose).not.toHaveBeenCalled();
+ fireEvent.keyDown(document, { key: 'Escape' });
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/client/src/components/Map/useMapCardDismiss.ts b/client/src/components/Map/useMapCardDismiss.ts
index a9aaa9b92..81036f40d 100644
--- a/client/src/components/Map/useMapCardDismiss.ts
+++ b/client/src/components/Map/useMapCardDismiss.ts
@@ -1,5 +1,19 @@
import { useEffect, type RefObject } from 'react';
+/**
+ * Whether a press lands in a list one of the card's own buttons has open
+ * (PillSelect, CustomSelect): such a list is laid over the page outside the
+ * card, but picking from it is still working in the card. Read at the press,
+ * as a list opens and closes while the card stays.
+ */
+function inListOpenedFrom(card: HTMLElement, target: Node): boolean {
+ for (const trigger of card.querySelectorAll('[aria-expanded="true"][aria-controls]')) {
+ const list = document.getElementById(trigger.getAttribute('aria-controls') ?? '');
+ if (list?.contains(target)) return true;
+ }
+ return false;
+}
+
/**
* Closes a card floating over the map on a press anywhere outside it and on
* Escape, while it is open. The press outside is handed to `onOutsidePress`
@@ -17,7 +31,8 @@ export function useMapCardDismiss(
if (!open) return;
const onDown = (event: PointerEvent) => {
const card = ref.current;
- if (card && event.target instanceof Node && card.contains(event.target)) return;
+ if (card && event.target instanceof Node && (card.contains(event.target) || inListOpenedFrom(card, event.target)))
+ return;
onOutsidePress?.();
onClose();
};
diff --git a/client/src/components/Tours/poi/TourPoiCard.tsx b/client/src/components/Tours/poi/TourPoiCard.tsx
index 5694d524c..046008293 100644
--- a/client/src/components/Tours/poi/TourPoiCard.tsx
+++ b/client/src/components/Tours/poi/TourPoiCard.tsx
@@ -1,6 +1,6 @@
import type { TourPoi, WalkTheme } from '@trek/shared';
import { WALK_THEMES } from '@trek/shared';
-import { Clock, ExternalLink, MoveHorizontal, Plus, Route, Star, X } from 'lucide-react';
+import { Clock, ExternalLink, MoveHorizontal, Route, Star, X } from 'lucide-react';
import { useCallback, useRef } from 'react';
import { useTranslation } from '../../../i18n';
import { useSettingsStore } from '../../../store/settingsStore';
@@ -10,10 +10,9 @@ import { MAP_CARD_GLASS } from '../../Map/mapControlShadow';
import { TOUR_POI_LOOKS } from '../../Map/poiCategories';
import { useMapCardDismiss } from '../../Map/useMapCardDismiss';
import { SoftPill, WhiteBadge } from '../../Planner/planParts';
-import { PillSelect } from '../../shared/dialogParts';
import { fs } from '../../shared/DialogShell';
import type { TourPlannerController } from '../planner/useTourPlanner';
-import { useWaypointPlaceNames } from '../planner/useWaypointPlaceNames';
+import { TourPoiSlotPicker } from './TourPoiSlotPicker';
import { usePoiInsertion } from './usePoiInsertion';
import { useSelectedPoi } from './useTourPoiSearch';
@@ -21,62 +20,6 @@ type Unit = Parameters<typeof formatDistance>[1];
const km = (metres: number) => metres / 1000;
-/** The point a place would follow, picked from the tour's points, with why one cannot take it. */
-function AfterPicker({
- planner,
- poi,
- insertion,
-}: {
- planner: TourPlannerController;
- poi: TourPoi;
- insertion: ReturnType<typeof usePoiInsertion>;
-}) {
- const { t } = useTranslation();
- const names = useWaypointPlaceNames(planner.waypoints);
- const afterId = insertion.afterIdFor(poi);
- const options = planner.waypoints.map((point, index) => ({
- value: point.id,
- label: `${index + 1}. ${point.shaping ? t('tours.planner.shapingPoint') : (names[point.id] ?? `${point.lat.toFixed(4)}, ${point.lng.toFixed(4)}`)}`,
- }));
- const block = afterId ? insertion.blockOf(afterId) : 'none';
- const locked = !planner.canEdit || planner.isSaving;
- return (
- <div className="mt-3 flex flex-col gap-2 border-t border-edge-faint pt-3" data-testid="tour-poi-insert">
- <div className="flex min-w-0 items-center gap-2">
- <span className="flex-none text-content-muted" style={fs(11.5, 'body')}>
- {t('tours.poi.addAfter')}
- </span>
- <div className="min-w-0 flex-1">
- <PillSelect
- quiet
- label={t('tours.poi.addAfter')}
- value={afterId ?? ''}
- options={options}
- onChange={(value) => insertion.chooseAfter(poi, value)}
- />
- </div>
- </div>
- {block && (
- <p className="m-0 text-warning" style={fs(11, 'body')}>
- {t(`tours.poi.blocked.${block}`)}
- </p>
- )}
- <button
- type="button"
- disabled={!!block || locked}
- onClick={() => insertion.insert(poi)}
- data-testid="tour-poi-add"
- title={t('tours.poi.notAPlace')}
- className="inline-flex h-8 items-center justify-center gap-1.5 rounded-[10px] bg-accent px-3 font-semibold text-accent-text shadow-sm transition-opacity hover:opacity-90 disabled:cursor-default disabled:opacity-40"
- style={fs(12, 'body')}
- >
- <Plus size={14} strokeWidth={2.2} />
- {t('tours.poi.add')}
- </button>
- </div>
- );
-}
-
/** What the source says about the place: its address, its opening hours as written, and its website. */
function PoiFacts({ poi }: { poi: TourPoi }) {
const { t } = useTranslation();
@@ -192,7 +135,7 @@ function TourPoiCard({
</WhiteBadge>
</div>
<PoiFacts poi={poi} />
- <AfterPicker planner={planner} poi={poi} insertion={insertion} />
+ <TourPoiSlotPicker planner={planner} poi={poi} insertion={insertion} unit={unit} />
<p className="mt-2 flex flex-wrap gap-x-3 text-content-faint" style={fs(10.5, 'body')}>
{suggested && <span>{t('tours.walk.themeReason', { theme: t(`tours.walk.theme.${suggested}`) })}</span>}
<span>{t(poi.source === 'trek-places' ? 'tours.poi.source.trek' : 'tours.poi.source.osm')}</span>
diff --git a/client/src/components/Tours/poi/TourPoiSearchCard.tsx b/client/src/components/Tours/poi/TourPoiSearchCard.tsx
index 93e7e6b57..14e06c16f 100644
--- a/client/src/components/Tours/poi/TourPoiSearchCard.tsx
+++ b/client/src/components/Tours/poi/TourPoiSearchCard.tsx
@@ -12,6 +12,7 @@ import {
Shuffle,
Star,
Trees,
+ Undo2,
WifiOff,
X,
type LucideIcon,
@@ -247,8 +248,21 @@ function PoiRow({ poi, selected, unit }: { poi: TourPoi; selected: boolean; unit
);
}
-/** What taking a place in did: being planned, the route's change, or that it could not be told. */
-function OutcomeNotice({ outcome, onDismiss, unit }: { outcome: InsertionOutcome; onDismiss: () => void; unit: Unit }) {
+/**
+ * What taking a place in did: being planned, the route's change, or that it
+ * could not be told; with the way back while that step is the last one made.
+ */
+function OutcomeNotice({
+ outcome,
+ onDismiss,
+ onUndo,
+ unit,
+}: {
+ outcome: InsertionOutcome;
+ onDismiss: () => void;
+ onUndo: (() => void) | null;
+ unit: Unit;
+}) {
const { t } = useTranslation();
const signed = (value: string, negative: boolean) => `${negative ? '−' : '+'}${value}`;
return (
@@ -277,6 +291,18 @@ function OutcomeNotice({ outcome, onDismiss, unit }: { outcome: InsertionOutcome
)}
</>
)}
+ {onUndo && (
+ <button
+ type="button"
+ onClick={onUndo}
+ data-testid="tour-poi-undo"
+ className="inline-flex flex-none items-center gap-1 rounded-full px-1.5 font-semibold text-content hover:bg-surface-hover"
+ style={fs(11.5, 'body')}
+ >
+ <Undo2 size={12} strokeWidth={2.2} aria-hidden="true" />
+ {t('undo.button')}
+ </button>
+ )}
</span>
<button
type="button"
@@ -361,7 +387,14 @@ export function TourPoiSearchCard({ planner }: { planner: TourPlannerController
search.status === 'loading' ? 'tours.poi.searching' : search.answer ? 'tours.poi.again' : 'tours.poi.search'
)}
</button>
- {insertion.outcome && <OutcomeNotice outcome={insertion.outcome} onDismiss={insertion.dismiss} unit={unit} />}
+ {insertion.outcome && (
+ <OutcomeNotice
+ outcome={insertion.outcome}
+ onDismiss={insertion.dismiss}
+ onUndo={insertion.undo}
+ unit={unit}
+ />
+ )}
<SearchNotices search={search} unit={unit} />
{pois.length > 0 && (
<ul
diff --git a/client/src/components/Tours/poi/TourPoiSlotPicker.tsx b/client/src/components/Tours/poi/TourPoiSlotPicker.tsx
new file mode 100644
index 000000000..b1942ff63
--- /dev/null
+++ b/client/src/components/Tours/poi/TourPoiSlotPicker.tsx
@@ -0,0 +1,183 @@
+import type { TourPoi } from '@trek/shared';
+import { isClosedLoop } from '@trek/shared';
+import { ChevronDown, CornerDownRight, Flag, Info, Plus } from 'lucide-react';
+import { useTranslation } from '../../../i18n';
+import { formatDistance } from '../../../utils/units';
+import { PopoverItem } from '../../Packing/PackingPopover';
+import { SoftPill, WhiteBadge } from '../../Planner/planParts';
+import { PopoverListPanel } from '../../shared/dialogParts';
+import { fs } from '../../shared/DialogShell';
+import { Tooltip } from '../../shared/Tooltip';
+import { usePopoverList } from '../../shared/usePopoverList';
+import type { TourPlannerWaypoint } from '../planner/tourPlannerWaypoints';
+import type { TourPlannerController } from '../planner/useTourPlanner';
+import { useWaypointPlaceNames } from '../planner/useWaypointPlaceNames';
+import { insertionPreview, straightDetourM, type InsertionSlot } from './poiInsertion';
+import type { usePoiInsertion } from './usePoiInsertion';
+
+type Unit = Parameters<typeof formatDistance>[1];
+
+/**
+ * What each point is called in a slot: the name it carries or its place's,
+ * else its number among the stops as the map has it. A shaping point only
+ * steers; the way back of a loop is called as its start.
+ */
+function usePointLabels(points: TourPlannerWaypoint[]): Map<string, string> {
+ const { t } = useTranslation();
+ const names = useWaypointPlaceNames(points);
+ const labels = new Map<string, string>();
+ let stop = 0;
+ for (const point of points) {
+ if (point.shaping) {
+ labels.set(point.id, t('tours.planner.shapingPoint'));
+ continue;
+ }
+ stop += 1;
+ labels.set(point.id, point.name || names[point.id] || t('tours.planner.waypointLabel', { n: stop }));
+ }
+ const first = points[0];
+ const last = points[points.length - 1];
+ if (first && last && isClosedLoop(points)) labels.set(last.id, labels.get(first.id) ?? '');
+ return labels;
+}
+
+/**
+ * PLN-04: where a found place goes in, picked from the tour's slots: between
+ * two points, or after the last as the new end, which the list marks as
+ * making the tour longer. A slot that cannot take the place stays in the list,
+ * dimmed, with why. Each says roughly how much it adds; the add button takes
+ * the place in, and nothing changes before.
+ */
+export function TourPoiSlotPicker({
+ planner,
+ poi,
+ insertion,
+ unit,
+}: {
+ planner: TourPlannerController;
+ poi: TourPoi;
+ insertion: ReturnType<typeof usePoiInsertion>;
+ unit: Unit;
+}) {
+ const { t } = useTranslation();
+ const labels = usePointLabels(planner.waypoints);
+ const { slots } = insertion;
+ const afterId = insertion.afterIdFor(poi);
+ const chosen = slots.find((slot) => slot.afterId === afterId) ?? null;
+ const list = usePopoverList(chosen ? slots.indexOf(chosen) : 0);
+ const { open, toggle, triggerRef, listId } = list;
+ const labelOf = (slot: InsertionSlot) =>
+ slot.beforeId
+ ? t('tours.poi.slot.between', {
+ from: labels.get(slot.afterId) ?? '',
+ to: labels.get(slot.beforeId) ?? '',
+ })
+ : t('tours.poi.slot.newEnd');
+ const detourOf = (slot: InsertionSlot) => {
+ const line = insertionPreview(planner.waypoints, slot.afterId, poi);
+ return line ? `≈ +${formatDistance(straightDetourM(line) / 1000, unit)}` : null;
+ };
+ const block = chosen?.block ?? (afterId ? null : 'none');
+ const detour = chosen ? detourOf(chosen) : null;
+ const locked = !planner.canEdit || planner.isSaving;
+ return (
+ <div className="mt-3 flex flex-col gap-2 border-t border-edge-faint pt-3" data-testid="tour-poi-insert">
+ <span className="text-content-muted" style={fs(11.5, 'body')}>
+ {t('tours.poi.slot.label')}
+ </span>
+ <button
+ ref={triggerRef}
+ type="button"
+ onClick={toggle}
+ aria-expanded={open}
+ aria-controls={open ? listId : undefined}
+ data-testid="tour-poi-slot"
+ className="flex w-full min-w-0 items-center gap-2 rounded-[10px] border border-edge bg-surface-input px-2.5 py-1.5 text-start hover:border-content-faint"
+ >
+ <span className="sr-only">{t('tours.poi.slot.label')}: </span>
+ {chosen && !chosen.beforeId ? (
+ <Flag size={13} strokeWidth={2.2} aria-hidden="true" className="flex-none text-content-faint" />
+ ) : (
+ <CornerDownRight size={13} strokeWidth={2.2} aria-hidden="true" className="flex-none text-content-faint" />
+ )}
+ <span className="min-w-0 flex-1 truncate font-medium text-content" style={fs(12, 'body')}>
+ {chosen ? labelOf(chosen) : t('tours.poi.slot.label')}
+ </span>
+ <ChevronDown
+ size={14}
+ strokeWidth={2.2}
+ aria-hidden="true"
+ className={`flex-none text-content-faint transition-transform ${open ? 'rotate-180' : ''}`}
+ />
+ </button>
+ <PopoverListPanel list={list} label={t('tours.poi.slot.label')} className="min-w-[260px] max-w-[340px]">
+ {slots.map((slot) => {
+ const hint = slot.block ? null : detourOf(slot);
+ return (
+ <PopoverItem
+ key={slot.afterId}
+ icon={
+ slot.beforeId ? <CornerDownRight size={13} strokeWidth={2.2} /> : <Flag size={13} strokeWidth={2.2} />
+ }
+ label={labelOf(slot)}
+ active={slot === chosen}
+ muted={!!slot.block}
+ onClick={() => {
+ list.close();
+ insertion.chooseAfter(poi, slot.afterId);
+ }}
+ trailing={
+ slot.block ? (
+ <Tooltip label={t(`tours.poi.blocked.${slot.block}`)} placement="left">
+ <span className="flex-none text-content-faint" data-testid="tour-poi-slot-blocked">
+ <Info size={13} strokeWidth={2.2} aria-label={t(`tours.poi.blocked.${slot.block}`)} />
+ </span>
+ </Tooltip>
+ ) : !slot.beforeId ? (
+ <SoftPill tone="warning">{t('tours.poi.slot.extends')}</SoftPill>
+ ) : hint ? (
+ <span className="flex-none font-geist tabular-nums text-content-faint" style={fs(11)}>
+ {hint}
+ </span>
+ ) : undefined
+ }
+ />
+ );
+ })}
+ </PopoverListPanel>
+ {block ? (
+ <p className="m-0 text-warning" style={fs(11, 'body')}>
+ {t(`tours.poi.blocked.${block}`)}
+ </p>
+ ) : (
+ chosen &&
+ !chosen.beforeId && (
+ <p className="m-0 text-content-muted" style={fs(11, 'body')} data-testid="tour-poi-slot-extends">
+ {t('tours.poi.slot.extendsHint', { name: labels.get(chosen.afterId) ?? '' })}
+ </p>
+ )
+ )}
+ <div className="flex items-center gap-2">
+ <button
+ type="button"
+ disabled={!!block || locked}
+ onClick={() => insertion.insert(poi)}
+ data-testid="tour-poi-add"
+ title={t('tours.poi.notAPlace')}
+ className="inline-flex h-8 flex-1 items-center justify-center gap-1.5 rounded-[10px] bg-accent px-3 font-semibold text-accent-text shadow-sm transition-opacity hover:opacity-90 disabled:cursor-default disabled:opacity-40"
+ style={fs(12, 'body')}
+ >
+ <Plus size={14} strokeWidth={2.2} />
+ {t('tours.poi.add')}
+ </button>
+ {detour && !block && (
+ <Tooltip label={t('tours.poi.detourHint')} placement="top">
+ <span data-testid="tour-poi-detour">
+ <WhiteBadge>{detour}</WhiteBadge>
+ </span>
+ </Tooltip>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/components/Tours/poi/poiInsertion.test.ts b/client/src/components/Tours/poi/poiInsertion.test.ts
index 5b4a058a8..9ff26685c 100644
--- a/client/src/components/Tours/poi/poiInsertion.test.ts
+++ b/client/src/components/Tours/poi/poiInsertion.test.ts
@@ -1,8 +1,16 @@
import { describe, expect, it } from 'vitest';
import type { TourPlannerWaypoint } from '../planner/tourPlannerWaypoints';
-import { defaultAfterId, insertionBlock, withPointAfter } from './poiInsertion';
+import {
+ chosenAfterId,
+ defaultAfterId,
+ insertionBlock,
+ insertionPreview,
+ insertionSlots,
+ straightDetourM,
+ withPointAfter,
+} from './poiInsertion';
-// FE-TOUR-POI-INSERT-001 to FE-TOUR-POI-INSERT-005
+// FE-TOUR-POI-INSERT-001 to FE-TOUR-POI-INSERT-009
const point = (id: string, lat: number, lng: number, over: Partial<TourPlannerWaypoint> = {}): TourPlannerWaypoint => ({
id,
@@ -86,3 +94,66 @@ describe('placing a found place in the tour (PLN-03)', () => {
expect(defaultAfterId([], null, 0)).toBeNull();
});
});
+
+describe('the slots a found place can go into (PLN-04)', () => {
+ const back = point('back', 47.0, 11.0, { role: 'end' });
+
+ it('FE-TOUR-POI-INSERT-006: one slot per point, between it and the next, the last one as the new end', () => {
+ expect(insertionSlots([A, B, C])).toEqual([
+ { afterId: 'a', beforeId: 'b', block: null },
+ { afterId: 'b', beforeId: 'c', block: null },
+ { afterId: 'c', beforeId: null, block: null },
+ ]);
+ // A loop has no new end: the slot after its way back is listed as one that cannot take the place.
+ expect(insertionSlots([A, B, back])[2]).toEqual({ afterId: 'back', beforeId: null, block: 'none' });
+ });
+
+ it('FE-TOUR-POI-INSERT-007: the preview runs through the place to the next point, or ends on it as the new end', () => {
+ const place = { lat: 47.03, lng: 11.0 };
+ expect(insertionPreview([A, B, C], 'b', place)).toEqual([
+ [47.01, 11.0],
+ [47.03, 11.0],
+ [47.02, 11.0],
+ ]);
+ expect(insertionPreview([A, B, C], 'c', place)).toEqual([
+ [47.02, 11.0],
+ [47.03, 11.0],
+ ]);
+ expect(insertionPreview([A, B, back], 'back', place)).toBeNull();
+ });
+
+ it('FE-TOUR-POI-INSERT-008: the detour as the crow flies: the way round less the stretch it replaces', () => {
+ // 1.11 km on to the place and 1.11 km back, instead of the 1.11 km between the points.
+ const between = straightDetourM([
+ [47.01, 11.0],
+ [47.02, 11.0],
+ [47.01, 11.0],
+ ]);
+ expect(between).toBeGreaterThan(2200);
+ expect(between).toBeLessThan(2250);
+ // A place on the way adds nothing.
+ expect(
+ straightDetourM([
+ [47.0, 11.0],
+ [47.01, 11.0],
+ [47.02, 11.0],
+ ])
+ ).toBeLessThan(1);
+ // As the new end, the whole way to it.
+ expect(
+ straightDetourM([
+ [47.02, 11.0],
+ [47.03, 11.0],
+ ])
+ ).toBeGreaterThan(1100);
+ });
+
+ it('FE-TOUR-POI-INSERT-009: keeps the point picked for the place while it is there, the suggestion otherwise', () => {
+ const place = { id: 'node:1', along_m: 1600 };
+ expect(chosenAfterId([A, B, C], null, place, { poiId: 'node:1', afterId: 'c' })).toBe('c');
+ // Picked for another place, or a point undone since.
+ expect(chosenAfterId([A, B, C], null, place, { poiId: 'node:2', afterId: 'c' })).toBe('b');
+ expect(chosenAfterId([A, B, C], null, place, { poiId: 'node:1', afterId: 'gone' })).toBe('b');
+ expect(chosenAfterId([A, B, C], null, place, null)).toBe('b');
+ });
+});
diff --git a/client/src/components/Tours/poi/poiInsertion.ts b/client/src/components/Tours/poi/poiInsertion.ts
index 25eb6273b..3c4147c29 100644
--- a/client/src/components/Tours/poi/poiInsertion.ts
+++ b/client/src/components/Tours/poi/poiInsertion.ts
@@ -1,4 +1,4 @@
-import { isClosedLoop, nearnessToLine } from '@trek/shared';
+import { haversineMetres, isClosedLoop, nearnessToLine } from '@trek/shared';
import { withPointAppended, type RoutePoint } from '../planner/tourRouteActions';
type Point = RoutePoint & { role: string; shaping?: boolean };
@@ -56,3 +56,72 @@ export function defaultAfterId(
}
return chosen;
}
+
+/**
+ * The point a place goes in after: the one picked for it while that point is
+ * still there (not undone, not removed), else the suggestion.
+ */
+export function chosenAfterId(
+ points: readonly Point[],
+ route: Array<[number, number]> | null,
+ place: { id: string; along_m: number },
+ picked: { poiId: string; afterId: string } | null
+): string | null {
+ if (picked?.poiId === place.id && points.some((point) => point.id === picked.afterId)) return picked.afterId;
+ return defaultAfterId(points, route, place.along_m);
+}
+
+/**
+ * PLN-04: where a place can go, one slot per point: between it and the next
+ * point, or after the last as the new end, which makes the tour longer. A
+ * slot that cannot take it says why, so the list can show it dimmed.
+ */
+export interface InsertionSlot {
+ afterId: string;
+ /** The point it would go in before; null where it would become the new end. */
+ beforeId: string | null;
+ block: InsertionBlock | null;
+}
+
+export function insertionSlots(points: readonly Point[]): InsertionSlot[] {
+ return points.map((point, index) => ({
+ afterId: point.id,
+ beforeId: points[index + 1]?.id ?? null,
+ block: insertionBlock(points, point.id),
+ }));
+}
+
+/**
+ * The straight lines a place would add in the slot after `afterId`: from that
+ * point to the place and on to the next, or only to the place as the new
+ * end. Null where it cannot go there.
+ */
+export function insertionPreview(
+ points: readonly Point[],
+ afterId: string,
+ place: { lat: number; lng: number }
+): Array<[number, number]> | null {
+ if (insertionBlock(points, afterId) !== null) return null;
+ const index = points.findIndex((point) => point.id === afterId);
+ const from = points[index];
+ if (!from) return null;
+ const to = points[index + 1];
+ const line: Array<[number, number]> = [
+ [from.lat, from.lng],
+ [place.lat, place.lng],
+ ];
+ return to ? [...line, [to.lat, to.lng]] : line;
+}
+
+/** How much longer the preview's lines make the tour, as the crow flies; the route planned after says it exactly. */
+export function straightDetourM(line: ReadonlyArray<[number, number]>): number {
+ const legs = (path: ReadonlyArray<[number, number]>) =>
+ path.slice(1).reduce((sum, [lat, lng], index) => {
+ const [fromLat, fromLng] = path[index] ?? [lat, lng];
+ return sum + haversineMetres(fromLat, fromLng, lat, lng);
+ }, 0);
+ const first = line[0];
+ const last = line[line.length - 1];
+ const replaced = line.length > 2 && first && last ? legs([first, last]) : 0;
+ return Math.max(0, legs(line) - replaced);
+}
diff --git a/client/src/components/Tours/poi/tourPoiSearch.test.tsx b/client/src/components/Tours/poi/tourPoiSearch.test.tsx
index 3b56ff258..f0875974a 100644
--- a/client/src/components/Tours/poi/tourPoiSearch.test.tsx
+++ b/client/src/components/Tours/poi/tourPoiSearch.test.tsx
@@ -6,7 +6,7 @@ import { TranslationProvider } from '../../../i18n/TranslationContext';
import { OnlineOnlyError } from '../../../repo/onlineOnly';
import { tourPoiSearchRepo } from '../../../repo/tourPoiSearchRepo';
import { useTourPoiStore } from '../../../store/tourPoiStore';
-import type { TourPlannerWaypoint } from '../planner/tourPlannerWaypoints';
+import { normalizePlannerWaypoints, type TourPlannerWaypoint } from '../planner/tourPlannerWaypoints';
import type { TourPlannerController } from '../planner/useTourPlanner';
import TourPoiOverlay from './TourPoiCard';
import { TourPoiSearchCard } from './TourPoiSearchCard';
@@ -14,7 +14,7 @@ import { usePoiInsertion, type PoiInsertionPlanner } from './usePoiInsertion';
import { useTourPoiMarkers } from './useTourPoiMarkers';
import { useTourPoiSearch } from './useTourPoiSearch';
-// FE-TOUR-POI-001 to FE-TOUR-POI-018
+// FE-TOUR-POI-001 to FE-TOUR-POI-021
vi.mock('../planner/useWaypointPlaceNames', () => ({ useWaypointPlaceNames: () => ({}) }));
@@ -125,6 +125,8 @@ function insertionPlanner(over: Partial<PoiInsertionPlanner> = {}): PoiInsertion
walkingDurationMinutes: 40,
canEdit: true,
isSaving: false,
+ undo: vi.fn(),
+ canUndo: true,
...over,
};
}
@@ -438,3 +440,102 @@ describe('a city walk along its places (CW-05)', () => {
expect(added[1]).not.toHaveProperty('openingHours');
});
});
+
+describe('choosing where a found place goes (PLN-04)', () => {
+ const alongPlanner = (over: Partial<PoiInsertionPlanner> = {}) =>
+ ({ ...searchPlanner(), ...insertionPlanner(over) }) as unknown as TourPlannerController;
+ async function openCard(planner: TourPlannerController) {
+ renderAlong(planner);
+ fireEvent.click(screen.getByTestId('tour-poi-search'));
+ fireEvent.click(within(await screen.findByTestId('tour-poi-node:1')).getByRole('button', { name: /Spring/ }));
+ return screen.getByTestId('tour-poi-overlay');
+ }
+ /** A press as a real pointer makes it: down, then the click. */
+ function press(element: HTMLElement) {
+ fireEvent.pointerDown(element);
+ fireEvent.mouseDown(element);
+ fireEvent.click(element);
+ }
+
+ it('FE-TOUR-POI-019: the last point picked as the position keeps the card open, and adding makes exactly one new end', async () => {
+ const planner = alongPlanner();
+ const card = await openCard(planner);
+ const slot = within(card).getByTestId('tour-poi-slot');
+ expect(slot).toHaveTextContent('Between Waypoint 2 and Waypoint 3');
+ press(slot);
+ const list = screen.getByRole('group', { name: 'Where it goes' });
+ expect(
+ within(list)
+ .getAllByRole('button')
+ .map((option) => option.textContent)
+ ).toEqual([
+ expect.stringContaining('Between Waypoint 1 and Waypoint 2'),
+ expect.stringContaining('Between Waypoint 2 and Waypoint 3'),
+ expect.stringContaining('As the new end'),
+ ]);
+ const newEnd = within(list).getByRole('button', { name: /As the new end/ });
+ expect(newEnd).toHaveTextContent('Extends the tour');
+ press(newEnd);
+
+ expect(screen.getByTestId('tour-poi-overlay')).toBeInTheDocument();
+ expect(screen.getByTestId('tour-poi-slot')).toHaveTextContent('As the new end');
+ expect(screen.getByTestId('tour-poi-slot-extends')).toHaveTextContent(
+ 'Waypoint 3 is no longer the end: the tour goes on to this place.'
+ );
+ expect(planner.editWaypoints).not.toHaveBeenCalled();
+
+ press(screen.getByTestId('tour-poi-add'));
+ expect(planner.editWaypoints).toHaveBeenCalledTimes(1);
+ const updater = vi.mocked(planner.editWaypoints).mock.calls[0]?.[0] as (
+ points: TourPlannerWaypoint[]
+ ) => TourPlannerWaypoint[];
+ const next = normalizePlannerWaypoints(updater(POINTS));
+ expect(next).toHaveLength(POINTS.length + 1);
+ expect(next.map((point) => point.id).slice(0, 3)).toEqual(['a', 'b', 'c']);
+ expect(next.map((point) => point.role)).toEqual(['start', 'via', 'via', 'end']);
+ expect(next[3]).toMatchObject({ lat: SPRING.lat, lng: SPRING.lng, name: 'Spring' });
+ expect(screen.queryByTestId('tour-poi-overlay')).not.toBeInTheDocument();
+ });
+
+ it('FE-TOUR-POI-020: closing, Escape or a press outside leaves the tour alone, the picked slot with it', async () => {
+ const planner = alongPlanner();
+ const card = await openCard(planner);
+ press(within(card).getByTestId('tour-poi-slot'));
+ press(within(screen.getByRole('group', { name: 'Where it goes' })).getByRole('button', { name: /As the new end/ }));
+ fireEvent.pointerDown(document.body);
+ expect(screen.queryByTestId('tour-poi-overlay')).not.toBeInTheDocument();
+
+ fireEvent.click(within(screen.getByTestId('tour-poi-node:1')).getByRole('button', { name: /Spring/ }));
+ // Opened again, the place still goes where it was put.
+ expect(screen.getByTestId('tour-poi-slot')).toHaveTextContent('As the new end');
+ fireEvent.keyDown(document, { key: 'Escape' });
+ fireEvent.click(within(screen.getByTestId('tour-poi-node:1')).getByRole('button', { name: /Spring/ }));
+ fireEvent.click(within(screen.getByTestId('tour-poi-overlay')).getByRole('button', { name: 'Close' }));
+ expect(planner.editWaypoints).not.toHaveBeenCalled();
+ expect(planner.setSelectedWaypointId).not.toHaveBeenCalled();
+ });
+
+ it('FE-TOUR-POI-021: the notice of what was added takes it back with undo, only while that is the last step', async () => {
+ const added: TourPlannerWaypoint = { id: 'new', lat: SPRING.lat, lng: SPRING.lng, role: 'end' };
+ const withPoint = [PA, PB, { ...PC, role: 'via' as const }, added];
+ useTourPoiStore
+ .getState()
+ .setInserted({ pointId: 'new', name: 'Spring', before: { distanceM: 2200, minutes: 40 }, pointCount: 4 });
+ const planner = alongPlanner({ waypoints: withPoint, distanceMeters: 2900, walkingDurationMinutes: 52 });
+ const { unmount } = render(<TourPoiSearchCard planner={planner} />);
+ const notice = screen.getByTestId('tour-poi-outcome');
+ expect(notice).toHaveTextContent('+700 m');
+ fireEvent.click(within(notice).getByTestId('tour-poi-undo'));
+ expect(planner.undo).toHaveBeenCalledTimes(1);
+ expect(useTourPoiStore.getState().inserted).toBeNull();
+ unmount();
+
+ // With nothing to undo, or no right to edit, the notice offers no way back.
+ useTourPoiStore
+ .getState()
+ .setInserted({ pointId: 'new', name: 'Spring', before: { distanceM: 2200, minutes: 40 }, pointCount: 4 });
+ render(<TourPoiSearchCard planner={alongPlanner({ waypoints: withPoint, canUndo: false })} />);
+ expect(screen.getByTestId('tour-poi-outcome')).toBeInTheDocument();
+ expect(screen.queryByTestId('tour-poi-undo')).not.toBeInTheDocument();
+ });
+});
diff --git a/client/src/components/Tours/poi/usePoiInsertion.ts b/client/src/components/Tours/poi/usePoiInsertion.ts
index 09f6bb8a0..b45d5ff15 100644
--- a/client/src/components/Tours/poi/usePoiInsertion.ts
+++ b/client/src/components/Tours/poi/usePoiInsertion.ts
@@ -1,12 +1,12 @@
import type { TourPoi } from '@trek/shared';
-import { useCallback, useState } from 'react';
+import { useCallback } from 'react';
import { useTranslation } from '../../../i18n';
import { useTourPoiStore, type InsertedTourPoi } from '../../../store/tourPoiStore';
import { randomId } from '../../../utils/randomId';
import { TOUR_POI_LOOKS } from '../../Map/poiCategories';
import type { TourPlannerWaypoint } from '../planner/tourPlannerWaypoints';
import type { TourPlannerController, TourPlannerStatus } from '../planner/useTourPlanner';
-import { defaultAfterId, insertionBlock, withPointAfter } from './poiInsertion';
+import { chosenAfterId, insertionBlock, insertionSlots, withPointAfter } from './poiInsertion';
/** The route is planned through and its measures can be read. */
const SETTLED: readonly TourPlannerStatus[] = ['ready', 'saved', 'elevation-failed'];
@@ -33,6 +33,8 @@ export type PoiInsertionPlanner = Pick<
| 'walkingDurationMinutes'
| 'canEdit'
| 'isSaving'
+ | 'undo'
+ | 'canUndo'
>;
function measuresOf(planner: PoiInsertionPlanner): Measures | null {
@@ -52,19 +54,21 @@ function measuresOf(planner: PoiInsertionPlanner): Measures | null {
export function usePoiInsertion(planner: PoiInsertionPlanner) {
const { t } = useTranslation();
const select = useTourPoiStore((state) => state.select);
- const [afterChoice, setAfterChoice] = useState<{ poiId: string; afterId: string } | null>(null);
+ // In the store: the map draws where the place would go while its card is open.
+ const afterChoice = useTourPoiStore((state) => state.slot);
+ const chooseSlot = useTourPoiStore((state) => state.chooseSlot);
// Kept in the store: the place is taken in from its card over the map, and the list says what it did.
const inserted = useTourPoiStore((state) => state.inserted);
const setInserted = useTourPoiStore((state) => state.setInserted);
const afterIdFor = useCallback(
- (poi: TourPoi) =>
- afterChoice?.poiId === poi.id
- ? afterChoice.afterId
- : defaultAfterId(planner.waypoints, planner.route, poi.along_m),
+ (poi: TourPoi) => chosenAfterId(planner.waypoints, planner.route, poi, afterChoice),
[afterChoice, planner.route, planner.waypoints]
);
- const chooseAfter = useCallback((poi: TourPoi, afterId: string) => setAfterChoice({ poiId: poi.id, afterId }), []);
+ const chooseAfter = useCallback(
+ (poi: TourPoi, afterId: string) => chooseSlot({ poiId: poi.id, afterId }),
+ [chooseSlot]
+ );
const insert = useCallback(
(poi: TourPoi) => {
@@ -89,21 +93,31 @@ export function usePoiInsertion(planner: PoiInsertionPlanner) {
// An unnamed place (a tap, a bench) is told by its kind, as the list names it.
const name = poi.name || t(TOUR_POI_LOOKS[poi.category].labelKey);
setInserted({ pointId: point.id, name, before, pointCount: next.length });
+ chooseSlot(null);
select(null);
return true;
},
- [afterIdFor, planner, select, setInserted, t]
+ [afterIdFor, chooseSlot, planner, select, setInserted, t]
);
const dismiss = useCallback(() => setInserted(null), [setInserted]);
+ const outcome = outcomeOf(inserted, planner);
+ // The one step that took the place in, while it is still the last thing done to the points.
+ const { undo: undoStep } = planner;
+ const undo = useCallback(() => {
+ undoStep();
+ setInserted(null);
+ }, [setInserted, undoStep]);
return {
afterIdFor,
chooseAfter,
blockOf: (afterId: string) => insertionBlock(planner.waypoints, afterId),
+ slots: insertionSlots(planner.waypoints),
insert,
- outcome: outcomeOf(inserted, planner),
+ outcome,
dismiss,
+ undo: outcome && planner.canUndo && planner.canEdit && !planner.isSaving ? undo : null,
};
}
diff --git a/client/src/components/Tours/poi/usePoiInsertionPreview.test.ts b/client/src/components/Tours/poi/usePoiInsertionPreview.test.ts
new file mode 100644
index 000000000..73f939bfe
--- /dev/null
+++ b/client/src/components/Tours/poi/usePoiInsertionPreview.test.ts
@@ -0,0 +1,88 @@
+import { act, renderHook } from '@testing-library/react';
+import type { TourPoi } from '@trek/shared';
+import { beforeEach, describe, expect, it } from 'vitest';
+import { useTourPoiStore } from '../../../store/tourPoiStore';
+import type { TourPlannerWaypoint } from '../planner/tourPlannerWaypoints';
+import { usePoiInsertionPreview, withPreviewLine } from './usePoiInsertionPreview';
+
+// FE-TOUR-POI-PREVIEW-001 to FE-TOUR-POI-PREVIEW-003
+
+const POINTS: TourPlannerWaypoint[] = [
+ { id: 'a', lat: 47.0, lng: 11.0, role: 'start' },
+ { id: 'b', lat: 47.01, lng: 11.0, role: 'via' },
+ { id: 'c', lat: 47.02, lng: 11.0, role: 'end' },
+];
+const SPRING: TourPoi = {
+ id: 'node:1',
+ name: 'Spring',
+ lat: 47.015,
+ lng: 11.001,
+ category: 'drinking_water',
+ kind: 'amenity=drinking_water',
+ source: 'openstreetmap',
+ address: null,
+ website: null,
+ phone: null,
+ opening_hours: null,
+ distance_m: 80,
+ along_m: 1650,
+};
+
+beforeEach(() => useTourPoiStore.getState().clear());
+
+describe('usePoiInsertionPreview (PLN-04)', () => {
+ it('FE-TOUR-POI-PREVIEW-001: draws nothing until a place is open, then its slot, and follows a new pick', () => {
+ const planner = { waypoints: POINTS, route: null, canEdit: true };
+ const { result } = renderHook(() => usePoiInsertionPreview(planner));
+ expect(result.current).toBeNull();
+ act(() => {
+ useTourPoiStore.getState().publish([SPRING]);
+ useTourPoiStore.getState().select('node:1');
+ });
+ expect(result.current).toEqual([
+ [47.01, 11.0],
+ [47.015, 11.001],
+ [47.02, 11.0],
+ ]);
+ act(() => useTourPoiStore.getState().chooseSlot({ poiId: 'node:1', afterId: 'c' }));
+ expect(result.current).toEqual([
+ [47.02, 11.0],
+ [47.015, 11.001],
+ ]);
+ act(() => useTourPoiStore.getState().select(null));
+ expect(result.current).toBeNull();
+ });
+
+ it('FE-TOUR-POI-PREVIEW-002: draws nothing for a viewer who cannot change the tour', () => {
+ useTourPoiStore.getState().publish([SPRING]);
+ useTourPoiStore.getState().select('node:1');
+ const { result } = renderHook(() => usePoiInsertionPreview({ waypoints: POINTS, route: null, canEdit: false }));
+ expect(result.current).toBeNull();
+ });
+
+ it('FE-TOUR-POI-PREVIEW-003: lays the preview over the lines as one more dotted stretch, and leaves them alone without one', () => {
+ const route: [number, number][][] = [
+ [
+ [47.0, 11.0],
+ [47.02, 11.0],
+ ],
+ ];
+ const line: [number, number][] = [
+ [47.02, 11.0],
+ [47.03, 11.0],
+ ];
+ const drawn = { route, routeWalking: null, routeColors: null };
+ expect(withPreviewLine(drawn, null)).toBe(drawn);
+ expect(withPreviewLine(drawn, line)).toEqual({
+ route: [...route, line],
+ routeWalking: [false, true],
+ routeColors: null,
+ });
+ const coloured = { route, routeWalking: [false], routeColors: [{ line: 'day-1', casing: 'day-1-casing' }] };
+ expect(withPreviewLine(coloured, line)).toEqual({
+ route: [...route, line],
+ routeWalking: [false, true],
+ routeColors: [{ line: 'day-1', casing: 'day-1-casing' }, undefined],
+ });
+ });
+});
diff --git a/client/src/components/Tours/poi/usePoiInsertionPreview.ts b/client/src/components/Tours/poi/usePoiInsertionPreview.ts
new file mode 100644
index 000000000..ac10aad17
--- /dev/null
+++ b/client/src/components/Tours/poi/usePoiInsertionPreview.ts
@@ -0,0 +1,45 @@
+import { useMemo } from 'react';
+import { useTourPoiStore } from '../../../store/tourPoiStore';
+import type { TourPlannerController } from '../planner/useTourPlanner';
+import { chosenAfterId, insertionPreview } from './poiInsertion';
+import { useSelectedPoi } from './useTourPoiSearch';
+
+/**
+ * PLN-04: while a place's card is open, the straight lines it would add to
+ * the tour in the slot picked for it, for the map to draw dashed before
+ * anything is taken in. Nothing while it cannot be taken in there.
+ */
+export function usePoiInsertionPreview(
+ planner: Pick<TourPlannerController, 'waypoints' | 'route' | 'canEdit'>
+): Array<[number, number]> | null {
+ const poi = useSelectedPoi();
+ const slot = useTourPoiStore((state) => state.slot);
+ const { waypoints, route, canEdit } = planner;
+ return useMemo(() => {
+ if (!poi || !canEdit) return null;
+ const afterId = chosenAfterId(waypoints, route, poi, slot);
+ return afterId ? insertionPreview(waypoints, afterId, poi) : null;
+ }, [canEdit, poi, route, slot, waypoints]);
+}
+
+interface DrawnLines {
+ route: [number, number][][] | null;
+ routeWalking: boolean[] | null;
+ routeColors: ({ line: string; casing: string } | undefined)[] | null;
+}
+
+/**
+ * The planner map's lines with the preview laid over them as a dotted stretch
+ * in the route's own blue, as the map draws a walked or unrouted bit: it
+ * reads as a part of this tour that is not planned yet.
+ */
+export function withPreviewLine<T extends DrawnLines>(drawn: T, line: Array<[number, number]> | null): T {
+ if (!line) return drawn;
+ const route = drawn.route ?? [];
+ return {
+ ...drawn,
+ route: [...route, line],
+ routeWalking: [...(drawn.routeWalking ?? route.map(() => false)), true],
+ routeColors: drawn.routeColors ? [...drawn.routeColors, undefined] : null,
+ };
+}
diff --git a/client/src/pages/tripPlanner/TourPlannerMapStage.tsx b/client/src/pages/tripPlanner/TourPlannerMapStage.tsx
index c42c1f177..c031ed3a0 100644
--- a/client/src/pages/tripPlanner/TourPlannerMapStage.tsx
+++ b/client/src/pages/tripPlanner/TourPlannerMapStage.tsx
@@ -16,6 +16,7 @@ import LegVariantsOverlay from '../../components/Tours/planner/LegVariantsCard';
import RoundHikeOverlay from '../../components/Tours/planner/RoundHikeCard';
import { useShapingClick } from '../../components/Tours/planner/useShapingClick';
import TourPoiOverlay from '../../components/Tours/poi/TourPoiCard';
+import { usePoiInsertionPreview, withPreviewLine } from '../../components/Tours/poi/usePoiInsertionPreview';
import { useTourPoiMarkers } from '../../components/Tours/poi/useTourPoiMarkers';
import type { TerrainLegendLayout } from '../../components/Tours/terrain/TourTerrainMap';
import { isRtlLanguage, useTranslation } from '../../i18n';
@@ -177,6 +178,16 @@ export function TourPlannerMapStage({
// P2A-03: a click on the route being edited sets a shaping point there.
// PLN-02: the places found along the tour, drawn on the map and picked from it.
const poiMarkers = useTourPoiMarkers();
+ // PLN-04: where the place in the open card would go in, dotted, before it is taken in.
+ const poiPreview = usePoiInsertionPreview(tourPlanner);
+ const lines = useMemo(
+ () =>
+ withPreviewLine(
+ { route: tourMap.route, routeWalking: tourMap.routeWalking, routeColors: tourMap.routeColors },
+ poiPreview
+ ),
+ [poiPreview, tourMap.route, tourMap.routeColors, tourMap.routeWalking]
+ );
// RTE-02, RTE-03: while other ways of a section or round hikes are offered, a click on the line sets nothing on it.
const comparing = tourPlanner.legVariants.comparison !== null;
const offeringRounds = tourPlanner.roundHikes.view !== null;
@@ -246,9 +257,9 @@ export function TourPlannerMapStage({
<MapView
tripId={tripId}
places={[]}
- route={tourMap.route}
- routeWalking={tourMap.routeWalking}
- routeColors={tourMap.routeColors}
+ route={lines.route}
+ routeWalking={lines.routeWalking}
+ routeColors={lines.routeColors}
followSelection={false}
onMapClick={
onAddOrMark
diff --git a/client/src/store/tourPoiStore.ts b/client/src/store/tourPoiStore.ts
index a3a9b5cb8..e896c73d0 100644
--- a/client/src/store/tourPoiStore.ts
+++ b/client/src/store/tourPoiStore.ts
@@ -10,12 +10,19 @@ export interface InsertedTourPoi {
pointCount: number;
}
+/** PLN-04: the slot picked for a place, kept until the place is taken in or the search is cleared. */
+export interface TourPoiSlotChoice {
+ poiId: string;
+ afterId: string;
+}
+
/**
* PLN-02: the places found along the tour in the planner, and the one chosen.
* The card searches and lists them; the map stage draws them and opens the
* chosen one's card over the map, where it is taken in as a stop. What the
* last one taken in did is kept here, so the list says it once that card has
- * closed. Nothing here is kept beyond the view.
+ * closed, and the slot picked in the card, so the map can draw where the place
+ * would go. Nothing here is kept beyond the view.
*/
export const useTourPoiStore = create<{
pois: readonly TourPoi[];
@@ -23,17 +30,21 @@ export const useTourPoiStore = create<{
theme: WalkTheme | null;
selectedId: string | null;
inserted: InsertedTourPoi | null;
+ slot: TourPoiSlotChoice | null;
publish: (pois: readonly TourPoi[], theme?: WalkTheme | null) => void;
select: (id: string | null) => void;
setInserted: (inserted: InsertedTourPoi | null) => void;
+ chooseSlot: (slot: TourPoiSlotChoice | null) => void;
clear: () => void;
}>((set) => ({
pois: [],
theme: null,
selectedId: null,
inserted: null,
+ slot: null,
publish: (pois, theme = null) => set({ pois, theme, selectedId: null }),
select: (selectedId) => set({ selectedId }),
setInserted: (inserted) => set({ inserted }),
- clear: () => set({ pois: [], theme: null, selectedId: null, inserted: null }),
+ chooseSlot: (slot) => set({ slot }),
+ clear: () => set({ pois: [], theme: null, selectedId: null, inserted: null, slot: null }),
}));
diff --git a/shared/src/i18n/ar/tours.ts b/shared/src/i18n/ar/tours.ts
index 1120b5a39..f01832c7a 100644
--- a/shared/src/i18n/ar/tours.ts
+++ b/shared/src/i18n/ar/tours.ts
@@ -383,7 +383,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'من فهرس أماكن TREK',
'tours.poi.hoursHint': 'كما تذكرها المصادر؛ تحقّق منها قبل الانطلاق.',
'tours.poi.website': 'الموقع الإلكتروني',
- 'tours.poi.addAfter': 'أضِف بعد',
+ 'tours.poi.slot.label': 'أين يُضاف',
+ 'tours.poi.slot.between': 'بين {from} و{to}',
+ 'tours.poi.slot.newEnd': 'كنهاية جديدة',
+ 'tours.poi.slot.extends': 'يطيل الجولة',
+ 'tours.poi.slot.extendsHint': 'لن تكون {name} النهاية بعد الآن: تستمر الجولة حتى هذا المكان.',
+ 'tours.poi.detourHint': 'تقريبًا، بخط مستقيم. يظهر التغيير الدقيق بعد إعادة تخطيط المسار.',
'tours.poi.add': 'أضِف كتوقف',
'tours.poi.notAPlace': 'يصبح توقفًا في الجولة، وليس مكانًا في الرحلة.',
'tours.poi.blocked.fixed': 'المقطع بعد هذه النقطة خط ثابت، مسار تسلق أو حمل للقارب. اختر نقطة أخرى.',
diff --git a/shared/src/i18n/az/tours.ts b/shared/src/i18n/az/tours.ts
index 1adc16a29..8a1488744 100644
--- a/shared/src/i18n/az/tours.ts
+++ b/shared/src/i18n/az/tours.ts
@@ -370,7 +370,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'TREK-in yerlər indeksindən',
'tours.poi.hoursHint': 'Mənbədə olduğu kimi; getməzdən əvvəl yoxla.',
'tours.poi.website': 'Veb sayt',
- 'tours.poi.addAfter': 'Bundan sonra əlavə et',
+ 'tours.poi.slot.label': 'Hara əlavə olunur',
+ 'tours.poi.slot.between': '{from} ilə {to} arasında',
+ 'tours.poi.slot.newEnd': 'Yeni son nöqtə kimi',
+ 'tours.poi.slot.extends': 'Turu uzadır',
+ 'tours.poi.slot.extendsHint': '{name} artıq son nöqtə olmayacaq: tur bu yerə qədər davam edir.',
+ 'tours.poi.detourHint': 'Təxminən, düz xətt üzrə. Dəqiq dəyişiklik marşrut yenidən planlaşdırılandan sonra görünür.',
'tours.poi.add': 'Dayanacaq kimi əlavə et',
'tours.poi.notAPlace': 'Turun dayanacağı olur, səfərin yeri yox.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/br/tours.ts b/shared/src/i18n/br/tours.ts
index efbff802c..98d73d23e 100644
--- a/shared/src/i18n/br/tours.ts
+++ b/shared/src/i18n/br/tours.ts
@@ -376,7 +376,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Do índice de lugares do TREK',
'tours.poi.hoursHint': 'Conforme a fonte; confira antes de ir.',
'tours.poi.website': 'Site',
- 'tours.poi.addAfter': 'Adicionar depois de',
+ 'tours.poi.slot.label': 'Onde entra',
+ 'tours.poi.slot.between': 'Entre {from} e {to}',
+ 'tours.poi.slot.newEnd': 'Como novo destino',
+ 'tours.poi.slot.extends': 'Aumenta o passeio',
+ 'tours.poi.slot.extendsHint': '{name} deixa de ser o fim: o passeio segue até este lugar.',
+ 'tours.poi.detourHint': 'Aproximado, em linha reta. A mudança exata aparece quando a rota for planejada de novo.',
'tours.poi.add': 'Adicionar como parada',
'tours.poi.notAPlace': 'Vira uma parada do passeio, não um lugar da viagem.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/ca/tours.ts b/shared/src/i18n/ca/tours.ts
index 772256ded..314394554 100644
--- a/shared/src/i18n/ca/tours.ts
+++ b/shared/src/i18n/ca/tours.ts
@@ -377,7 +377,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': "De l'índex de llocs de TREK",
'tours.poi.hoursHint': "Tal com les dona la font; comprova-les abans d'anar-hi.",
'tours.poi.website': 'Lloc web',
- 'tours.poi.addAfter': 'Afegeix després de',
+ 'tours.poi.slot.label': 'On va',
+ 'tours.poi.slot.between': 'Entre {from} i {to}',
+ 'tours.poi.slot.newEnd': 'Com a nou final',
+ 'tours.poi.slot.extends': 'Allarga la ruta',
+ 'tours.poi.slot.extendsHint': '{name} deixa de ser el final: la ruta continua fins a aquest lloc.',
+ 'tours.poi.detourHint': 'Aproximat, en línia recta. El canvi exacte es mostra quan la ruta es torna a planificar.',
'tours.poi.add': 'Afegeix com a parada',
'tours.poi.notAPlace': 'Es converteix en una parada de la ruta, no en un lloc del viatge.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/cs/tours.ts b/shared/src/i18n/cs/tours.ts
index 1c8fffdc6..038ba7753 100644
--- a/shared/src/i18n/cs/tours.ts
+++ b/shared/src/i18n/cs/tours.ts
@@ -370,7 +370,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Z rejstříku míst TREK',
'tours.poi.hoursHint': 'Podle zdroje; před cestou si je ověř.',
'tours.poi.website': 'Webové stránky',
- 'tours.poi.addAfter': 'Přidat za',
+ 'tours.poi.slot.label': 'Kam patří',
+ 'tours.poi.slot.between': 'Mezi {from} a {to}',
+ 'tours.poi.slot.newEnd': 'Jako nový cíl',
+ 'tours.poi.slot.extends': 'Prodlouží túru',
+ 'tours.poi.slot.extendsHint': '{name} už nebude cílem: túra pokračuje až k tomuto místu.',
+ 'tours.poi.detourHint': 'Přibližně, vzdušnou čarou. Přesnou změnu uvidíte, jakmile se trasa znovu naplánuje.',
'tours.poi.add': 'Přidat jako zastávku',
'tours.poi.notAPlace': 'Stane se zastávkou túry, ne místem cesty.',
'tours.poi.blocked.fixed': 'Úsek za tímto bodem je pevná čára, ferrata nebo přenášení lodi. Vyber jiný bod.',
diff --git a/shared/src/i18n/de/tours.ts b/shared/src/i18n/de/tours.ts
index 758cfca0b..d2ae873b9 100644
--- a/shared/src/i18n/de/tours.ts
+++ b/shared/src/i18n/de/tours.ts
@@ -379,7 +379,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Aus dem Ortsverzeichnis von TREK',
'tours.poi.hoursHint': 'So, wie die Quelle sie angibt; prüf sie vor dem Losgehen.',
'tours.poi.website': 'Webseite',
- 'tours.poi.addAfter': 'Einfügen nach',
+ 'tours.poi.slot.label': 'Wo es hinkommt',
+ 'tours.poi.slot.between': 'Zwischen {from} und {to}',
+ 'tours.poi.slot.newEnd': 'Als neues Ziel',
+ 'tours.poi.slot.extends': 'Verlängert die Tour',
+ 'tours.poi.slot.extendsHint': '{name} ist dann nicht mehr das Ziel: Die Tour geht weiter bis zu diesem Ort.',
+ 'tours.poi.detourHint': 'Grob, in Luftlinie. Die genaue Änderung steht da, sobald die Route neu geplant ist.',
'tours.poi.add': 'Als Stopp hinzufügen',
'tours.poi.notAPlace': 'Es wird ein Stopp der Tour, kein Ort der Reise.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/en/tours.ts b/shared/src/i18n/en/tours.ts
index 0cc4f117a..c7e7e4279 100644
--- a/shared/src/i18n/en/tours.ts
+++ b/shared/src/i18n/en/tours.ts
@@ -369,7 +369,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': "From TREK's places index",
'tours.poi.hoursHint': 'As the source has them; check before you go.',
'tours.poi.website': 'Website',
- 'tours.poi.addAfter': 'Add after',
+ 'tours.poi.slot.label': 'Where it goes',
+ 'tours.poi.slot.between': 'Between {from} and {to}',
+ 'tours.poi.slot.newEnd': 'As the new end',
+ 'tours.poi.slot.extends': 'Extends the tour',
+ 'tours.poi.slot.extendsHint': '{name} is no longer the end: the tour goes on to this place.',
+ 'tours.poi.detourHint': 'Roughly, in a straight line. The exact change shows once the route is planned again.',
'tours.poi.add': 'Add as a stop',
'tours.poi.notAPlace': 'It becomes a stop of the tour, not a place of the trip.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/es/tours.ts b/shared/src/i18n/es/tours.ts
index 588776f2d..6f6a897f8 100644
--- a/shared/src/i18n/es/tours.ts
+++ b/shared/src/i18n/es/tours.ts
@@ -376,7 +376,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Del índice de lugares de TREK',
'tours.poi.hoursHint': 'Según la fuente; compruébalo antes de ir.',
'tours.poi.website': 'Sitio web',
- 'tours.poi.addAfter': 'Añadir después de',
+ 'tours.poi.slot.label': 'Dónde va',
+ 'tours.poi.slot.between': 'Entre {from} y {to}',
+ 'tours.poi.slot.newEnd': 'Como nuevo final',
+ 'tours.poi.slot.extends': 'Alarga la ruta',
+ 'tours.poi.slot.extendsHint': '{name} deja de ser el final: la ruta sigue hasta este lugar.',
+ 'tours.poi.detourHint': 'Aproximado, en línea recta. El cambio exacto aparece cuando la ruta se vuelve a planificar.',
'tours.poi.add': 'Añadir como parada',
'tours.poi.notAPlace': 'Se convierte en una parada de la ruta, no en un lugar del viaje.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/et/tours.ts b/shared/src/i18n/et/tours.ts
index 4558916b6..5a363467c 100644
--- a/shared/src/i18n/et/tours.ts
+++ b/shared/src/i18n/et/tours.ts
@@ -371,7 +371,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'TREKi kohtade registrist',
'tours.poi.hoursHint': 'Allika järgi; kontrolli enne minekut.',
'tours.poi.website': 'Veebileht',
- 'tours.poi.addAfter': 'Lisa pärast',
+ 'tours.poi.slot.label': 'Kuhu see läheb',
+ 'tours.poi.slot.between': '{from} ja {to} vahele',
+ 'tours.poi.slot.newEnd': 'Uue lõpuna',
+ 'tours.poi.slot.extends': 'Pikendab matka',
+ 'tours.poi.slot.extendsHint': '{name} ei ole enam lõpp: matk jätkub selle kohani.',
+ 'tours.poi.detourHint': 'Ligikaudu, linnulennult. Täpne muutus selgub, kui marsruut on uuesti planeeritud.',
'tours.poi.add': 'Lisa peatusena',
'tours.poi.notAPlace': 'Sellest saab matka peatus, mitte reisi koht.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/fr/tours.ts b/shared/src/i18n/fr/tours.ts
index 47d4cb1e6..5fa7cb819 100644
--- a/shared/src/i18n/fr/tours.ts
+++ b/shared/src/i18n/fr/tours.ts
@@ -382,7 +382,13 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': "De l'index des lieux de TREK",
'tours.poi.hoursHint': 'Selon la source ; vérifie avant de partir.',
'tours.poi.website': 'Site web',
- 'tours.poi.addAfter': 'Ajouter après',
+ 'tours.poi.slot.label': 'Où l’insérer',
+ 'tours.poi.slot.between': 'Entre {from} et {to}',
+ 'tours.poi.slot.newEnd': 'Comme nouvelle arrivée',
+ 'tours.poi.slot.extends': 'Allonge la sortie',
+ 'tours.poi.slot.extendsHint': '{name} n’est plus l’arrivée : la sortie continue jusqu’à ce lieu.',
+ 'tours.poi.detourHint':
+ 'Approximatif, à vol d’oiseau. Le changement exact s’affiche une fois l’itinéraire recalculé.',
'tours.poi.add': 'Ajouter comme arrêt',
'tours.poi.notAPlace': "Il devient un arrêt de l'itinéraire, pas un lieu du voyage.",
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/gr/tours.ts b/shared/src/i18n/gr/tours.ts
index 46c90a3dd..9c97b032d 100644
--- a/shared/src/i18n/gr/tours.ts
+++ b/shared/src/i18n/gr/tours.ts
@@ -384,7 +384,13 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Από το ευρετήριο τόπων του TREK',
'tours.poi.hoursHint': 'Όπως τα δίνει η πηγή· έλεγξέ τα πριν πας.',
'tours.poi.website': 'Ιστότοπος',
- 'tours.poi.addAfter': 'Προσθήκη μετά από',
+ 'tours.poi.slot.label': 'Πού μπαίνει',
+ 'tours.poi.slot.between': 'Ανάμεσα σε {from} και {to}',
+ 'tours.poi.slot.newEnd': 'Ως νέος τερματισμός',
+ 'tours.poi.slot.extends': 'Επεκτείνει τη διαδρομή',
+ 'tours.poi.slot.extendsHint': 'Το {name} δεν είναι πια το τέλος: η διαδρομή συνεχίζει ως αυτό το μέρος.',
+ 'tours.poi.detourHint':
+ 'Κατά προσέγγιση, σε ευθεία γραμμή. Η ακριβής αλλαγή φαίνεται μόλις η διαδρομή σχεδιαστεί ξανά.',
'tours.poi.add': 'Προσθήκη ως στάση',
'tours.poi.notAPlace': 'Γίνεται στάση της διαδρομής, όχι μέρος του ταξιδιού.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/hu/tours.ts b/shared/src/i18n/hu/tours.ts
index 4e2fbc91e..09709cc6f 100644
--- a/shared/src/i18n/hu/tours.ts
+++ b/shared/src/i18n/hu/tours.ts
@@ -377,7 +377,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'A TREK helyjegyzékéből',
'tours.poi.hoursHint': 'A forrás szerint; indulás előtt ellenőrizd.',
'tours.poi.website': 'Weboldal',
- 'tours.poi.addAfter': 'Beszúrás ez után',
+ 'tours.poi.slot.label': 'Hová kerül',
+ 'tours.poi.slot.between': '{from} és {to} közé',
+ 'tours.poi.slot.newEnd': 'Új végpontként',
+ 'tours.poi.slot.extends': 'Meghosszabbítja a túrát',
+ 'tours.poi.slot.extendsHint': '{name} többé nem a végpont: a túra eddig a helyig folytatódik.',
+ 'tours.poi.detourHint': 'Nagyjából, légvonalban. A pontos változás az útvonal újratervezése után látszik.',
'tours.poi.add': 'Hozzáadás megállóként',
'tours.poi.notAPlace': 'A túra megállója lesz, nem az út helye.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/id/tours.ts b/shared/src/i18n/id/tours.ts
index acbbab520..943511a7b 100644
--- a/shared/src/i18n/id/tours.ts
+++ b/shared/src/i18n/id/tours.ts
@@ -371,7 +371,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Dari indeks tempat TREK',
'tours.poi.hoursHint': 'Sesuai sumbernya; periksa sebelum berangkat.',
'tours.poi.website': 'Situs web',
- 'tours.poi.addAfter': 'Tambahkan setelah',
+ 'tours.poi.slot.label': 'Masuk di mana',
+ 'tours.poi.slot.between': 'Di antara {from} dan {to}',
+ 'tours.poi.slot.newEnd': 'Sebagai titik akhir baru',
+ 'tours.poi.slot.extends': 'Memperpanjang tur',
+ 'tours.poi.slot.extendsHint': '{name} tidak lagi menjadi akhir: tur berlanjut sampai tempat ini.',
+ 'tours.poi.detourHint': 'Perkiraan, garis lurus. Perubahan pastinya muncul setelah rute direncanakan ulang.',
'tours.poi.add': 'Tambahkan sebagai pemberhentian',
'tours.poi.notAPlace': 'Ini menjadi pemberhentian tur, bukan tempat perjalanan.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/it/tours.ts b/shared/src/i18n/it/tours.ts
index 918a1925e..cc98a428f 100644
--- a/shared/src/i18n/it/tours.ts
+++ b/shared/src/i18n/it/tours.ts
@@ -379,7 +379,13 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': "Dall'indice dei luoghi di TREK",
'tours.poi.hoursHint': 'Come li riporta la fonte; verifica prima di andare.',
'tours.poi.website': 'Sito web',
- 'tours.poi.addAfter': 'Aggiungi dopo',
+ 'tours.poi.slot.label': 'Dove va',
+ 'tours.poi.slot.between': 'Tra {from} e {to}',
+ 'tours.poi.slot.newEnd': 'Come nuovo arrivo',
+ 'tours.poi.slot.extends': 'Allunga il giro',
+ 'tours.poi.slot.extendsHint': '{name} non è più l’arrivo: il giro prosegue fino a questo luogo.',
+ 'tours.poi.detourHint':
+ 'Approssimativo, in linea d’aria. La variazione esatta compare quando il percorso viene ricalcolato.',
'tours.poi.add': 'Aggiungi come sosta',
'tours.poi.notAPlace': 'Diventa una sosta del percorso, non un luogo del viaggio.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/ja/tours.ts b/shared/src/i18n/ja/tours.ts
index 3ba9e23fa..f5f5b3877 100644
--- a/shared/src/i18n/ja/tours.ts
+++ b/shared/src/i18n/ja/tours.ts
@@ -361,7 +361,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'TREK の場所インデックスより',
'tours.poi.hoursHint': '情報源の記載どおりです。出発前に確認してください。',
'tours.poi.website': 'ウェブサイト',
- 'tours.poi.addAfter': '次の地点の後に追加',
+ 'tours.poi.slot.label': '追加する位置',
+ 'tours.poi.slot.between': '{from}と{to}の間',
+ 'tours.poi.slot.newEnd': '新しいゴールとして',
+ 'tours.poi.slot.extends': 'ツアーが長くなります',
+ 'tours.poi.slot.extendsHint': '{name}は終点ではなくなり、ツアーはこの場所まで続きます。',
+ 'tours.poi.detourHint': '直線距離による目安です。正確な変化はルートの再計画後に表示されます。',
'tours.poi.add': '立ち寄り地点として追加',
'tours.poi.notAPlace': '旅の場所ではなく、ツアーの立ち寄り地点になります。',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/ko/tours.ts b/shared/src/i18n/ko/tours.ts
index 8dde2fbd1..c57b46e79 100644
--- a/shared/src/i18n/ko/tours.ts
+++ b/shared/src/i18n/ko/tours.ts
@@ -360,7 +360,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'TREK 장소 색인 제공',
'tours.poi.hoursHint': '출처에 나온 그대로입니다. 출발 전에 확인하세요.',
'tours.poi.website': '웹사이트',
- 'tours.poi.addAfter': '다음 지점 뒤에 추가',
+ 'tours.poi.slot.label': '추가할 위치',
+ 'tours.poi.slot.between': '{from}와(과) {to} 사이',
+ 'tours.poi.slot.newEnd': '새 도착지로',
+ 'tours.poi.slot.extends': '투어가 길어집니다',
+ 'tours.poi.slot.extendsHint': '{name}은(는) 더 이상 도착지가 아니며, 투어가 이 장소까지 이어집니다.',
+ 'tours.poi.detourHint': '직선 거리 기준 대략적인 값입니다. 정확한 변화는 경로를 다시 계획한 뒤에 표시됩니다.',
'tours.poi.add': '정차 지점으로 추가',
'tours.poi.notAPlace': '여행의 장소가 아니라 투어의 정차 지점이 됩니다.',
'tours.poi.blocked.fixed': '이 지점 뒤 구간은 비아 페라타나 보트 운반 같은 고정 경로입니다. 다른 지점을 선택하세요.',
diff --git a/shared/src/i18n/nl/tours.ts b/shared/src/i18n/nl/tours.ts
index c0d23a20d..62a43b3b4 100644
--- a/shared/src/i18n/nl/tours.ts
+++ b/shared/src/i18n/nl/tours.ts
@@ -378,7 +378,13 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Uit de plekkenindex van TREK',
'tours.poi.hoursHint': 'Zoals de bron ze geeft; controleer ze voor je gaat.',
'tours.poi.website': 'Webpagina',
- 'tours.poi.addAfter': 'Toevoegen na',
+ 'tours.poi.slot.label': 'Waar het komt',
+ 'tours.poi.slot.between': 'Tussen {from} en {to}',
+ 'tours.poi.slot.newEnd': 'Als nieuw eindpunt',
+ 'tours.poi.slot.extends': 'Maakt de tocht langer',
+ 'tours.poi.slot.extendsHint': '{name} is dan niet meer het eindpunt: de tocht gaat door tot deze plek.',
+ 'tours.poi.detourHint':
+ 'Ongeveer, in een rechte lijn. De precieze verandering zie je zodra de route opnieuw is gepland.',
'tours.poi.add': 'Toevoegen als stop',
'tours.poi.notAPlace': 'Het wordt een stop van de tocht, geen plek van de reis.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/pl/tours.ts b/shared/src/i18n/pl/tours.ts
index 2e0479b87..40b5ae888 100644
--- a/shared/src/i18n/pl/tours.ts
+++ b/shared/src/i18n/pl/tours.ts
@@ -386,7 +386,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Z indeksu miejsc TREK',
'tours.poi.hoursHint': 'Według źródła; sprawdź przed wyjściem.',
'tours.poi.website': 'Strona WWW',
- 'tours.poi.addAfter': 'Dodaj po',
+ 'tours.poi.slot.label': 'Gdzie wstawić',
+ 'tours.poi.slot.between': 'Między {from} a {to}',
+ 'tours.poi.slot.newEnd': 'Jako nowy cel',
+ 'tours.poi.slot.extends': 'Wydłuża trasę',
+ 'tours.poi.slot.extendsHint': '{name} przestaje być celem: trasa prowadzi dalej, do tego miejsca.',
+ 'tours.poi.detourHint': 'W przybliżeniu, w linii prostej. Dokładna zmiana pojawi się po ponownym zaplanowaniu trasy.',
'tours.poi.add': 'Dodaj jako postój',
'tours.poi.notAPlace': 'Stanie się postojem trasy, nie miejscem podróży.',
'tours.poi.blocked.fixed': 'Odcinek za tym punktem to stała linia, via ferrata lub przenoska. Wybierz inny punkt.',
diff --git a/shared/src/i18n/ru/tours.ts b/shared/src/i18n/ru/tours.ts
index 92f5dd2c5..31f3f78d4 100644
--- a/shared/src/i18n/ru/tours.ts
+++ b/shared/src/i18n/ru/tours.ts
@@ -389,7 +389,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Из каталога мест TREK',
'tours.poi.hoursHint': 'По данным источника; проверьте перед выходом.',
'tours.poi.website': 'Сайт',
- 'tours.poi.addAfter': 'Добавить после',
+ 'tours.poi.slot.label': 'Куда вставить',
+ 'tours.poi.slot.between': 'Между {from} и {to}',
+ 'tours.poi.slot.newEnd': 'Как новый финиш',
+ 'tours.poi.slot.extends': 'Удлиняет маршрут',
+ 'tours.poi.slot.extendsHint': '{name} больше не финиш: маршрут продолжается до этого места.',
+ 'tours.poi.detourHint': 'Примерно, по прямой. Точное изменение появится, когда маршрут будет построен заново.',
'tours.poi.add': 'Добавить как остановку',
'tours.poi.notAPlace': 'Это станет остановкой маршрута, а не местом поездки.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/sk/tours.ts b/shared/src/i18n/sk/tours.ts
index e380fe44a..cbe2c1b26 100644
--- a/shared/src/i18n/sk/tours.ts
+++ b/shared/src/i18n/sk/tours.ts
@@ -371,7 +371,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Z registra miest TREK',
'tours.poi.hoursHint': 'Podľa zdroja; pred cestou si ich over.',
'tours.poi.website': 'Webová stránka',
- 'tours.poi.addAfter': 'Pridať za',
+ 'tours.poi.slot.label': 'Kam patrí',
+ 'tours.poi.slot.between': 'Medzi {from} a {to}',
+ 'tours.poi.slot.newEnd': 'Ako nový cieľ',
+ 'tours.poi.slot.extends': 'Predĺži túru',
+ 'tours.poi.slot.extendsHint': '{name} už nebude cieľom: túra pokračuje až k tomuto miestu.',
+ 'tours.poi.detourHint': 'Približne, vzdušnou čiarou. Presnú zmenu uvidíte, keď sa trasa znova naplánuje.',
'tours.poi.add': 'Pridať ako zastávku',
'tours.poi.notAPlace': 'Stane sa zastávkou túry, nie miestom cesty.',
'tours.poi.blocked.fixed': 'Úsek za týmto bodom je pevná čiara, ferrata alebo prenášanie lode. Vyber iný bod.',
diff --git a/shared/src/i18n/sv/tours.ts b/shared/src/i18n/sv/tours.ts
index 22886afde..2263e64b7 100644
--- a/shared/src/i18n/sv/tours.ts
+++ b/shared/src/i18n/sv/tours.ts
@@ -368,7 +368,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Från TREKs platsindex',
'tours.poi.hoursHint': 'Som källan anger dem; kontrollera innan du går.',
'tours.poi.website': 'Webbplats',
- 'tours.poi.addAfter': 'Lägg till efter',
+ 'tours.poi.slot.label': 'Var den hamnar',
+ 'tours.poi.slot.between': 'Mellan {from} och {to}',
+ 'tours.poi.slot.newEnd': 'Som nytt mål',
+ 'tours.poi.slot.extends': 'Förlänger turen',
+ 'tours.poi.slot.extendsHint': '{name} är inte längre målet: turen fortsätter till den här platsen.',
+ 'tours.poi.detourHint': 'Ungefär, fågelvägen. Den exakta ändringen visas när rutten har planerats om.',
'tours.poi.add': 'Lägg till som stopp',
'tours.poi.notAPlace': 'Det blir ett stopp på turen, inte en plats i resan.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/th/tours.ts b/shared/src/i18n/th/tours.ts
index 3c3ebba42..84f04f2ad 100644
--- a/shared/src/i18n/th/tours.ts
+++ b/shared/src/i18n/th/tours.ts
@@ -352,7 +352,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'จากดัชนีสถานที่ของ TREK',
'tours.poi.hoursHint': 'ตามที่แหล่งข้อมูลระบุ ตรวจสอบก่อนออกเดินทาง',
'tours.poi.website': 'เว็บไซต์',
- 'tours.poi.addAfter': 'เพิ่มต่อจาก',
+ 'tours.poi.slot.label': 'ตำแหน่งที่จะเพิ่ม',
+ 'tours.poi.slot.between': 'ระหว่าง {from} และ {to}',
+ 'tours.poi.slot.newEnd': 'เป็นจุดสิ้นสุดใหม่',
+ 'tours.poi.slot.extends': 'ทำให้ทริปยาวขึ้น',
+ 'tours.poi.slot.extendsHint': '{name} จะไม่ใช่จุดสิ้นสุดอีกต่อไป ทริปจะไปต่อจนถึงสถานที่นี้',
+ 'tours.poi.detourHint': 'โดยประมาณ วัดเป็นเส้นตรง การเปลี่ยนแปลงที่แน่นอนจะแสดงเมื่อวางแผนเส้นทางใหม่แล้ว',
'tours.poi.add': 'เพิ่มเป็นจุดแวะ',
'tours.poi.notAPlace': 'จะกลายเป็นจุดแวะของทัวร์ ไม่ใช่สถานที่ของทริป',
'tours.poi.blocked.fixed': 'ช่วงหลังจุดนี้เป็นเส้นคงที่ เช่น เส้นทางปีนเขาหรือการแบกเรือ เลือกจุดอื่น',
diff --git a/shared/src/i18n/tours-locales.spec.ts b/shared/src/i18n/tours-locales.spec.ts
index c5f3354b0..6eaeda7a7 100644
--- a/shared/src/i18n/tours-locales.spec.ts
+++ b/shared/src/i18n/tours-locales.spec.ts
@@ -20,7 +20,7 @@ const toursModules = import.meta.glob<{ default: TranslationStrings }>('./*/tour
const TOUR_DOMAINS: { file: string; generalKeyCount: number; modules: DomainModules }[] = [
{
file: 'tours',
- generalKeyCount: 1278,
+ generalKeyCount: 1283,
modules: toursModules,
},
{
diff --git a/shared/src/i18n/tr/tours.ts b/shared/src/i18n/tr/tours.ts
index 9ff11256a..d13fff911 100644
--- a/shared/src/i18n/tr/tours.ts
+++ b/shared/src/i18n/tr/tours.ts
@@ -370,7 +370,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': "TREK'in yer dizininden",
'tours.poi.hoursHint': 'Kaynakta yazdığı gibi; gitmeden önce kontrol et.',
'tours.poi.website': 'Web sitesi',
- 'tours.poi.addAfter': 'Şundan sonra ekle',
+ 'tours.poi.slot.label': 'Nereye girer',
+ 'tours.poi.slot.between': '{from} ile {to} arasına',
+ 'tours.poi.slot.newEnd': 'Yeni varış noktası olarak',
+ 'tours.poi.slot.extends': 'Turu uzatır',
+ 'tours.poi.slot.extendsHint': '{name} artık varış noktası olmaz: tur bu yere kadar devam eder.',
+ 'tours.poi.detourHint': 'Yaklaşık, kuş uçuşu. Kesin değişiklik rota yeniden planlandığında görünür.',
'tours.poi.add': 'Mola olarak ekle',
'tours.poi.notAPlace': 'Gezinin yeri değil, turun molası olur.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/uk/tours.ts b/shared/src/i18n/uk/tours.ts
index 75865b767..598efc509 100644
--- a/shared/src/i18n/uk/tours.ts
+++ b/shared/src/i18n/uk/tours.ts
@@ -384,7 +384,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'З каталогу місць TREK',
'tours.poi.hoursHint': 'За даними джерела; перевірте перед виходом.',
'tours.poi.website': 'Вебсайт',
- 'tours.poi.addAfter': 'Додати після',
+ 'tours.poi.slot.label': 'Куди вставити',
+ 'tours.poi.slot.between': 'Між {from} і {to}',
+ 'tours.poi.slot.newEnd': 'Як новий фініш',
+ 'tours.poi.slot.extends': 'Подовжує маршрут',
+ 'tours.poi.slot.extendsHint': '{name} більше не фініш: маршрут продовжується до цього місця.',
+ 'tours.poi.detourHint': 'Приблизно, по прямій. Точна зміна з’явиться, щойно маршрут буде сплановано заново.',
'tours.poi.add': 'Додати як зупинку',
'tours.poi.notAPlace': 'Це стане зупинкою маршруту, а не місцем подорожі.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/vi/tours.ts b/shared/src/i18n/vi/tours.ts
index ca420a5de..2b8113ad6 100644
--- a/shared/src/i18n/vi/tours.ts
+++ b/shared/src/i18n/vi/tours.ts
@@ -369,7 +369,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': 'Từ chỉ mục địa điểm của TREK',
'tours.poi.hoursHint': 'Theo nguồn dữ liệu; hãy kiểm tra trước khi đi.',
'tours.poi.website': 'Trang web',
- 'tours.poi.addAfter': 'Thêm sau',
+ 'tours.poi.slot.label': 'Chèn vào đâu',
+ 'tours.poi.slot.between': 'Giữa {from} và {to}',
+ 'tours.poi.slot.newEnd': 'Làm điểm cuối mới',
+ 'tours.poi.slot.extends': 'Làm chuyến đi dài hơn',
+ 'tours.poi.slot.extendsHint': '{name} sẽ không còn là điểm cuối: chuyến đi tiếp tục đến địa điểm này.',
+ 'tours.poi.detourHint': 'Ước tính theo đường thẳng. Thay đổi chính xác sẽ hiện khi tuyến đường được lập lại.',
'tours.poi.add': 'Thêm làm điểm dừng',
'tours.poi.notAPlace': 'Đây trở thành điểm dừng của chuyến, không phải địa điểm của chuyến đi.',
'tours.poi.blocked.fixed':
diff --git a/shared/src/i18n/zh-TW/tours.ts b/shared/src/i18n/zh-TW/tours.ts
index 6e82666db..d256d21f0 100644
--- a/shared/src/i18n/zh-TW/tours.ts
+++ b/shared/src/i18n/zh-TW/tours.ts
@@ -337,7 +337,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': '來自 TREK 地點索引',
'tours.poi.hoursHint': '以來源所列為準;出發前請確認。',
'tours.poi.website': '網站',
- 'tours.poi.addAfter': '新增在其後',
+ 'tours.poi.slot.label': '插入位置',
+ 'tours.poi.slot.between': '在{from}和{to}之間',
+ 'tours.poi.slot.newEnd': '作為新終點',
+ 'tours.poi.slot.extends': '會延長路線',
+ 'tours.poi.slot.extendsHint': '{name}將不再是終點,路線會繼續延伸到這個地點。',
+ 'tours.poi.detourHint': '按直線距離粗略估算。重新規劃路線後會顯示準確變化。',
'tours.poi.add': '新增為停留點',
'tours.poi.notAPlace': '它會成為路線的停留點,而不是行程的地點。',
'tours.poi.blocked.fixed': '此點之後的路段是固定路線,例如攀岩路線或搬運船隻。請選擇其他點。',
diff --git a/shared/src/i18n/zh/tours.ts b/shared/src/i18n/zh/tours.ts
index 2414389fd..a68a21124 100644
--- a/shared/src/i18n/zh/tours.ts
+++ b/shared/src/i18n/zh/tours.ts
@@ -338,7 +338,12 @@ const tours: TranslationStrings = {
'tours.poi.source.trek': '来自 TREK 地点索引',
'tours.poi.hoursHint': '以来源所列为准;出发前请核实。',
'tours.poi.website': '网站',
- 'tours.poi.addAfter': '添加在其后',
+ 'tours.poi.slot.label': '插入位置',
+ 'tours.poi.slot.between': '在{from}和{to}之间',
+ 'tours.poi.slot.newEnd': '作为新终点',
+ 'tours.poi.slot.extends': '会延长路线',
+ 'tours.poi.slot.extendsHint': '{name}将不再是终点,路线会继续延伸到这个地点。',
+ 'tours.poi.detourHint': '按直线距离粗略估算。重新规划路线后会显示准确变化。',
'tours.poi.add': '添加为停留点',
'tours.poi.notAPlace': '它会成为路线的停留点,而不是行程的地点。',
'tours.poi.blocked.fixed': '此点之后的路段是固定线路,例如攀岩路线或搬运船只。请选择其他点。',