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): suggest round hikes of about a wished length from a stop (RTE-03)
Mauricef745ca13c9b1
diff --git a/client/src/components/Tours/planner/LegVariantsCard.tsx b/client/src/components/Tours/planner/LegVariantsCard.tsxindex c688ea449..f8819b0bc 100644--- a/client/src/components/Tours/planner/LegVariantsCard.tsx+++ b/client/src/components/Tours/planner/LegVariantsCard.tsx@@ -1,28 +1,13 @@-import {- AlertTriangle,- ArrowRight,- Check,- Clock,- Loader2,- MoveHorizontal,- Route,- Shuffle,- TrendingDown,- TrendingUp,- X,-} from 'lucide-react';-import { useEffect, type ReactNode } from 'react';+import { AlertTriangle, ArrowRight, Check, Clock, Loader2, MoveHorizontal, Shuffle, TrendingUp } from 'lucide-react';import { useTranslation } from '../../../i18n';import { useSettingsStore } from '../../../store/settingsStore';import type { DistanceUnit } from '../../../types';import { formatDistance, formatElevation } from '../../../utils/units';-import { MAP_CARD_GLASS } from '../../Map/mapControlShadow';-import { SoftPill, WhiteBadge } from '../../Planner/planParts';-import { fs } from '../../shared/DialogShell';+import { SoftPill } from '../../Planner/planParts';import { Tooltip } from '../../shared/Tooltip';import { TourNotice } from '../tourParts';-import { variantPaintCss } from './legVariantPaint';import { variantDelta, type LegVariant } from './legVariants';+import { MapCard, MapCardActions, MapCornerOverlay, StopDisc, VariantFigures, WayChoice } from './mapCardParts';import { formatTourDuration } from './tourDurationInput';import { stopNumbersOf } from './tourPlannerWaypoints';import type { LegComparison } from './useLegVariants';@@ -42,105 +27,6 @@ function endName(stop: number | undefined, t: Translate): string {return stop === undefined ? t('tours.planner.shapingPoint') : t('tours.planner.waypointLabel', { n: stop });}-/**- * One end of the section, as the waypoint list numbers it: a stop by its- * number, a shaping point as the small dot it is on the map.- */-function LegEnd({ stop }: { stop: number | undefined }) {- if (stop === undefined) {- return (- <span className="grid h-5 w-5 flex-none place-items-center" aria-hidden="true">- <span className="h-2.5 w-2.5 rounded-full bg-content-faint ring-2 ring-surface-card" />- </span>- );- }- return (- <span- className="grid h-5 w-5 flex-none place-items-center rounded-full bg-edge font-geist font-semibold tabular-nums text-content"- style={fs(10)}- aria-hidden="true"- >- {stop}- </span>- );-}--/**- * The way's mark, the colour it is drawn in on the map: the way taken now on- * the route's own icon, the others by their letter. The chosen one carries a- * tick at its corner.- */-function VariantMark({ variant, chosen }: { variant: LegVariant; chosen: boolean }) {- return (- <span- className="relative grid h-7 w-7 flex-none place-items-center rounded-full font-geist font-bold uppercase shadow-sm"- // The very colour this way is drawn in on the map: the one link between the row and the line.- style={{ background: variantPaintCss(variant.key), color: 'var(--bike-highlight-casing)', ...fs(12) }}- aria-hidden="true"- >- {variant.current ? <Route size={14} strokeWidth={2.4} /> : variant.key}- {chosen && (- <span className="absolute -bottom-1 -end-1 grid h-3.5 w-3.5 place-items-center rounded-full bg-accent text-accent-text ring-2 ring-surface-card">- <Check size={9} strokeWidth={3.2} />- </span>- )}- </span>- );-}--/** A height-bound figure: the value once the heights are in, a turning wheel while they are asked for, else unknown. */-function heightFigure(variant: LegVariant, value: number | null, format: (value: number) => string, t: Translate) {- if (value !== null) return format(value);- if (variant.heights === 'pending') {- return <Loader2 size={10} className="animate-spin" aria-label={t('tours.variants.heightsPending')} />;- }- return t('tours.hike.ways.unknown');-}--/** What is known of one way, as the badges every tour card uses: length, climb, descent, walking time. */-function VariantFigures({ variant, unit, t }: { variant: LegVariant; unit: DistanceUnit; t: Translate }) {- const elevation = (meters: number) => formatElevation(meters, unit);- const faint = 'flex-none text-content-faint';- const heightsNote = variant.heights === 'unknown' ? t('tours.variants.heightsUnknown') : '';- const badges: { key: string; label: string; icon: ReactNode; value: ReactNode }[] = [- {- key: 'distance',- label: t('tours.detail.distance'),- icon: <MoveHorizontal size={10} strokeWidth={2.2} className={faint} />,- value: formatDistance(variant.distanceM / 1000, unit),- },- {- key: 'ascent',- label: heightsNote || t('tours.detail.ascent'),- icon: <TrendingUp size={10} strokeWidth={2.2} className={faint} />,- value: heightFigure(variant, variant.gainM, elevation, t),- },- {- key: 'descent',- label: heightsNote || t('tours.detail.descent'),- icon: <TrendingDown size={10} strokeWidth={2.2} className={faint} />,- value: heightFigure(variant, variant.lossM, elevation, t),- },- {- key: 'time',- label: heightsNote || t('tours.planner.walkingEstimatedInfo'),- icon: <Clock size={10} strokeWidth={2.2} className={faint} />,- value: heightFigure(variant, variant.minutes, formatTourDuration, t),- },- ];- return (- <span className="flex min-w-0 flex-wrap gap-1">- {badges.map((badge) => (- <Tooltip key={badge.key} label={badge.label}>- <span className="inline-flex" data-figure={badge.key}>- <WhiteBadge icon={badge.icon}>{badge.value}</WhiteBadge>- </span>- </Tooltip>- ))}- </span>- );-}-/** How another way differs from the one taken now, in length and time; nothing it cannot say. */function VariantDelta({variant,@@ -200,31 +86,10 @@ function VariantRow({? t('tours.variants.current'): t('tours.variants.option', { letter: variant.key.toUpperCase() });return (- <button- type="button"- role="radio"- aria-checked={chosen}- aria-label={name}- aria-disabled={disabled}- data-variant={variant.key}- onClick={() => {- if (!disabled) onSelect();- }}- onMouseEnter={() => onHover(true)}- onMouseLeave={() => onHover(false)}- onFocus={() => onHover(true)}- onBlur={() => onHover(false)}- className={`flex w-full items-start gap-2.5 rounded-xl border px-2.5 py-2 text-start transition-colors aria-disabled:cursor-default ${chosen ? 'border-accent bg-surface-card shadow-sm' : 'border-edge-faint bg-surface-secondary hover:border-edge hover:bg-surface-card'}`}- >- <VariantMark variant={variant} chosen={chosen} />- <span className="flex min-w-0 flex-1 flex-col gap-1">- <span className="font-semibold text-content" style={fs(12, 'body')}>- {name}- </span>- <VariantFigures variant={variant} unit={unit} t={t} />- {!variant.current && <VariantDelta variant={variant} current={current} unit={unit} t={t} />}- </span>- </button>+ <WayChoice way={variant} name={name} chosen={chosen} disabled={disabled} onSelect={onSelect} onHover={onHover}>+ <VariantFigures variant={variant} unit={unit} t={t} />+ {!variant.current && <VariantDelta variant={variant} current={current} unit={unit} t={t} />}+ </WayChoice>);}@@ -280,44 +145,29 @@ export function LegVariantsCard({const locked = !planner.canEdit || planner.isSaving || comparison.proving;const canApply = !!chosen && !chosen.current && !locked;return (- <article- className={`flex max-h-[70vh] flex-col gap-2.5 overflow-y-auto overscroll-contain rounded-2xl p-3 text-content ${width ? '' : 'w-[min(22rem,calc(100vw_-_2rem))]'}`}- style={{ ...MAP_CARD_GLASS, width }}- aria-label={t('tours.variants.title')}- data-testid="leg-variants-card"- >- <div className="flex items-start gap-2">- <span className="grid h-7 w-7 flex-none place-items-center rounded-full bg-surface-secondary text-content-muted">- <Shuffle size={14} strokeWidth={2.2} aria-hidden="true" />- </span>- <div className="min-w-0 flex-1">- <h3 className="truncate font-semibold" style={fs(14, 'body')}>- {t('tours.variants.title')}- </h3>- <span- role="group"- className="mt-0.5 flex items-center gap-1 text-content-muted"- aria-label={t('tours.variants.section', { from: endName(from, t), to: endName(to, t) })}- >- <LegEnd stop={from} />- <ArrowRight- size={12}- strokeWidth={2.2}- className="flex-none text-content-faint rtl:-scale-x-100"- aria-hidden="true"- />- <LegEnd stop={to} />- </span>- </div>- <button- type="button"- onClick={close}- aria-label={t('common.close')}- className="flex-none rounded-lg p-1 text-content-muted hover:bg-surface-hover hover:text-content"+ <MapCard+ icon={<Shuffle size={14} strokeWidth={2.2} aria-hidden="true" />}+ title={t('tours.variants.title')}+ subtitle={+ <span+ role="group"+ className="mt-0.5 flex items-center gap-1 text-content-muted"+ aria-label={t('tours.variants.section', { from: endName(from, t), to: endName(to, t) })}>- <X size={14} aria-hidden="true" />- </button>- </div>+ <StopDisc stop={from} />+ <ArrowRight+ size={12}+ strokeWidth={2.2}+ className="flex-none text-content-faint rtl:-scale-x-100"+ aria-hidden="true"+ />+ <StopDisc stop={to} />+ </span>+ }+ onClose={close}+ width={width}+ testId="leg-variants-card"+ ><div role="radiogroup" aria-label={t('tours.variants.title')} className="flex flex-col gap-1.5">{comparison.variants.map((variant) => (<VariantRow@@ -333,41 +183,22 @@ export function LegVariantsCard({))}</div><ComparisonNotice comparison={comparison} t={t} />- <div className="flex items-center justify-end gap-2 pt-0.5">- <button- type="button"- onClick={close}- className="inline-flex h-8 items-center rounded-[10px] px-3 font-semibold text-content-muted transition-colors hover:bg-surface-hover hover:text-content"- style={fs(12, 'body')}- >- {t('common.cancel')}- </button>- <button- type="button"- disabled={!canApply}- onClick={() => void apply()}- data-testid="leg-variants-apply"- 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')}- >- {comparison.proving ? (- <Loader2 size={14} className="animate-spin" aria-hidden="true" />- ) : (- <Check size={14} strokeWidth={2.4} aria-hidden="true" />- )}- {comparison.proving ? t('tours.variants.checking') : t('tours.variants.apply')}- </button>- </div>- </article>+ <MapCardActions+ secondary={{ label: t('common.cancel'), onClick: close }}+ primary={{+ label: comparison.proving ? t('tours.variants.checking') : t('tours.variants.apply'),+ icon: <Check size={14} strokeWidth={2.4} aria-hidden="true" />,+ busy: comparison.proving,+ disabled: !canApply,+ onClick: () => void apply(),+ testId: 'leg-variants-apply',+ }}+ />+ </MapCard>);}-/**- * The comparison's card over the planner map, where a via ferrata's or a- * place's card sits. Unlike those it stays while the map is panned and zoomed,- * since the map is what the ways are compared on; Escape and its own buttons- * close it.- */+/** The comparison's card in the corner over the planner map, while a section is compared. */export default function LegVariantsOverlay({planner,insetEnd,@@ -380,23 +211,10 @@ export default function LegVariantsOverlay({width?: number;}) {const { comparison, close } = planner.legVariants;- const open = comparison !== null;- useEffect(() => {- if (!open) return;- const onKey = (event: KeyboardEvent) => {- if (event.key === 'Escape' && !event.defaultPrevented) close();- };- document.addEventListener('keydown', onKey);- return () => document.removeEventListener('keydown', onKey);- }, [close, open]);if (!comparison) return null;return (- <div- className="absolute z-[20] flex justify-end transition-[bottom] duration-200 ease-out"- style={{ insetInlineEnd: insetEnd, bottom, maxWidth: `calc(100% - ${insetEnd + 32}px)` }}- data-testid="leg-variants-overlay"- >+ <MapCornerOverlay onClose={close} insetEnd={insetEnd} bottom={bottom} testId="leg-variants-overlay"><LegVariantsCard planner={planner} comparison={comparison} width={width} />- </div>+ </MapCornerOverlay>);}diff --git a/client/src/components/Tours/planner/RoundHikeCard.test.tsx b/client/src/components/Tours/planner/RoundHikeCard.test.tsxnew file mode 100644index 000000000..f87d03145--- /dev/null+++ b/client/src/components/Tours/planner/RoundHikeCard.test.tsx@@ -0,0 +1,216 @@+// FE-TOUR-ROUND-HIKE-CARD-001 to FE-TOUR-ROUND-HIKE-CARD-009: the card over the planner map that+// looks for round hikes out of a stop and takes one on purpose (RTE-03).+import userEvent from '@testing-library/user-event';+import { beforeEach, describe, expect, it } from 'vitest';+import { fireEvent, render, screen, within } from '../../../../tests/helpers/render';+import { seedStore } from '../../../../tests/helpers/store';+import { idleRoundHikes } from '../../../../tests/helpers/tourPlannerStub';+import { useSettingsStore } from '../../../store/settingsStore';+import RoundHikeOverlay, { RoundHikeCard } from './RoundHikeCard';+import type { RoundCandidate } from './roundHikes';+import type { RoundHikeView } from './useRoundHikes';+import type { TourPlannerController } from './useTourPlanner';++const POINTS = [+ { id: 'a', lat: 47.5, lng: 11.1, role: 'start' as const, name: 'Hut' },+ { id: 's', lat: 47.51, lng: 11.11, role: 'via' as const, shaping: true },+ { id: 'b', lat: 47.52, lng: 11.12, role: 'end' as const },+];++const round = (key: RoundCandidate['key'], overrides: Partial<RoundCandidate> = {}): RoundCandidate => ({+ key,+ current: false,+ coordinates: [+ [47.5, 11.1],+ [47.51, 11.1],+ [47.5, 11.1],+ ],+ distanceM: 10_400,+ gainM: 420,+ lossM: 420,+ minutes: 190,+ heights: 'known',+ via: [],+ ...overrides,+});++const REQUEST = { startId: 'a', start: { lat: 47.5, lng: 11.1 }, targetM: 10_000, costing: {}, key: 'k' };++function view(overrides: Partial<RoundHikeView> = {}): RoundHikeView {+ return {+ startId: 'a',+ targetM: 10_000,+ request: null,+ phase: 'setup',+ candidates: [],+ asked: 0,+ selected: null,+ confirming: false,+ notice: null,+ ...overrides,+ };+}++type CardPlanner = Pick<+ TourPlannerController,+ 'waypoints' | 'roundHikes' | 'canEdit' | 'isSaving' | 'maxHikingDifficulty'+>;++function planner(open: RoundHikeView | null, overrides: Partial<CardPlanner> = {}): CardPlanner {+ return {+ waypoints: POINTS,+ roundHikes: { ...idleRoundHikes(), view: open },+ canEdit: true,+ isSaving: false,+ maxHikingDifficulty: 2,+ ...overrides,+ } as unknown as CardPlanner;+}++function renderCard(open: RoundHikeView, overrides: Partial<CardPlanner> = {}) {+ const controller = planner(open, overrides);+ render(<RoundHikeCard planner={controller} view={open} />);+ return controller.roundHikes;+}++beforeEach(() => {+ seedStore(useSettingsStore, { settings: { distance_unit: 'metric' } });+});++describe('RoundHikeCard', () => {+ it('FE-TOUR-ROUND-HIKE-CARD-001: starts from the chosen stop with the last length, the window it allows and the hike’s limit', async () => {+ const actions = renderCard(view());+ const card = screen.getByTestId('round-hike-card');+ expect(within(card).getByRole('heading', { name: 'Round hike' })).toBeInTheDocument();+ expect(within(card).getByRole('button', { name: /^Start point: ?Waypoint 1/ })).toBeInTheDocument();+ expect(within(card).getByLabelText('Distance')).toHaveValue('10');+ expect(within(card).getByTestId('round-hike-window')).toHaveTextContent('8 km to 12 km');+ expect(within(card).getByTestId('round-hike-limit')).toHaveTextContent('T2');+ await userEvent.click(within(card).getByTestId('round-hike-find'));+ expect(actions.find).toHaveBeenCalledWith(10_000);+ // Enter in the field asks the same.+ await userEvent.type(within(card).getByLabelText('Distance'), '{Backspace}5{Enter}');+ expect(actions.find).toHaveBeenLastCalledWith(15_000);+ });++ it('FE-TOUR-ROUND-HIKE-CARD-002: a length out of range says which lengths can be asked for and asks nothing', async () => {+ const actions = renderCard(view());+ const field = screen.getByLabelText('Distance');+ await userEvent.clear(field);+ await userEvent.type(field, '0,5');+ expect(field).toHaveAttribute('aria-invalid', 'true');+ expect(screen.getByText('Enter a distance from 1 km to 60 km.')).toBeInTheDocument();+ expect(screen.queryByTestId('round-hike-window')).not.toBeInTheDocument();+ expect(screen.getByTestId('round-hike-find')).toBeDisabled();+ await userEvent.type(field, '{Enter}');+ expect(actions.find).not.toHaveBeenCalled();+ await userEvent.clear(field);+ await userEvent.type(field, '12,5');+ await userEvent.click(screen.getByTestId('round-hike-find'));+ expect(actions.find).toHaveBeenCalledWith(12_500);+ });++ it('FE-TOUR-ROUND-HIKE-CARD-003: in miles the length is typed and shown in miles', async () => {+ seedStore(useSettingsStore, { settings: { distance_unit: 'imperial' } });+ const actions = renderCard(view());+ expect(screen.getByLabelText('Distance')).toHaveValue('6.2');+ expect(screen.getByText('mi')).toBeInTheDocument();+ await userEvent.click(screen.getByTestId('round-hike-find'));+ expect(actions.find.mock.calls[0][0]).toBeCloseTo(9_978, 0);+ });++ it('FE-TOUR-ROUND-HIKE-CARD-004: while it looks, the bar fills, the rounds found show and nothing can be taken yet', async () => {+ const actions = renderCard(view({ request: REQUEST, phase: 'searching', asked: 6, candidates: [round('a')] }));+ expect(screen.getByRole('progressbar', { name: 'Looking for rounds' })).toHaveAttribute('aria-valuenow', '6');+ expect(screen.getByRole('radio', { name: 'Round A' })).toBeInTheDocument();+ expect(screen.queryByLabelText('Distance')).not.toBeInTheDocument();+ expect(screen.getByTestId('round-hike-apply')).toBeDisabled();+ await userEvent.click(screen.getByRole('button', { name: 'Cancel' }));+ expect(actions.back).toHaveBeenCalledTimes(1);+ });++ it('FE-TOUR-ROUND-HIKE-CARD-005: each round shows its figures and how far it lies off the wish; taking one is its own step', async () => {+ const pending = { distanceM: 9_200, heights: 'pending' as const, gainM: null, lossM: null, minutes: null };+ const rounds = [round('a'), round('b', pending)];+ const actions = renderCard(view({ request: REQUEST, phase: 'done', candidates: rounds }));+ const [first, second] = screen.getAllByRole('radio');+ expect(within(first).getByText('10.4 km')).toBeInTheDocument();+ expect(within(first).getAllByText('420 m')).toHaveLength(2);+ expect(within(first).getByTestId('round-hike-deviation')).toHaveTextContent('+4%');+ expect(within(second).getByTestId('round-hike-deviation')).toHaveTextContent('-8%');+ expect(within(second).getAllByLabelText('Heights are being looked up')).toHaveLength(3);+ expect(screen.getByTestId('round-hike-apply')).toBeDisabled();+ await userEvent.click(second);+ expect(actions.select).toHaveBeenCalledWith('b');+ fireEvent.mouseEnter(first);+ expect(actions.hover).toHaveBeenLastCalledWith('a');+ fireEvent.mouseLeave(first);+ expect(actions.hover).toHaveBeenLastCalledWith(null);+ expect(actions.apply).not.toHaveBeenCalled();+ await userEvent.click(screen.getByRole('button', { name: 'Search again' }));+ expect(actions.back).toHaveBeenCalledTimes(1);+ });++ it('FE-TOUR-ROUND-HIKE-CARD-006: the chosen round is taken on the button, never while the tour is locked', async () => {+ const done = view({ request: REQUEST, phase: 'done', candidates: [round('a')], selected: 'a' });+ const free = planner(done);+ const { unmount } = render(<RoundHikeCard planner={free} view={done} />);+ expect(screen.getByRole('radio', { name: 'Round A' })).toHaveAttribute('aria-checked', 'true');+ await userEvent.click(screen.getByTestId('round-hike-apply'));+ expect(free.roundHikes.apply).toHaveBeenCalledTimes(1);+ unmount();+ render(<RoundHikeCard planner={planner(done, { isSaving: true })} view={done} />);+ expect(screen.getByTestId('round-hike-apply')).toBeDisabled();+ });++ it('FE-TOUR-ROUND-HIKE-CARD-007: says honestly when the router failed, none fit, fewer fit or the tour changed', () => {+ const { unmount } = render(+ <RoundHikeCard planner={planner(null)} view={view({ request: REQUEST, phase: 'failed' })} />+ );+ expect(screen.getByRole('status')).toHaveTextContent('The router did not answer');+ unmount();+ const none = render(<RoundHikeCard planner={planner(null)} view={view({ request: REQUEST, phase: 'done' })} />);+ expect(screen.getByRole('status')).toHaveTextContent('between 8 km and 12 km');+ none.unmount();+ const one = view({ request: REQUEST, phase: 'done', candidates: [round('a')] });+ const fewer = render(<RoundHikeCard planner={planner(null)} view={one} />);+ expect(screen.getByRole('status')).toHaveTextContent('No more rounds fit this distance from here.');+ fewer.unmount();+ const three = render(+ <RoundHikeCard+ planner={planner(null)}+ view={view({ request: REQUEST, phase: 'done', candidates: [round('a'), round('b'), round('c')] })}+ />+ );+ expect(screen.queryByRole('status')).not.toBeInTheDocument();+ three.unmount();+ render(<RoundHikeCard planner={planner(null)} view={view({ notice: 'stale' })} />);+ expect(screen.getByRole('status')).toHaveTextContent('The start point or the limit changed.');+ });++ it('FE-TOUR-ROUND-HIKE-CARD-008: replacing planned points waits for a yes in its own dialog', async () => {+ const actions = renderCard(+ view({ request: REQUEST, phase: 'done', candidates: [round('a')], selected: 'a', confirming: true })+ );+ expect(screen.getByText('Replace the planned route?')).toBeInTheDocument();+ await userEvent.click(screen.getByRole('button', { name: 'Replace' }));+ expect(actions.confirm).toHaveBeenCalledTimes(1);+ });++ it('FE-TOUR-ROUND-HIKE-CARD-009: the overlay shows the card while open, picks another start and closes on Escape', async () => {+ const closed = planner(null);+ const { unmount } = render(<RoundHikeOverlay planner={closed} insetEnd={16} bottom={12} />);+ expect(screen.queryByTestId('round-hike-overlay')).not.toBeInTheDocument();+ unmount();+ const open = planner(view());+ render(<RoundHikeOverlay planner={open} insetEnd={16} bottom={12} />);+ expect(screen.getByTestId('round-hike-overlay')).toBeInTheDocument();+ await userEvent.click(screen.getByRole('button', { name: /^Start point: ?Waypoint 1/ }));+ // A shaping point is no place to start from: only the stops are offered.+ expect(screen.queryByRole('button', { name: /^Shaping point/ })).not.toBeInTheDocument();+ await userEvent.click(screen.getByRole('button', { name: /^Waypoint 2/ }));+ expect(open.roundHikes.open).toHaveBeenCalledWith('b');+ fireEvent.keyDown(document, { key: 'Escape' });+ expect(open.roundHikes.close).toHaveBeenCalledTimes(1);+ });+});diff --git a/client/src/components/Tours/planner/RoundHikeCard.tsx b/client/src/components/Tours/planner/RoundHikeCard.tsxnew file mode 100644index 000000000..2ee0ada90--- /dev/null+++ b/client/src/components/Tours/planner/RoundHikeCard.tsx@@ -0,0 +1,355 @@+import { AlertTriangle, Check, Loader2, Mountain, RefreshCcwDot, Search, Target } from 'lucide-react';+import { useState } from 'react';+import { useTranslation } from '../../../i18n';+import { useSettingsStore } from '../../../store/settingsStore';+import type { DistanceUnit } from '../../../types';+import { formatDistance, getDistanceUnitLabel } from '../../../utils/units';+import { SoftPill } from '../../Planner/planParts';+import ConfirmDialog from '../../shared/ConfirmDialog';+import { fs } from '../../shared/DialogShell';+import { INPUT, LABEL, PillSelect } from '../../shared/dialogParts';+import { Tooltip } from '../../shared/Tooltip';+import { TourNotice } from '../tourParts';+import { MapCard, MapCardActions, MapCornerOverlay, StopDisc, VariantFigures, WayChoice } from './mapCardParts';+import { MAX_ROUND_ASKS } from './roundHikeRouting';+import {+ deviationOf,+ distanceWindow,+ isRoundTarget,+ metersTyped,+ ROUND_MAX_M,+ ROUND_MIN_M,+ ROUND_TOLERANCE,+ roundStarts,+ typedLength,+ type RoundCandidate,+} from './roundHikes';+import { stopNumbersOf } from './tourPlannerWaypoints';+import type { RoundHikeView } from './useRoundHikes';+import type { TourPlannerController } from './useTourPlanner';++type Translate = ReturnType<typeof useTranslation>['t'];+type Planner = Pick<TourPlannerController, 'waypoints' | 'roundHikes' | 'canEdit' | 'isSaving' | 'maxHikingDifficulty'>;++/** A length in metres as the unit the traveller reads lengths in. */+const formatMeters = (meters: number, unit: DistanceUnit) => formatDistance(meters / 1000, unit);++/** Where a round can start: the tour's stops, by the number they carry in the list and on the map. */+function StartPicker({ planner, view, t }: { planner: Planner; view: RoundHikeView; t: Translate }) {+ const numbers = stopNumbersOf(planner.waypoints);+ const options = roundStarts(planner.waypoints).map((point) => ({+ value: point.id,+ label: t('tours.planner.waypointLabel', { n: numbers.get(point.id) ?? 0 }),+ icon: <StopDisc stop={numbers.get(point.id)} />,+ ...(point.name ? { hint: point.name } : {}),+ }));+ return (+ <span className="mt-1 flex min-w-0 items-center gap-1.5 text-content-muted" style={fs(11.5, 'body')}>+ {t('tours.round.from')}+ <PillSelect+ quiet+ label={t('tours.round.start')}+ value={view.startId}+ options={options}+ onChange={planner.roundHikes.open}+ />+ </span>+ );+}++/**+ * The wished length, typed in the traveller's unit, with the window a round+ * has to fall into beside it and the hike's limit the rounds keep to.+ */+function DistanceField({+ text,+ onText,+ onEnter,+ limit,+ unit,+ t,+}: {+ text: string;+ onText: (text: string) => void;+ /** Enter in the field looks for rounds, as the button does. */+ onEnter: () => void;+ limit: number;+ unit: DistanceUnit;+ t: Translate;+}) {+ const typed = metersTyped(text, unit);+ const valid = isRoundTarget(typed);+ const range = valid ? distanceWindow(typed) : null;+ return (+ <div className="min-w-0">+ <label htmlFor="round-hike-distance" className={LABEL}>+ {t('tours.round.distance')}+ </label>+ <div className="flex flex-wrap items-center gap-1.5">+ <span className="relative w-28 flex-none">+ <input+ id="round-hike-distance"+ type="text"+ inputMode="decimal"+ autoComplete="off"+ value={text}+ onChange={(event) => onText(event.target.value)}+ onKeyDown={(event) => {+ if (event.key === 'Enter') onEnter();+ }}+ aria-invalid={!valid || undefined}+ aria-describedby={valid ? undefined : 'round-hike-distance-error'}+ className={`${INPUT} pe-10 tabular-nums`}+ />+ <span+ className="pointer-events-none absolute inset-y-0 end-3 flex items-center font-geist text-content-faint"+ style={fs(11.5)}+ >+ {getDistanceUnitLabel(unit)}+ </span>+ </span>+ {range && (+ <Tooltip label={t('tours.round.windowHint', { percent: Math.round(ROUND_TOLERANCE * 100) })}>+ <span className="inline-flex" data-testid="round-hike-window">+ <SoftPill icon={<Target size={10} strokeWidth={2.2} aria-hidden="true" />}>+ {t('tours.round.window', {+ min: formatMeters(range.minM, unit),+ max: formatMeters(range.maxM, unit),+ })}+ </SoftPill>+ </span>+ </Tooltip>+ )}+ <Tooltip label={t('tours.round.limitHint', { limit: t(`tours.planner.difficulty.t${limit}`) })}>+ <span className="inline-flex" data-testid="round-hike-limit">+ <SoftPill icon={<Mountain size={10} strokeWidth={2.2} aria-hidden="true" />}>{`T${limit}`}</SoftPill>+ </span>+ </Tooltip>+ </div>+ {!valid && (+ <p id="round-hike-distance-error" className="m-0 mt-1 text-danger" style={fs(11)}>+ {t('tours.round.distanceRange', {+ min: formatMeters(ROUND_MIN_M, unit),+ max: formatMeters(ROUND_MAX_M, unit),+ })}+ </p>+ )}+ </div>+ );+}++/** One round as a choice in the list: its mark, its figures, and how far it lies off the wish. */+function RoundRow({+ round,+ targetM,+ chosen,+ unit,+ onSelect,+ onHover,+}: {+ round: RoundCandidate;+ targetM: number;+ chosen: boolean;+ unit: DistanceUnit;+ onSelect: () => void;+ onHover: (on: boolean) => void;+}) {+ const { t, language } = useTranslation();+ const name = t('tours.round.option', { letter: round.key.toUpperCase() });+ const deviation = new Intl.NumberFormat(language, {+ style: 'percent',+ maximumFractionDigits: 0,+ signDisplay: 'exceptZero',+ }).format(deviationOf(round.distanceM, targetM));+ return (+ <WayChoice+ way={round}+ name={name}+ chosen={chosen}+ onSelect={onSelect}+ onHover={onHover}+ aside={+ <Tooltip label={t('tours.round.deviationHint', { target: formatMeters(targetM, unit) })}>+ <span className="inline-flex" data-testid="round-hike-deviation">+ <SoftPill icon={<Target size={10} strokeWidth={2.2} aria-hidden="true" />}>+ <span className="tabular-nums">{deviation}</span>+ </SoftPill>+ </span>+ </Tooltip>+ }+ >+ <VariantFigures variant={round} unit={unit} t={t} />+ </WayChoice>+ );+}++/** How far the search has come: a thin bar that fills with the questions put to the router. */+function SearchProgress({ asked, t }: { asked: number; t: Translate }) {+ const share = Math.min(1, asked / MAX_ROUND_ASKS);+ return (+ <div className="flex flex-col gap-1.5" role="status">+ <span className="flex items-center gap-1.5 text-content-muted" style={fs(12, 'body')}>+ <Loader2 size={13} className="animate-spin" aria-hidden="true" />+ {t('tours.round.searching')}+ </span>+ <div+ role="progressbar"+ aria-label={t('tours.round.searching')}+ aria-valuemin={0}+ aria-valuemax={MAX_ROUND_ASKS}+ aria-valuenow={asked}+ className="h-1 overflow-hidden rounded-full bg-surface-tertiary"+ >+ <div+ className="h-full rounded-full bg-accent transition-[width] duration-300 ease-out"+ style={{ width: `${Math.max(4, share * 100)}%` }}+ />+ </div>+ </div>+ );+}++/** What the card says besides the rounds: that the tour changed, the router did not answer, none or fewer fit. */+function RoundNotice({ view, unit, t }: { view: RoundHikeView; unit: DistanceUnit; t: Translate }) {+ const warning = (text: string) => (+ <TourNotice role="status" tone="warning" icon={<AlertTriangle size={13} aria-hidden="true" />}>+ {text}+ </TourNotice>+ );+ if (view.notice === 'stale') return warning(t('tours.round.stale'));+ if (view.phase === 'failed') return warning(t('tours.round.failed'));+ if (view.phase !== 'done') return null;+ if (view.candidates.length === 0) {+ const { minM, maxM } = distanceWindow(view.targetM);+ return warning(t('tours.round.none', { min: formatMeters(minM, unit), max: formatMeters(maxM, unit) }));+ }+ return view.candidates.length < 3 ? <TourNotice role="status">{t('tours.round.fewer')}</TourNotice> : null;+}++/** The rounds found so far, each drawn on the map in its colour; pointing at one lights its line up. */+function RoundList({+ planner,+ view,+ unit,+ t,+}: {+ planner: Planner;+ view: RoundHikeView;+ unit: DistanceUnit;+ t: Translate;+}) {+ if (view.candidates.length === 0) return null;+ const { select, hover } = planner.roundHikes;+ return (+ <div role="radiogroup" aria-label={t('tours.round.title')} className="flex flex-col gap-1.5">+ {view.candidates.map((round) => (+ <RoundRow+ key={round.key}+ round={round}+ targetM={view.request?.targetM ?? view.targetM}+ chosen={round.key === view.selected}+ unit={unit}+ onSelect={() => select(round.key)}+ onHover={(on) => hover(on ? round.key : null)}+ />+ ))}+ </div>+ );+}++/**+ * RTE-03: round hikes of about a wished length out of one of the tour's stops,+ * in the look of the other cards over the planner map. The start and the+ * length are set first; the rounds found are listed and drawn on the map+ * in their colours as they come. Choosing one only marks it: the tour changes+ * on the button, after a yes when there were points planned before, and+ * closing leaves everything as it was.+ */+export function RoundHikeCard({ planner, view, width }: { planner: Planner; view: RoundHikeView; width?: number }) {+ const { t } = useTranslation();+ const unit = useSettingsStore((state) => state.settings.distance_unit) ?? 'metric';+ const { find, back, apply, confirm, cancelConfirm, close } = planner.roundHikes;+ const [text, setText] = useState(() => typedLength(view.targetM, unit));+ const typed = metersTyped(text, unit);+ const locked = !planner.canEdit || planner.isSaving;+ const setup = view.phase === 'setup';+ const findTyped = () => {+ if (!locked && isRoundTarget(typed)) find(typed);+ };+ const actions = setup+ ? {+ secondary: { label: t('common.cancel'), onClick: close },+ primary: {+ label: t('tours.round.find'),+ icon: <Search size={14} strokeWidth={2.4} aria-hidden="true" />,+ disabled: locked || !isRoundTarget(typed),+ onClick: findTyped,+ testId: 'round-hike-find',+ },+ }+ : {+ secondary: { label: view.phase === 'searching' ? t('common.cancel') : t('tours.round.again'), onClick: back },+ primary: {+ label: t('tours.round.apply'),+ icon: <Check size={14} strokeWidth={2.4} aria-hidden="true" />,+ busy: view.phase === 'searching',+ disabled: locked || view.phase !== 'done' || view.selected === null,+ onClick: apply,+ testId: 'round-hike-apply',+ },+ };+ return (+ <MapCard+ icon={<RefreshCcwDot size={14} strokeWidth={2.2} aria-hidden="true" />}+ title={t('tours.round.title')}+ subtitle={<StartPicker planner={planner} view={view} t={t} />}+ onClose={close}+ width={width}+ testId="round-hike-card"+ >+ {setup && (+ <DistanceField+ text={text}+ onText={setText}+ onEnter={findTyped}+ limit={planner.maxHikingDifficulty}+ unit={unit}+ t={t}+ />+ )}+ {view.phase === 'searching' && <SearchProgress asked={view.asked} t={t} />}+ <RoundList planner={planner} view={view} unit={unit} t={t} />+ <RoundNotice view={view} unit={unit} t={t} />+ <MapCardActions {...actions} />+ <ConfirmDialog+ isOpen={view.confirming}+ onClose={cancelConfirm}+ onConfirm={confirm}+ title={t('tours.round.replaceTitle')}+ message={t('tours.round.replaceBody')}+ confirmLabel={t('tours.round.replace')}+ />+ </MapCard>+ );+}++/** The round hike's card in the corner over the planner map, while it is open. */+export default function RoundHikeOverlay({+ planner,+ insetEnd,+ bottom,+ width,+}: {+ planner: Planner;+ insetEnd: number;+ bottom: number;+ width?: number;+}) {+ const { view, close } = planner.roundHikes;+ if (!view) return null;+ return (+ <MapCornerOverlay onClose={close} insetEnd={insetEnd} bottom={bottom} testId="round-hike-overlay">+ <RoundHikeCard planner={planner} view={view} width={width} />+ </MapCornerOverlay>+ );+}diff --git a/client/src/components/Tours/planner/TourWaypointList.test.tsx b/client/src/components/Tours/planner/TourWaypointList.test.tsxindex 7d0694fda..a0bfde2d6 100644--- a/client/src/components/Tours/planner/TourWaypointList.test.tsx+++ b/client/src/components/Tours/planner/TourWaypointList.test.tsx@@ -1,13 +1,14 @@-// FE-TOUR-WAYPOINT-LIST-001 to FE-TOUR-WAYPOINT-LIST-013: shaping points, the water router's answers-// and a city walk's stops in the list, with their arrivals and opening hours on a day of the walk, and-// other ways for a hike's leg (P2A-03, P2A-05, PAD-11, CW-01, CW-02, CW-04, RTE-02).+// FE-TOUR-WAYPOINT-LIST-001 to FE-TOUR-WAYPOINT-LIST-015: shaping points, the water router's answers+// and a city walk's stops in the list, with their arrivals and opening hours on a day of the walk,+// other ways for a hike's leg and round hikes out of a stop (P2A-03, P2A-05, PAD-11, CW-01, CW-02,+// CW-04, RTE-02, RTE-03).import userEvent from '@testing-library/user-event';import type { PaddleRouteLeg } from '@trek/shared';import { beforeEach, describe, expect, it, vi } from 'vitest';import { buildAssignment, buildDay, buildPlace } from '../../../../tests/helpers/factories';import { render, screen, within } from '../../../../tests/helpers/render';import { resetAllStores, seedStore } from '../../../../tests/helpers/store';-import { hikePlannerDefaults, idleLegVariants } from '../../../../tests/helpers/tourPlannerStub';+import { hikePlannerDefaults, idleLegVariants, idleRoundHikes } from '../../../../tests/helpers/tourPlannerStub';import { useSettingsStore } from '../../../store/settingsStore';import { useTripStore } from '../../../store/tripStore';import type { PaddleTourRoute } from './paddleRouting';@@ -287,6 +288,30 @@ describe('TourWaypointList', () => {expect(screen.queryByRole('button', { name: 'Compare ways for the next leg' })).not.toBeInTheDocument();});+ it('FE-TOUR-WAYPOINT-LIST-014: a stop of a hike offers round hikes out of it; a shaping point does not (RTE-03)', async () => {+ const roundHikes = { ...idleRoundHikes(), canStart: vi.fn((id: string) => id !== 's') };+ render(<TourWaypointList planner={planner({ roundHikes })} canEdit isSaving={false} />);+ const rows = screen.getAllByTestId('tour-planner-waypoint-row');+ await userEvent.click(within(at(rows, 2)).getByRole('button', { name: 'More actions' }));+ await userEvent.click(screen.getByRole('button', { name: 'Round hike from here' }));+ expect(roundHikes.open).toHaveBeenCalledWith('b');+ await userEvent.click(within(at(rows, 1)).getByRole('button', { name: 'More actions' }));+ expect(screen.queryByRole('button', { name: 'Round hike from here' })).not.toBeInTheDocument();+ });++ it('FE-TOUR-WAYPOINT-LIST-015: the head offers a round hike out of the start on a hike only (RTE-03)', async () => {+ const roundHikes = { ...idleRoundHikes(), canStart: vi.fn(() => true) };+ const { unmount } = render(<TourWaypointList planner={planner({ roundHikes })} canEdit isSaving={false} />);+ await userEvent.click(screen.getByTestId('tour-planner-round-hike'));+ expect(roundHikes.open).toHaveBeenCalledWith('a');+ unmount();+ const saving = render(<TourWaypointList planner={planner({ roundHikes })} canEdit isSaving />);+ expect(screen.getByTestId('tour-planner-round-hike')).toBeDisabled();+ saving.unmount();+ render(<TourWaypointList planner={planner({ roundHikes, tourType: 'bike' })} canEdit isSaving={false} />);+ expect(screen.queryByTestId('tour-planner-round-hike')).not.toBeInTheDocument();+ });+describe('a city walk on a day of the plan (CW-02, CW-04)', () => {const lenbachhaus = {...START,diff --git a/client/src/components/Tours/planner/TourWaypointList.tsx b/client/src/components/Tours/planner/TourWaypointList.tsxindex 89578ffa8..104a0c4fa 100644--- a/client/src/components/Tours/planner/TourWaypointList.tsx+++ b/client/src/components/Tours/planner/TourWaypointList.tsx@@ -9,6 +9,7 @@ import {MapPinPlus,MoreHorizontal,Navigation,+ RefreshCcwDot,RefreshCw,Repeat,Shuffle,@@ -408,6 +409,15 @@ function routeMenuItems(return items;}+/** RTE-03: round hikes out of this stop, of about a wished length. */+function roundMenuItems(planner: TourPlannerController, point: WaypointPoint, t: Translate): MenuItems {+ if (!planner.roundHikes.canStart(point.id)) return [];+ return [+ { divider: true },+ { label: t('tours.planner.roundHikeFrom'), icon: RefreshCcwDot, onClick: () => planner.roundHikes.open(point.id) },+ ];+}+/** A paddle tour's tools at a point: carry the boat from here, and a lock here. */function paddleMenuItems(paddle: ReturnType<typeof usePaddleWaypointActions>,@@ -483,6 +493,7 @@ function WaypointRowActions({onClick: () => planner.moveWaypoint(point.id, 1),},...routeMenuItems(planner, point, index, lastIndex, t),+ ...roundMenuItems(planner, point, t),...(planner.isPaddle ? paddleMenuItems(paddle, point, index < lastIndex, t) : []),...(onUnlink? [{ divider: true } as const, { label: t('tours.placePicker.unlink'), icon: Unlink, onClick: onUnlink }]@@ -595,10 +606,14 @@ function ShapeOnLineHint({ planner, canEdit }: { planner: TourPlannerController;);}-/** The route tools in the card head: reverse, plan the drawn legs on the water (PAD-11), back to the start. */+/**+ * The route tools in the card head: reverse, plan the drawn legs on the water+ * (PAD-11), back to the start, and on a hike round hikes out of the start (RTE-03).+ */function WaypointListTools({ planner, isSaving }: { planner: TourPlannerController; isSaving: boolean }) {const { t } = useTranslation();const hasDrawnLegs = planner.isPaddle && planner.waypoints.some((point) => point.fixedLeg?.kind === 'free');+ const start = planner.waypoints[0];return (<span className="flex flex-none items-center gap-0.5"><RouteToolButton@@ -627,6 +642,16 @@ function WaypointListTools({ planner, isSaving }: { planner: TourPlannerControll><Repeat size={13} strokeWidth={2.2} /></RouteToolButton>+ {planner.tourType === 'hike' && start && (+ <RouteToolButton+ testId="tour-planner-round-hike"+ label={t('tours.planner.roundHike')}+ disabled={isSaving || !planner.roundHikes.canStart(start.id)}+ onAct={() => planner.roundHikes.open(start.id)}+ >+ <RefreshCcwDot size={13} strokeWidth={2.2} />+ </RouteToolButton>+ )}</span>);}diff --git a/client/src/components/Tours/planner/legVariantPaint.test.ts b/client/src/components/Tours/planner/legVariantPaint.test.tsindex bd3a0e2f3..b96675eda 100644--- a/client/src/components/Tours/planner/legVariantPaint.test.ts+++ b/client/src/components/Tours/planner/legVariantPaint.test.ts@@ -1,5 +1,6 @@-// FE-TOUR-LEG-VARIANT-PAINT-001 to FE-TOUR-LEG-VARIANT-PAINT-003: the ways of a compared section-// on the planner map, each in its colour, the one in focus on top (RTE-02).+// FE-TOUR-LEG-VARIANT-PAINT-001 to FE-TOUR-LEG-VARIANT-PAINT-004: the ways of a compared section+// and the round hikes offered on the planner map, each in its colour, the one in focus on top+// (RTE-02, RTE-03).import { renderHook } from '@testing-library/react';import { afterEach, beforeEach, describe, expect, it } from 'vitest';import { drawOrder, useLegVariantLines, variantPaintCss } from './legVariantPaint';@@ -72,4 +73,18 @@ describe('legVariantPaint', () => {expect(result.current.colors).toBeNull();expect(result.current.overlays).toEqual([]);});++ it('FE-TOUR-LEG-VARIANT-PAINT-004: rounds offered from a tour without a route yet are drawn on their own (RTE-03)', () => {+ const rounds = [WAYS[1], WAYS[2]];+ const { result } = renderHook(() => useLegVariantLines(null, null, null, rounds, 'a'));+ expect(result.current.route).toEqual([WAYS[2].coordinates, WAYS[1].coordinates]);+ expect(result.current.walking).toBeNull();+ expect(result.current.colors).toEqual([+ { line: '#d946ef', casing: '#ffffff' },+ { line: '#f97316', casing: '#ffffff' },+ ]);+ expect(result.current.overlays).toHaveLength(2);+ const empty = renderHook(() => useLegVariantLines([], null, null, rounds, null));+ expect(empty.result.current.route).toEqual([WAYS[1].coordinates, WAYS[2].coordinates]);+ });});diff --git a/client/src/components/Tours/planner/legVariantPaint.ts b/client/src/components/Tours/planner/legVariantPaint.tsindex c238989ce..95b7e2911 100644--- a/client/src/components/Tours/planner/legVariantPaint.ts+++ b/client/src/components/Tours/planner/legVariantPaint.ts@@ -4,10 +4,11 @@ import { withRouteHighlight } from '../bike/routeHighlight';import type { LegVariant, LegVariantKey } from './legVariants';/**- * RTE-02: the colours of the ways offered for one section of a hike- * (styles/hike.css), by their key: the way taken now in the route's blue, the- * others in a hue each, over the white rim the route's highlights wear. The- * card takes the CSS variable, the map the resolved colour.+ * RTE-02, RTE-03: the colours of the ways offered for one section of a hike+ * and of the round hikes offered out of a stop (styles/hike.css), by their+ * key: the way taken now in the route's blue, the others in a hue each, over+ * the white rim the route's highlights wear. The card takes the CSS variable,+ * the map the resolved colour.*/const VARIANT_PAINT_TOKENS = {current: '--hike-variant-current',@@ -23,28 +24,40 @@ export function variantPaintCss(key: LegVariantKey): string {}type Drawn = Parameters<typeof withRouteHighlight>;+/** A way as the map draws it: its line and the key its colour goes by. */+type DrawnWay = Pick<LegVariant, 'key' | 'coordinates'>;/*** The ways in the order they are drawn: the one in focus (hovered or chosen)* last, so it lies on top of the others where they share a path.*/-export function drawOrder(variants: readonly LegVariant[], focus: LegVariantKey | null): LegVariant[] {+export function drawOrder<T extends DrawnWay>(variants: readonly T[], focus: LegVariantKey | null): T[] {return [...variants.filter((variant) => variant.key !== focus),...variants.filter((variant) => variant.key === focus),];}+/** Ways with no route to lie over: their lines alone, each in its colour over the rim. */+function waysAlone(ways: readonly DrawnWay[], paint: Readonly<Record<LegVariantKey | 'casing', string>>) {+ return {+ route: ways.map((way) => way.coordinates),+ walking: null,+ colors: ways.map((way) => ({ line: paint[way.key], casing: paint.casing })),+ };+}+/**- * The planner map's lines with the ways of the compared section laid over- * them, each in its colour; the lines as they came while nothing is compared.+ * The planner map's lines with the ways offered laid over them, each in its+ * colour; the lines as they came while nothing is offered. A round offered+ * from a tour of one point has no route to lie over and is drawn on its own.* `overlays` are the same ways for the 3D view, which draws its own line.*/export function useLegVariantLines(route: Drawn[1],walking: Drawn[2],colors: Drawn[3],- variants: readonly LegVariant[] | null,+ variants: readonly DrawnWay[] | null,focus: LegVariantKey | null) {const paint = useMapPaint(VARIANT_PAINT_TOKENS);@@ -58,8 +71,9 @@ export function useLegVariantLines(paints: ordered.map((variant) => variant.key),}: null;- const drawn = withRouteHighlight(highlight, route, walking, colors, { ...paint, way: paint.current });const overlays = ordered.map((variant) => ({ coordinates: variant.coordinates, color: paint[variant.key] }));+ if (highlight && !route?.length) return { ...waysAlone(ordered, paint), overlays };+ const drawn = withRouteHighlight(highlight, route, walking, colors, { ...paint, way: paint.current });return { ...drawn, overlays };}, [colors, focus, paint, route, variants, walking]);}diff --git a/client/src/components/Tours/planner/mapCardParts.tsx b/client/src/components/Tours/planner/mapCardParts.tsxnew file mode 100644index 000000000..c97a1fb21--- /dev/null+++ b/client/src/components/Tours/planner/mapCardParts.tsx@@ -0,0 +1,298 @@+import { Check, Clock, Loader2, MoveHorizontal, Route, TrendingDown, TrendingUp, X } from 'lucide-react';+import { useEffect, type ReactNode } from 'react';+import { useTranslation } from '../../../i18n';+import type { DistanceUnit } from '../../../types';+import { formatDistance, formatElevation } from '../../../utils/units';+import { MAP_CARD_GLASS } from '../../Map/mapControlShadow';+import { WhiteBadge } from '../../Planner/planParts';+import { fs } from '../../shared/DialogShell';+import { Tooltip } from '../../shared/Tooltip';+import { variantPaintCss } from './legVariantPaint';+import type { LegVariant } from './legVariants';+import { formatTourDuration } from './tourDurationInput';++/**+ * The parts the planner's own cards over the map share: the other ways of a+ * section (RTE-02) and the round hikes out of a stop (RTE-03). A frosted card+ * in the corner the other map cards use, its head, its two buttons, and a way+ * shown as a row: its mark in the colour it is drawn in, and its figures.+ */++type Translate = ReturnType<typeof useTranslation>['t'];++/**+ * A point of the tour as the waypoint list numbers it: a stop by its number,+ * a shaping point as the small dot it is on the map.+ */+export function StopDisc({ stop }: { stop: number | undefined }) {+ if (stop === undefined) {+ return (+ <span className="grid h-5 w-5 flex-none place-items-center" aria-hidden="true">+ <span className="h-2.5 w-2.5 rounded-full bg-content-faint ring-2 ring-surface-card" />+ </span>+ );+ }+ return (+ <span+ className="grid h-5 w-5 flex-none place-items-center rounded-full bg-edge font-geist font-semibold tabular-nums text-content"+ style={fs(10)}+ aria-hidden="true"+ >+ {stop}+ </span>+ );+}++/**+ * A way's mark, the colour it is drawn in on the map: the way taken now on+ * the route's own icon, the others by their letter. The chosen one carries a+ * tick at its corner.+ */+function VariantMark({ variant, chosen }: { variant: Pick<LegVariant, 'key' | 'current'>; chosen: boolean }) {+ return (+ <span+ className="relative grid h-7 w-7 flex-none place-items-center rounded-full font-geist font-bold uppercase shadow-sm"+ // The very colour this way is drawn in on the map: the one link between the row and the line.+ style={{ background: variantPaintCss(variant.key), color: 'var(--bike-highlight-casing)', ...fs(12) }}+ aria-hidden="true"+ >+ {variant.current ? <Route size={14} strokeWidth={2.4} /> : variant.key}+ {chosen && (+ <span className="absolute -bottom-1 -end-1 grid h-3.5 w-3.5 place-items-center rounded-full bg-accent text-accent-text ring-2 ring-surface-card">+ <Check size={9} strokeWidth={3.2} />+ </span>+ )}+ </span>+ );+}++/**+ * One way as a choice in a card's list, a radio: its mark in the colour it is+ * drawn in, its name with what goes beside it, and what is known of it below.+ * Pointing at it or focusing it lights its line up on the map.+ */+export function WayChoice({+ way,+ name,+ chosen,+ disabled = false,+ aside,+ onSelect,+ onHover,+ children,+}: {+ way: Pick<LegVariant, 'key' | 'current'>;+ name: string;+ chosen: boolean;+ disabled?: boolean;+ aside?: ReactNode;+ onSelect: () => void;+ onHover: (on: boolean) => void;+ children: ReactNode;+}) {+ return (+ <button+ type="button"+ role="radio"+ aria-checked={chosen}+ aria-label={name}+ aria-disabled={disabled}+ data-way={way.key}+ onClick={() => {+ if (!disabled) onSelect();+ }}+ onMouseEnter={() => onHover(true)}+ onMouseLeave={() => onHover(false)}+ onFocus={() => onHover(true)}+ onBlur={() => onHover(false)}+ className={`flex w-full items-start gap-2.5 rounded-xl border px-2.5 py-2 text-start transition-colors aria-disabled:cursor-default ${chosen ? 'border-accent bg-surface-card shadow-sm' : 'border-edge-faint bg-surface-secondary hover:border-edge hover:bg-surface-card'}`}+ >+ <VariantMark variant={way} chosen={chosen} />+ <span className="flex min-w-0 flex-1 flex-col gap-1">+ <span className="flex min-w-0 items-center gap-1.5">+ <span className="font-semibold text-content" style={fs(12, 'body')}>+ {name}+ </span>+ {aside}+ </span>+ {children}+ </span>+ </button>+ );+}++/** A height-bound figure: the value once the heights are in, a turning wheel while they are asked for, else unknown. */+function heightFigure(variant: LegVariant, value: number | null, format: (value: number) => string, t: Translate) {+ if (value !== null) return format(value);+ if (variant.heights === 'pending') {+ return <Loader2 size={10} className="animate-spin" aria-label={t('tours.variants.heightsPending')} />;+ }+ return t('tours.hike.ways.unknown');+}++/** What is known of one way, as the badges every tour card uses: length, climb, descent, walking time. */+export function VariantFigures({ variant, unit, t }: { variant: LegVariant; unit: DistanceUnit; t: Translate }) {+ const elevation = (meters: number) => formatElevation(meters, unit);+ const faint = 'flex-none text-content-faint';+ const heightsNote = variant.heights === 'unknown' ? t('tours.variants.heightsUnknown') : '';+ const badges: { key: string; label: string; icon: ReactNode; value: ReactNode }[] = [+ {+ key: 'distance',+ label: t('tours.detail.distance'),+ icon: <MoveHorizontal size={10} strokeWidth={2.2} className={faint} />,+ value: formatDistance(variant.distanceM / 1000, unit),+ },+ {+ key: 'ascent',+ label: heightsNote || t('tours.detail.ascent'),+ icon: <TrendingUp size={10} strokeWidth={2.2} className={faint} />,+ value: heightFigure(variant, variant.gainM, elevation, t),+ },+ {+ key: 'descent',+ label: heightsNote || t('tours.detail.descent'),+ icon: <TrendingDown size={10} strokeWidth={2.2} className={faint} />,+ value: heightFigure(variant, variant.lossM, elevation, t),+ },+ {+ key: 'time',+ label: heightsNote || t('tours.planner.walkingEstimatedInfo'),+ icon: <Clock size={10} strokeWidth={2.2} className={faint} />,+ value: heightFigure(variant, variant.minutes, formatTourDuration, t),+ },+ ];+ return (+ <span className="flex min-w-0 flex-wrap gap-1">+ {badges.map((badge) => (+ <Tooltip key={badge.key} label={badge.label}>+ <span className="inline-flex" data-figure={badge.key}>+ <WhiteBadge icon={badge.icon}>{badge.value}</WhiteBadge>+ </span>+ </Tooltip>+ ))}+ </span>+ );+}++/**+ * The frosted card itself: an icon and a title with a line under it, the+ * close button, and the body. As wide as it is given, or as a map card is.+ */+export function MapCard({+ icon,+ title,+ subtitle,+ onClose,+ width,+ testId,+ children,+}: {+ icon: ReactNode;+ title: string;+ subtitle?: ReactNode;+ onClose: () => void;+ width?: number;+ testId: string;+ children: ReactNode;+}) {+ const { t } = useTranslation();+ return (+ <article+ className={`flex max-h-[70vh] flex-col gap-2.5 overflow-y-auto overscroll-contain rounded-2xl p-3 text-content ${width ? '' : 'w-[min(22rem,calc(100vw_-_2rem))]'}`}+ style={{ ...MAP_CARD_GLASS, width }}+ aria-label={title}+ data-testid={testId}+ >+ <div className="flex items-start gap-2">+ <span className="grid h-7 w-7 flex-none place-items-center rounded-full bg-surface-secondary text-content-muted">+ {icon}+ </span>+ <div className="min-w-0 flex-1">+ <h3 className="truncate font-semibold" style={fs(14, 'body')}>+ {title}+ </h3>+ {subtitle}+ </div>+ <button+ type="button"+ onClick={onClose}+ aria-label={t('common.close')}+ className="flex-none rounded-lg p-1 text-content-muted hover:bg-surface-hover hover:text-content"+ >+ <X size={14} aria-hidden="true" />+ </button>+ </div>+ {children}+ </article>+ );+}++/** The card's foot: a quiet button that leaves or steps back, and the one that acts, turning while it works. */+export function MapCardActions({+ secondary,+ primary,+}: {+ secondary: { label: string; onClick: () => void };+ primary: { label: string; icon: ReactNode; onClick: () => void; disabled: boolean; busy?: boolean; testId: string };+}) {+ return (+ <div className="flex items-center justify-end gap-2 pt-0.5">+ <button+ type="button"+ onClick={secondary.onClick}+ className="inline-flex h-8 items-center rounded-[10px] px-3 font-semibold text-content-muted transition-colors hover:bg-surface-hover hover:text-content"+ style={fs(12, 'body')}+ >+ {secondary.label}+ </button>+ <button+ type="button"+ disabled={primary.disabled}+ onClick={primary.onClick}+ data-testid={primary.testId}+ 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')}+ >+ {primary.busy ? <Loader2 size={14} className="animate-spin" aria-hidden="true" /> : primary.icon}+ {primary.label}+ </button>+ </div>+ );+}++/**+ * Where the planner's own card sits: in the corner over the planner map that+ * a via ferrata's or a place's card takes. Unlike those it stays while the+ * map is panned and zoomed, since the map is what it is about; Escape and its+ * own buttons close it.+ */+export function MapCornerOverlay({+ onClose,+ insetEnd,+ bottom,+ testId,+ children,+}: {+ onClose: () => void;+ insetEnd: number;+ bottom: number;+ testId: string;+ children: ReactNode;+}) {+ useEffect(() => {+ const onKey = (event: KeyboardEvent) => {+ if (event.key === 'Escape' && !event.defaultPrevented) onClose();+ };+ document.addEventListener('keydown', onKey);+ return () => document.removeEventListener('keydown', onKey);+ }, [onClose]);+ return (+ <div+ className="absolute z-[20] flex justify-end transition-[bottom] duration-200 ease-out"+ style={{ insetInlineEnd: insetEnd, bottom, maxWidth: `calc(100% - ${insetEnd + 32}px)` }}+ data-testid={testId}+ >+ {children}+ </div>+ );+}diff --git a/client/src/components/Tours/planner/roundHikeGeometry.test.ts b/client/src/components/Tours/planner/roundHikeGeometry.test.tsnew file mode 100644index 000000000..9a488334b--- /dev/null+++ b/client/src/components/Tours/planner/roundHikeGeometry.test.ts@@ -0,0 +1,75 @@+// FE-TOUR-ROUND-GEOMETRY-001 to FE-TOUR-ROUND-GEOMETRY-005: where a round hike's loop is steered+// through, and how much of a line covers ground twice or the ground of another (RTE-03).+import { describe, expect, it } from 'vitest';+import { haversineKm } from '../../../utils/geo';+import { loopSpots, retracedShare, sharedShare, spotToward, STRAIGHT_PER_RADIUS_M } from './roundHikeGeometry';++const START = { lat: 47.5, lng: 11.1 };+const meters = (a: { lat: number; lng: number }, b: { lat: number; lng: number }) => haversineKm(a, b) * 1000;+const line = (...spots: { lat: number; lng: number }[]): [number, number][] => spots.map(({ lat, lng }) => [lat, lng]);++describe('spotToward', () => {+ it('FE-TOUR-ROUND-GEOMETRY-001: lies the asked distance away in the asked direction', () => {+ const north = spotToward(START, 0, 1000);+ expect(meters(START, north)).toBeCloseTo(1000, 0);+ expect(north.lat).toBeGreaterThan(START.lat);+ expect(north.lng).toBeCloseTo(START.lng, 9);+ const east = spotToward(START, 90, 2500);+ expect(meters(START, east)).toBeCloseTo(2500, 0);+ expect(east.lng).toBeGreaterThan(START.lng);+ // Across the date line the longitude comes back into range.+ expect(spotToward({ lat: 0, lng: 179.999 }, 90, 1000).lng).toBeLessThan(-179.99);+ });+});++describe('loopSpots', () => {+ it('FE-TOUR-ROUND-GEOMETRY-002: three corners of a square in a circle touching the start, its centre toward the bearing', () => {+ const radius = 1000;+ const spots = loopSpots(START, 90, radius);+ expect(spots).toHaveLength(3);+ const centre = spotToward(START, 90, radius);+ for (const spot of spots) expect(meters(centre, spot)).toBeCloseTo(radius, 0);+ // The far corner lies opposite the start, a diameter away.+ expect(meters(START, spots[1])).toBeCloseTo(2 * radius, 0);+ const corners = [START, ...spots, START];+ let straight = 0;+ for (let i = 1; i < corners.length; i += 1) straight += meters(corners[i - 1], corners[i]);+ expect(straight).toBeCloseTo(STRAIGHT_PER_RADIUS_M * radius, -1);+ });+});++describe('retracedShare', () => {+ it('FE-TOUR-ROUND-GEOMETRY-003: a loop covers little ground twice, a way there and back all of it', () => {+ const loop = line(START, ...loopSpots(START, 0, 800), START);+ expect(retracedShare(loop)).toBeLessThan(0.1);+ const far = spotToward(START, 45, 3000);+ expect(retracedShare(line(START, far, START))).toBeGreaterThan(0.9);+ // A loop with a long way in and out shares that way.+ const gate = spotToward(START, 0, 1500);+ const lollipop = line(START, gate, ...loopSpots(gate, 0, 300), gate, START);+ expect(retracedShare(lollipop)).toBeGreaterThan(0.4);+ });++ it('FE-TOUR-ROUND-GEOMETRY-004: a line too short to sample shares nothing', () => {+ expect(retracedShare([])).toBe(0);+ expect(retracedShare(line(START))).toBe(0);+ expect(retracedShare(line(START, START))).toBe(0);+ });+});++describe('sharedShare', () => {+ it('FE-TOUR-ROUND-GEOMETRY-005: the share of one line on the ground of another', () => {+ const loop = line(START, ...loopSpots(START, 0, 800), START);+ expect(sharedShare(loop, loop)).toBe(1);+ const other = line(START, ...loopSpots(START, 180, 800), START);+ expect(sharedShare(loop, other)).toBeLessThan(0.1);+ // Half of a line lies on the other: the share says so, one way round.+ const half = line(START, spotToward(START, 0, 1000));+ const whole = line(START, spotToward(START, 0, 2000));+ expect(sharedShare(half, whole)).toBe(1);+ expect(sharedShare(whole, half)).toBeCloseTo(0.5, 1);+ expect(sharedShare([], loop)).toBe(0);+ expect(sharedShare(loop, line(START))).toBe(0);+ expect(sharedShare(line(START, START), loop)).toBe(1);+ });+});diff --git a/client/src/components/Tours/planner/roundHikeGeometry.ts b/client/src/components/Tours/planner/roundHikeGeometry.tsnew file mode 100644index 000000000..88da72017--- /dev/null+++ b/client/src/components/Tours/planner/roundHikeGeometry.ts@@ -0,0 +1,139 @@+/**+ * RTE-03: the plain geometry a round hike is searched with. Where the loop is+ * steered through, and how much of a routed line covers the same ground twice+ * or the ground of another line. Nothing here asks a router.+ */++type Spot = { lat: number; lng: number };+type Line = readonly (readonly [number, number])[];++const EARTH_M = 6_371_000;+const toRad = (deg: number) => (deg * Math.PI) / 180;+const toDeg = (rad: number) => (rad * 180) / Math.PI;++/** The spot `meters` away from `from` toward `bearingDeg` (clockwise from north), on the sphere. */+export function spotToward(from: Spot, bearingDeg: number, meters: number): Spot {+ const angle = meters / EARTH_M;+ const bearing = toRad(bearingDeg);+ const lat1 = toRad(from.lat);+ const lng1 = toRad(from.lng);+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(angle) + Math.cos(lat1) * Math.sin(angle) * Math.cos(bearing));+ const lng2 =+ lng1 ++ Math.atan2(Math.sin(bearing) * Math.sin(angle) * Math.cos(lat1), Math.cos(angle) - Math.sin(lat1) * Math.sin(lat2));+ return { lat: toDeg(lat2), lng: ((toDeg(lng2) + 540) % 360) - 180 };+}++/** The loop's length in straight lines from corner to corner, per metre of its circle's radius: a square's. */+export const STRAIGHT_PER_RADIUS_M = 4 * Math.SQRT2;++/**+ * The three spots a loop out of `start` is steered through: the other corners+ * of a square in a circle of `radiusM` that touches the start, its centre+ * toward `bearingDeg`. Walked in order, the loop goes round the circle once+ * and comes back to the start from the other side.+ */+export function loopSpots(start: Spot, bearingDeg: number, radiusM: number): Spot[] {+ const centre = spotToward(start, bearingDeg, radiusM);+ // Seen from the centre the start lies the other way; the corners follow it a quarter turn apart.+ const towardStart = bearingDeg + 180;+ return [90, 180, 270].map((turn) => spotToward(centre, towardStart + turn, radiusM));+}++/** Samples are taken along a line this far apart. */+const SAMPLE_M = 20;+/** Two samples this close lie on the same ground: about the width of a path and the router's drawing of it. */+const SAME_GROUND_M = 25;+/**+ * Ground passed twice only counts when the two passes lie this far apart+ * along the line: the samples next to one another on a bend are one pass.+ */+const SECOND_PASS_M = 300;++interface Sample {+ x: number;+ y: number;+ along: number;+}++/** A flat projection in metres around one latitude, good for the few kilometres a hike spans. */+function projector(refLat: number) {+ const perDegLat = (Math.PI * EARTH_M) / 180;+ const perDegLng = perDegLat * Math.cos(toRad(refLat));+ return ([lat, lng]: readonly [number, number]) => ({ x: lng * perDegLng, y: lat * perDegLat });+}++/** The line as samples every few metres, each with how far along the line it lies. */+function samplesOf(line: Line, project: ReturnType<typeof projector>): Sample[] {+ const samples: Sample[] = [];+ let along = 0;+ let next = 0;+ for (let i = 1; i < line.length; i += 1) {+ const a = project(line[i - 1]);+ const b = project(line[i]);+ const length = Math.hypot(b.x - a.x, b.y - a.y);+ while (next <= along + length) {+ const share = length > 0 ? (next - along) / length : 0;+ samples.push({ x: a.x + (b.x - a.x) * share, y: a.y + (b.y - a.y) * share, along: next });+ next += SAMPLE_M;+ }+ along += length;+ }+ return samples;+}++const cellOf = (value: number) => Math.floor(value / SAME_GROUND_M);++/** The samples by the grid cell they lie in, so a neighbour is looked for among a few, not all. */+function gridOf(samples: readonly Sample[]): Map<string, Sample[]> {+ const grid = new Map<string, Sample[]>();+ for (const sample of samples) {+ const key = `${cellOf(sample.x)}:${cellOf(sample.y)}`;+ const cell = grid.get(key);+ if (cell) cell.push(sample);+ else grid.set(key, [sample]);+ }+ return grid;+}++/** Whether a sample of `grid` that `counts` lies on the same ground as `sample`. */+function hasNeighbour(grid: Map<string, Sample[]>, sample: Sample, counts: (other: Sample) => boolean): boolean {+ const cx = cellOf(sample.x);+ const cy = cellOf(sample.y);+ for (let dx = -1; dx <= 1; dx += 1) {+ for (let dy = -1; dy <= 1; dy += 1) {+ const near = grid.get(`${cx + dx}:${cy + dy}`)?.some(+ (other) => Math.hypot(other.x - sample.x, other.y - sample.y) <= SAME_GROUND_M && counts(other)+ );+ if (near) return true;+ }+ }+ return false;+}++/**+ * The share of a line that covers ground it passes a second time, from 0 to+ * 1. A loop with a short way in and out shares little; the same way there and+ * back shares all of it.+ */+export function retracedShare(line: Line): number {+ if (line.length < 2) return 0;+ const samples = samplesOf(line, projector(line[0][0]));+ if (samples.length < 2) return 0;+ const grid = gridOf(samples);+ const twice = samples.filter((sample) =>+ hasNeighbour(grid, sample, (other) => Math.abs(other.along - sample.along) > SECOND_PASS_M)+ ).length;+ return twice / samples.length;+}++/** The share of line `a` that lies on the ground of line `b`, from 0 to 1. */+export function sharedShare(a: Line, b: Line): number {+ if (a.length < 2 || b.length < 2) return 0;+ const project = projector(a[0][0]);+ const samples = samplesOf(a, project);+ if (samples.length === 0) return 0;+ const grid = gridOf(samplesOf(b, project));+ const shared = samples.filter((sample) => hasNeighbour(grid, sample, () => true)).length;+ return shared / samples.length;+}diff --git a/client/src/components/Tours/planner/roundHikeRouting.test.ts b/client/src/components/Tours/planner/roundHikeRouting.test.tsnew file mode 100644index 000000000..4289629be--- /dev/null+++ b/client/src/components/Tours/planner/roundHikeRouting.test.ts@@ -0,0 +1,152 @@+// FE-TOUR-ROUND-ROUTING-001 to FE-TOUR-ROUND-ROUTING-007: looking for round hikes of about a wished+// length with the router, leaving out what misses, walks its ground twice or repeats a round (RTE-03).+import { beforeEach, describe, expect, it, vi } from 'vitest';++const { valhallaRun, enrichTourElevations } = vi.hoisted(() => ({+ valhallaRun: vi.fn(),+ enrichTourElevations: vi.fn(),+}));++vi.mock('../../Map/valhallaRoute', () => ({ valhallaRun }));+vi.mock('./tourRouting', () => ({ enrichTourElevations }));++import { fitsWish, type RoundRequest } from './roundHikes';+import { spotToward } from './roundHikeGeometry';+import { findRoundHikes, MAX_ROUND_ASKS, type RoundSearchReport } from './roundHikeRouting';++type Spot = { lat: number; lng: number };++const START = { lat: 47.5, lng: 11.1 };+const REQUEST: RoundRequest = {+ startId: 'a',+ start: START,+ targetM: 10_000,+ costing: { max_hiking_difficulty: 3, use_hills: 0.2 },+ key: 'a#10000',+};++/** The router's answer for a chain drawn as the line through its points, each point met where it was asked. */+function runThrough(points: Spot[], snappedMeters = 0) {+ return {+ legs: [],+ total: {+ coordinates: points.map(({ lat, lng }): [number, number] => [lat, lng]),+ distance: 0,+ duration: 0,+ hasToll: false,+ hasHighway: false,+ hasFerry: false,+ },+ snapped: points.map(({ lat, lng }) => ({ asked: [lat, lng], at: [lat, lng], meters: snappedMeters })),+ };+}++async function search(signal = new AbortController().signal) {+ const reports: RoundSearchReport[] = [];+ await findRoundHikes(REQUEST, signal, (report) => reports.push(report));+ return reports;+}++beforeEach(() => {+ vi.clearAllMocks();+ enrichTourElevations.mockImplementation(async (line: [number, number][]) =>+ line.map(([lat, lng], index): [number, number, number] => [lat, lng, 1000 + (index % 2) * 50])+ );+});++describe('findRoundHikes', () => {+ it('FE-TOUR-ROUND-ROUTING-001: three different rounds back to the start within a fifth of the wish, asked on foot under the hike’s rules', async () => {+ // A router that walks straight between the points: the first loop comes out short and is asked again larger.+ valhallaRun.mockImplementation(async (points: Spot[]) => runThrough(points));+ const reports = await search();++ expect(valhallaRun).toHaveBeenCalledTimes(4);+ for (const [points, mode, avoid, , costing] of valhallaRun.mock.calls) {+ expect(points[0]).toEqual(START);+ expect(points[points.length - 1]).toEqual(START);+ expect(points).toHaveLength(5);+ expect([mode, avoid, costing]).toEqual(['walking', [], REQUEST.costing]);+ }+ const last = reports[reports.length - 1];+ expect(last.phase).toBe('done');+ expect(last.asked).toBe(4);+ expect(last.candidates.map((round) => round.key)).toEqual(['a', 'b', 'c']);+ for (const round of last.candidates) {+ expect(round.coordinates[0]).toEqual([START.lat, START.lng]);+ expect(round.coordinates[round.coordinates.length - 1]).toEqual([START.lat, START.lng]);+ expect(fitsWish(round.distanceM, REQUEST.targetM)).toBe(true);+ // The spots the loop was steered through, where the line met them: the round's shaping points.+ expect(round.via).toHaveLength(3);+ expect(round.heights).toBe('known');+ expect(round.gainM).toBeGreaterThan(0);+ expect(round.minutes).toBeGreaterThan(0);+ }+ // The rounds show up as they are found, then their heights one after the other.+ expect(reports.map((report) => report.phase)).toEqual([+ 'searching',+ 'searching',+ 'searching',+ 'done',+ 'done',+ 'done',+ 'done',+ ]);+ expect(reports[3].candidates.every((round) => round.heights === 'pending')).toBe(true);+ expect(enrichTourElevations).toHaveBeenCalledTimes(3);+ });++ it('FE-TOUR-ROUND-ROUTING-002: a router that never answers fails the search', async () => {+ valhallaRun.mockResolvedValue(null);+ const reports = await search();+ const last = reports[reports.length - 1];+ expect(last).toEqual({ phase: 'failed', candidates: [], asked: 6 });+ expect(enrichTourElevations).not.toHaveBeenCalled();+ });++ it('FE-TOUR-ROUND-ROUTING-003: a way there and back is no round, however well it fits the length', async () => {+ const far = spotToward(START, 0, 5_000);+ valhallaRun.mockResolvedValue(runThrough([START, far, START]));+ const reports = await search();+ expect(reports[reports.length - 1]).toMatchObject({ phase: 'done', candidates: [] });+ });++ it('FE-TOUR-ROUND-ROUTING-004: a loop whose spots lie too far from any path is not offered', async () => {+ valhallaRun.mockImplementation(async (points: Spot[]) => runThrough(points, 900));+ const reports = await search();+ expect(reports[reports.length - 1]).toMatchObject({ phase: 'done', candidates: [] });+ // One question per direction: a spot off the paths is not asked again at another size.+ expect(valhallaRun).toHaveBeenCalledTimes(6);+ });++ it('FE-TOUR-ROUND-ROUTING-005: the same round found again is offered once', async () => {+ const fixed = runThrough([START, ...[0, 90, 180].map((bearing) => spotToward(START, bearing, 2_400)), START]);+ valhallaRun.mockResolvedValue(fixed);+ const reports = await search();+ expect(reports[reports.length - 1].candidates).toHaveLength(1);+ });++ it('FE-TOUR-ROUND-ROUTING-006: a loop that misses the length twice in a row is let go, and the questions stay bounded', async () => {+ // Every loop comes back far too long, whatever its size.+ const huge = runThrough([START, spotToward(START, 0, 30_000), spotToward(START, 90, 30_000), START]);+ valhallaRun.mockResolvedValue(huge);+ const reports = await search();+ expect(valhallaRun).toHaveBeenCalledTimes(MAX_ROUND_ASKS);+ expect(reports[reports.length - 1]).toMatchObject({ phase: 'done', candidates: [], asked: MAX_ROUND_ASKS });+ });++ it('FE-TOUR-ROUND-ROUTING-007: nothing is reported once the search is called off, and rounds without heights keep their length', async () => {+ const controller = new AbortController();+ valhallaRun.mockImplementation(async (points: Spot[]) => {+ controller.abort();+ return runThrough(points);+ });+ expect(await search(controller.signal)).toEqual([]);++ valhallaRun.mockImplementation(async (points: Spot[]) => runThrough(points));+ enrichTourElevations.mockResolvedValue(null);+ const reports = await search();+ const round = reports[reports.length - 1].candidates[0];+ expect(round).toMatchObject({ heights: 'unknown', gainM: null, lossM: null, minutes: null });+ expect(round.distanceM).toBeGreaterThan(0);+ });+});diff --git a/client/src/components/Tours/planner/roundHikeRouting.ts b/client/src/components/Tours/planner/roundHikeRouting.tsnew file mode 100644index 000000000..f552f672d--- /dev/null+++ b/client/src/components/Tours/planner/roundHikeRouting.ts@@ -0,0 +1,171 @@+import { haversineKm } from '../../../utils/geo';+import { valhallaRun } from '../../Map/valhallaRoute';+import { figuresOf } from './legVariants';+import { loopSpots, retracedShare, sharedShare, STRAIGHT_PER_RADIUS_M } from './roundHikeGeometry';+import { fitsWish, ROUND_KEYS, type RoundCandidate, type RoundRequest } from './roundHikes';+import { enrichTourElevations } from './tourRouting';+import { MAX_TOUR_SNAP_M } from './tourRouteOutcome';++type Spot = { lat: number; lng: number };++/**+ * The directions a search sends its loops in, in turn: three a third of a+ * turn apart first, so the first rounds found lie on different sides of the+ * start, then the three between them.+ */+const BEARINGS = [0, 120, 240, 60, 180, 300] as const;+/**+ * The most questions one search puts to the router. The public instance+ * answers one a second, so a search ends within about a quarter of a minute,+ * with the heights of what it found.+ */+export const MAX_ROUND_ASKS = 12;+/** How much longer the paths are than the straight lines between the corners, until the router said. */+const FIRST_DETOUR = 1.3;+/** A loop walking more than this share of its ground twice is an out and back, not a round. */+const MAX_RETRACED_SHARE = 0.4;+/** Two rounds sharing more than this share of their ground are one round, walked a little apart. */+const MAX_SHARED_SHARE = 0.6;+/** A loop that missed the length is asked again once, its circle scaled within these bounds. */+const RESCALE = { min: 0.5, max: 2 } as const;++/** Where a search stands: still asking, done with what it found, or without one answer from the router. */+export interface RoundSearchReport {+ phase: 'searching' | 'done' | 'failed';+ candidates: RoundCandidate[];+ /** The questions put so far, of `MAX_ROUND_ASKS`. */+ asked: number;+}++/** A loop the router planned: its line, where it met the steering spots, and how far it is. */+interface Loop {+ coordinates: [number, number][];+ via: Spot[];+ distanceM: number;+ /** The same loop in straight lines from corner to corner. */+ straightM: number;+}++const clamp = (value: number, { min, max }: { min: number; max: number }) => Math.min(max, Math.max(min, value));++/** The circle a loop of `targetM` is steered round, for paths `detour` times longer than straight lines. */+const radiusFor = (targetM: number, detour: number) => targetM / (detour * STRAIGHT_PER_RADIUS_M);++function straightLength(spots: readonly Spot[]): number {+ let km = 0;+ for (let i = 1; i < spots.length; i += 1) km += haversineKm(spots[i - 1], spots[i]);+ return km * 1000;+}++/**+ * One loop out of the start and back, asked on foot under the hike's rules:+ * the same question the planner asks for a hike through these points, so the+ * round taken is the round shown. `undefined` when the router gave no answer,+ * null when a spot lies too far from any path to steer through.+ */+async function askLoop(request: RoundRequest, spots: Spot[], signal: AbortSignal): Promise<Loop | null | undefined> {+ const points = [request.start, ...spots, request.start];+ const run = await valhallaRun(points, 'walking', [], signal, request.costing);+ if (!run) return undefined;+ if (run.snapped.some((snap) => snap.meters > MAX_TOUR_SNAP_M)) return null;+ const coordinates = run.total.coordinates;+ return {+ coordinates,+ via: run.snapped.slice(1, -1).map(({ at }) => ({ lat: at[0], lng: at[1] })),+ distanceM: figuresOf(coordinates).distanceM,+ straightM: straightLength(points),+ };+}++/**+ * What a planned loop is worth: a round to offer, a loop to ask again larger+ * or smaller, or nothing (an out and back, or a round already found).+ */+function judge(loop: Loop, request: RoundRequest, found: readonly RoundCandidate[]): 'round' | 'rescale' | 'drop' {+ if (!fitsWish(loop.distanceM, request.targetM)) return 'rescale';+ if (retracedShare(loop.coordinates) > MAX_RETRACED_SHARE) return 'drop';+ const known = found.some(+ (round) =>+ Math.max(sharedShare(loop.coordinates, round.coordinates), sharedShare(round.coordinates, loop.coordinates)) >+ MAX_SHARED_SHARE+ );+ return known ? 'drop' : 'round';+}++function candidateOf(loop: Loop, index: number): RoundCandidate {+ return {+ key: ROUND_KEYS[index],+ current: false,+ coordinates: loop.coordinates,+ ...figuresOf(loop.coordinates),+ heights: 'pending',+ via: loop.via,+ };+}++/** What one search has learned so far, carried from one question to the next. */+interface SearchState {+ found: RoundCandidate[];+ asked: number;+ answered: number;+ detour: number;+}++/**+ * The loops in one direction: asked once at the size the detour so far+ * suggests, and once more scaled by how far the first missed the length.+ */+async function searchBearing(request: RoundRequest, bearing: number, state: SearchState, signal: AbortSignal) {+ let radius = radiusFor(request.targetM, state.detour);+ for (let attempt = 0; attempt < 2 && state.asked < MAX_ROUND_ASKS; attempt += 1) {+ const loop = await askLoop(request, loopSpots(request.start, bearing, radius), signal);+ state.asked += 1;+ if (signal.aborted || loop === undefined) return;+ state.answered += 1;+ if (!loop) return;+ // The paths here are this much longer than the straight lines: the next circle is drawn for them.+ if (loop.straightM > 0) state.detour = clamp(loop.distanceM / loop.straightM, { min: 1, max: 3 });+ const verdict = judge(loop, request, state.found);+ if (verdict === 'round') state.found.push(candidateOf(loop, state.found.length));+ if (verdict !== 'rescale') return;+ radius *= clamp(request.targetM / loop.distanceM, RESCALE);+ }+}++/**+ * RTE-03: up to three different round hikes out of the start, each within a+ * fifth of the wished length. The router plans loops steered round circles+ * in several directions; a loop that misses the length is asked once more at+ * a corrected size, one that walks its ground twice or repeats a round found+ * is left out. Then the heights of each round, one after the other. `report`+ * hears every step, so the rounds and their figures fill in as they come;+ * nothing is reported once `signal` aborts.+ */+export async function findRoundHikes(+ request: RoundRequest,+ signal: AbortSignal,+ report: (answer: RoundSearchReport) => void+): Promise<void> {+ const state: SearchState = { found: [], asked: 0, answered: 0, detour: FIRST_DETOUR };+ for (const bearing of BEARINGS) {+ if (state.found.length >= ROUND_KEYS.length || state.asked >= MAX_ROUND_ASKS) break;+ await searchBearing(request, bearing, state, signal);+ if (signal.aborted) return;+ report({ phase: 'searching', candidates: [...state.found], asked: state.asked });+ }+ if (state.answered === 0) {+ report({ phase: 'failed', candidates: [], asked: state.asked });+ return;+ }+ let candidates = [...state.found];+ report({ phase: 'done', candidates, asked: state.asked });+ for (const round of state.found) {+ const heights = await enrichTourElevations(round.coordinates, signal);+ if (signal.aborted) return;+ // A round without heights keeps its length; its climb, descent and time stay unknown.+ candidates = candidates.map((known) =>+ known.key === round.key ? { ...known, ...figuresOf(heights ?? known.coordinates) } : known+ );+ report({ phase: 'done', candidates, asked: state.asked });+ }+}diff --git a/client/src/components/Tours/planner/roundHikes.test.ts b/client/src/components/Tours/planner/roundHikes.test.tsnew file mode 100644index 000000000..5c7d38a9a--- /dev/null+++ b/client/src/components/Tours/planner/roundHikes.test.ts@@ -0,0 +1,119 @@+// FE-TOUR-ROUND-HIKES-001 to FE-TOUR-ROUND-HIKES-007: the model of round hikes out of a stop,+// when a round fits the wish, what a search asks and the plan a chosen round becomes (RTE-03).+import { isClosedLoop } from '@trek/shared';+import { describe, expect, it } from 'vitest';+import { haversineKm } from '../../../utils/geo';+import {+ canStartRound,+ deviationOf,+ distanceWindow,+ fitsWish,+ isRoundTarget,+ metersTyped,+ ROUND_MAX_M,+ ROUND_MIN_M,+ roundPlanOf,+ roundRequestOf,+ roundStarts,+ searchAreaOf,+ typedLength,+} from './roundHikes';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';++const A: TourPlannerWaypoint = { id: 'a', lat: 47.5, lng: 11.1, role: 'start', name: 'Hut', linkedPlaceId: 7 };+const S: TourPlannerWaypoint = { id: 's', lat: 47.51, lng: 11.11, role: 'via', shaping: true };+const B: TourPlannerWaypoint = { id: 'b', lat: 47.52, lng: 11.12, role: 'end' };+const BACK: TourPlannerWaypoint = { id: 'back', lat: 47.5, lng: 11.1, role: 'end' };+const COSTING = { max_hiking_difficulty: 2 };++describe('the wished length', () => {+ it('FE-TOUR-ROUND-HIKES-001: a round fits within a fifth either way, and its deviation is signed', () => {+ const { minM, maxM } = distanceWindow(10_000);+ expect(minM).toBeCloseTo(8_000);+ expect(maxM).toBeCloseTo(12_000);+ expect(fitsWish(8_001, 10_000)).toBe(true);+ expect(fitsWish(11_999, 10_000)).toBe(true);+ expect(fitsWish(7_999, 10_000)).toBe(false);+ expect(fitsWish(12_001, 10_000)).toBe(false);+ expect(deviationOf(10_800, 10_000)).toBeCloseTo(0.08);+ expect(deviationOf(9_500, 10_000)).toBeCloseTo(-0.05);+ });++ it('FE-TOUR-ROUND-HIKES-002: only a number in range can be asked for, typed in either unit', () => {+ expect(isRoundTarget(null)).toBe(false);+ expect(isRoundTarget(Number.NaN)).toBe(false);+ expect(isRoundTarget(ROUND_MIN_M - 1)).toBe(false);+ expect(isRoundTarget(ROUND_MIN_M)).toBe(true);+ expect(isRoundTarget(ROUND_MAX_M)).toBe(true);+ expect(isRoundTarget(ROUND_MAX_M + 1)).toBe(false);+ expect(metersTyped('12,5', 'metric')).toBe(12_500);+ expect(metersTyped(' 10 ', 'metric')).toBe(10_000);+ expect(metersTyped('', 'metric')).toBeNull();+ expect(metersTyped('ten', 'metric')).toBeNull();+ expect(metersTyped('5', 'imperial')).toBeCloseTo(8_046.7, 0);+ expect(typedLength(10_000, 'metric')).toBe('10');+ expect(typedLength(10_000, 'imperial')).toBe('6.2');+ });+});++describe('the start', () => {+ it('FE-TOUR-ROUND-HIKES-003: a round starts from a stop of a hike, never a shaping point or the way back of a loop', () => {+ expect(roundStarts([A, S, B]).map((point) => point.id)).toEqual(['a', 'b']);+ expect(roundStarts([A, S, B, BACK]).map((point) => point.id)).toEqual(['a', 'b']);+ expect(canStartRound([A, S, B], 'a', 'hike')).toBe(true);+ expect(canStartRound([A, S, B], 's', 'hike')).toBe(false);+ expect(canStartRound([A, S, B, BACK], 'back', 'hike')).toBe(false);+ expect(canStartRound([A, S, B], 'gone', 'hike')).toBe(false);+ expect(canStartRound([A, S, B], 'a', 'bike')).toBe(false);+ expect(canStartRound([A], 'a', 'hike')).toBe(true);+ });++ it('FE-TOUR-ROUND-HIKES-004: a search holds its start, length and rules in its key', () => {+ const request = roundRequestOf([A, B], 'a', 'hike', COSTING, 10_000);+ expect(request).toMatchObject({ startId: 'a', start: { lat: 47.5, lng: 11.1 }, targetM: 10_000, costing: COSTING });+ const moved = roundRequestOf([{ ...A, lat: 47.6 }, B], 'a', 'hike', COSTING, 10_000);+ const longer = roundRequestOf([A, B], 'a', 'hike', COSTING, 12_000);+ const harder = roundRequestOf([A, B], 'a', 'hike', { max_hiking_difficulty: 4 }, 10_000);+ expect(new Set([request?.key, moved?.key, longer?.key, harder?.key]).size).toBe(4);+ expect(roundRequestOf([A, B], 'a', 'hike', COSTING, 10_000)?.key).toBe(request?.key);+ expect(roundRequestOf([A, B], 'a', 'walk', COSTING, 10_000)).toBeNull();+ expect(roundRequestOf([A, B], 'a', 'hike', COSTING, 100)).toBeNull();+ });+});++describe('the plan a round becomes', () => {+ it('FE-TOUR-ROUND-HIKES-005: the start as it was, the steering spots as shaping points, and the way back onto the start', () => {+ let next = 0;+ const via = [+ { lat: 47.51, lng: 11.1 },+ { lat: 47.52, lng: 11.11 },+ { lat: 47.51, lng: 11.12 },+ ];+ const start = { ...A, fixedLeg: { kind: 'free' as const, geometry: [] }, role: 'via' as const };+ const plan = roundPlanOf(start, via, () => `n${(next += 1)}`);+ expect(plan.map((point) => point.id)).toEqual(['a', 'n1', 'n2', 'n3', 'n4']);+ expect(plan[0]).toMatchObject({ id: 'a', name: 'Hut', linkedPlaceId: 7, role: 'start' });+ expect(plan[0].fixedLeg).toBeUndefined();+ expect(plan.slice(1, 4).every((point) => point.shaping === true)).toBe(true);+ expect(plan.slice(1, 4).map(({ lat, lng }) => ({ lat, lng }))).toEqual(via);+ expect(plan[4]).toMatchObject({ lat: A.lat, lng: A.lng });+ // The way back is no station: it does not carry the start's name.+ expect(plan[4].name).toBeUndefined();+ expect(isClosedLoop(plan)).toBe(true);+ });++ it('FE-TOUR-ROUND-HIKES-006: a plan from a shaping or loose start drops what only steered or was the start’s own leg', () => {+ const plan = roundPlanOf({ ...S, carryNext: true, lock: null }, [{ lat: 47.6, lng: 11.2 }], () => 'x');+ expect(plan[0].shaping).toBeUndefined();+ expect(plan[0].carryNext).toBeUndefined();+ expect(plan[0].lock).toBeUndefined();+ });+});++describe('searchAreaOf', () => {+ it('FE-TOUR-ROUND-HIKES-007: frames how far the longest fitting round strays from its start', () => {+ const area = searchAreaOf(A, 10_000);+ expect(area).toHaveLength(4);+ for (const [lat, lng] of area) expect(haversineKm(A, { lat, lng })).toBeCloseTo(3.6, 1);+ });+});diff --git a/client/src/components/Tours/planner/roundHikes.ts b/client/src/components/Tours/planner/roundHikes.tsnew file mode 100644index 000000000..ed38d9d0e--- /dev/null+++ b/client/src/components/Tours/planner/roundHikes.ts@@ -0,0 +1,160 @@+import { isClosedLoop, type PlannableTourType } from '@trek/shared';+import type { DistanceUnit } from '../../../types';+import { convertDistance } from '../../../utils/units';+import type { CostingOptions } from '../../Map/valhallaRoute';+import { OTHER_WAY_KEYS, type LegVariant } from './legVariants';+import { spotToward } from './roundHikeGeometry';+import { closeLoop } from './tourRouteActions';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';++/**+ * RTE-03: round hikes of about a wished length out of a start point, as a+ * pure model: which points a round can start from, what one search asks, when+ * a round fits the wish, and the plan a chosen round becomes. Nothing here+ * asks a router or changes the tour.+ */++type Spot = { lat: number; lng: number };++/** How far a round may lie off the wished length and still be offered: a fifth either way. */+export const ROUND_TOLERANCE = 0.2;+/** The shortest round asked for, in metres: below it there is hardly a loop to walk. */+export const ROUND_MIN_M = 1_000;+/** The longest round asked for, in metres: a long day on foot, and as far as the router is asked to plan in one go. */+export const ROUND_MAX_M = 60_000;+/** The length a search starts with, in metres, until one was asked for. */+export const ROUND_DEFAULT_M = 10_000;++/** The rounds one search offers at most, lettered and coloured like the other ways of a section. */+export const ROUND_KEYS = OTHER_WAY_KEYS;+export type RoundKey = (typeof ROUND_KEYS)[number];++/** One round found: its line and figures as a way of the planner, and the spots its loop is steered through. */+export type RoundCandidate = LegVariant & {+ key: RoundKey;+ /** Where the line passes the spots it was steered through: the shaping points the round is planned by. */+ via: Spot[];+};++/** One search as it was asked: from which point, how far, and under which of the hike's rules. */+export interface RoundRequest {+ startId: string;+ start: Spot;+ targetM: number;+ costing: CostingOptions;+ /** What the search depends on; another key is another search. */+ key: string;+}++/** The shortest and longest round that fits a wish of `targetM`. */+export function distanceWindow(targetM: number): { minM: number; maxM: number } {+ return { minM: targetM * (1 - ROUND_TOLERANCE), maxM: targetM * (1 + ROUND_TOLERANCE) };+}++/** Whether a round of `distanceM` fits a wish of `targetM`. */+export function fitsWish(distanceM: number, targetM: number): boolean {+ const { minM, maxM } = distanceWindow(targetM);+ return distanceM >= minM && distanceM <= maxM;+}++/** How far a round lies off the wish, as a signed share: 0.08 is 8 % longer, -0.05 is 5 % shorter. */+export function deviationOf(distanceM: number, targetM: number): number {+ return (distanceM - targetM) / targetM;+}++/**+ * A length as typed in the traveller's unit, in metres; a comma reads as a+ * decimal point. Null while the text is no number.+ */+export function metersTyped(text: string, unit: DistanceUnit): number | null {+ const trimmed = text.trim();+ const value = Number(trimmed.replace(',', '.'));+ if (!trimmed || !Number.isFinite(value)) return null;+ return (value / convertDistance(1, unit)) * 1000;+}++/** A length in metres as the field shows it: in the traveller's unit, to one decimal. */+export function typedLength(meters: number, unit: DistanceUnit): string {+ return String(Math.round(convertDistance(meters / 1000, unit) * 10) / 10);+}++/** Whether a wished length can be asked for at all. */+export function isRoundTarget(targetM: number | null): targetM is number {+ return targetM !== null && Number.isFinite(targetM) && targetM >= ROUND_MIN_M && targetM <= ROUND_MAX_M;+}++/**+ * The points a round can start from: the stops of the tour. A shaping point+ * is no place to start from, and the way back of a loop is its start again.+ */+export function roundStarts(points: readonly TourPlannerWaypoint[]): TourPlannerWaypoint[] {+ const route = isClosedLoop(points) ? points.slice(0, -1) : points;+ return route.filter((point) => !point.shaping);+}++/** Whether a round can be searched from the point `id` of a tour of this type. */+export function canStartRound(+ points: readonly TourPlannerWaypoint[],+ id: string,+ tourType: PlannableTourType+): boolean {+ return tourType === 'hike' && roundStarts(points).some((point) => point.id === id);+}++const spot = (point: Spot) => `${point.lat.toFixed(7)},${point.lng.toFixed(7)}`;++/**+ * The search from the point `startId` as the tour stands now, or null when the+ * point cannot start one. Its key holds the start's spot, the length and the+ * rules, so a moved start or a changed limit makes rounds found before it+ * rounds of another search.+ */+export function roundRequestOf(+ points: readonly TourPlannerWaypoint[],+ startId: string,+ tourType: PlannableTourType,+ costing: CostingOptions,+ targetM: number+): RoundRequest | null {+ if (!canStartRound(points, startId, tourType) || !isRoundTarget(targetM)) return null;+ const start = points.find((point) => point.id === startId);+ if (!start) return null;+ return {+ startId,+ start: { lat: start.lat, lng: start.lng },+ targetM,+ costing,+ key: `${startId}@${spot(start)}#${Math.round(targetM)}#${JSON.stringify(costing)}`,+ };+}++/**+ * The plan a chosen round becomes: the start as it was (its name and its+ * place stay), the spots the loop is steered through as shaping points, and+ * the way back onto the start. Nothing else of the tour before it remains.+ */+export function roundPlanOf(+ start: TourPlannerWaypoint,+ via: readonly Spot[],+ newId: () => string+): TourPlannerWaypoint[] {+ const { fixedLeg: _leg, lock: _lock, carryNext: _carry, auto: _auto, shaping: _shaping, ...own } = start;+ const steering = via.map(+ ({ lat, lng }): TourPlannerWaypoint => ({ id: newId(), lat, lng, role: 'via', shaping: true })+ );+ return closeLoop([{ ...own, role: 'start' }, ...steering], newId());+}++/**+ * Where the rounds of a search can reach: a square around the start as wide+ * as a round of the longest fitting length strays from it at most. The map+ * frames it while the rounds are looked for, so each shows up in view.+ */+export function searchAreaOf(start: Spot, targetM: number): [number, number][] {+ // A loop strays from its start by half its length at the very most; a round of paths, by about a quarter.+ const reach = distanceWindow(targetM).maxM * 0.3;+ return [0, 90, 180, 270].map((bearing) => {+ const corner = spotToward(start, bearing, reach);+ return [corner.lat, corner.lng];+ });+}diff --git a/client/src/components/Tours/planner/useRoundHikes.test.tsx b/client/src/components/Tours/planner/useRoundHikes.test.tsxnew file mode 100644index 000000000..b041fb19d--- /dev/null+++ b/client/src/components/Tours/planner/useRoundHikes.test.tsx@@ -0,0 +1,243 @@+// FE-TOUR-USE-ROUND-HIKES-001 to FE-TOUR-USE-ROUND-HIKES-010: round hikes out of a stop, looked+// for under the hike's rules and put in place of the plan only on purpose (RTE-03).+import { act, renderHook, waitFor } from '@testing-library/react';+import { beforeEach, describe, expect, it, vi } from 'vitest';+import type { RoundSearchReport } from './roundHikeRouting';+import type { RoundCandidate } from './roundHikes';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';++const { findRoundHikes } = vi.hoisted(() => ({ findRoundHikes: vi.fn() }));++vi.mock('./roundHikeRouting', () => ({ findRoundHikes, MAX_ROUND_ASKS: 12 }));++import { useRoundHikes, type RoundHikesOptions } from './useRoundHikes';++const A: TourPlannerWaypoint = { id: 'a', lat: 47.5, lng: 11.1, role: 'start', name: 'Hut' };+const B: TourPlannerWaypoint = { id: 'b', lat: 47.52, lng: 11.12, role: 'end' };+const ROUND: RoundCandidate = {+ key: 'a',+ current: false,+ coordinates: [+ [47.5, 11.1],+ [47.51, 11.1],+ [47.5, 11.1],+ ],+ distanceM: 10_400,+ gainM: null,+ lossM: null,+ minutes: null,+ heights: 'pending',+ via: [+ { lat: 47.51, lng: 11.1 },+ { lat: 47.52, lng: 11.11 },+ { lat: 47.51, lng: 11.12 },+ ],+};++/** What a test answers for the search it starts: the reports, sent in order. */+let answers: RoundSearchReport[] = [];++function options(overrides: Partial<RoundHikesOptions> = {}): RoundHikesOptions {+ return {+ waypoints: [A],+ tourType: 'hike',+ maxHikingDifficulty: 2,+ hikingPreferences: null,+ replaceWaypoints: vi.fn(),+ undo: vi.fn(),+ mayEdit: () => true,+ ...overrides,+ };+}++function setup(initial: RoundHikesOptions = options()) {+ return renderHook((props: RoundHikesOptions) => useRoundHikes(props), { initialProps: initial });+}++/** Opens the card on `a`, looks for rounds of 10 km and lets the answers arrive. */+async function searched(view: ReturnType<typeof setup>) {+ act(() => view.result.current.open('a'));+ act(() => view.result.current.find(10_000));+ await waitFor(() => expect(view.result.current.view?.phase).not.toBe('searching'));+}++beforeEach(() => {+ vi.clearAllMocks();+ answers = [{ phase: 'done', candidates: [ROUND], asked: 3 }];+ findRoundHikes.mockImplementation(+ async (_request: unknown, _signal: AbortSignal, report: (answer: RoundSearchReport) => void) => {+ // The router answers later, never inside the render that asked.+ await Promise.resolve();+ for (const answer of answers) report(answer);+ }+ );+});++describe('useRoundHikes', () => {+ it('FE-TOUR-USE-ROUND-HIKES-001: opens on a stop of a hike, ready for the length; nothing else opens it', () => {+ const view = setup(options({ waypoints: [A, { ...B, id: 's', shaping: true }, B] }));+ expect(view.result.current.canStart('a')).toBe(true);+ expect(view.result.current.canStart('nope')).toBe(false);+ expect(view.result.current.canStart('s')).toBe(false);+ act(() => view.result.current.open('nope'));+ expect(view.result.current.view).toBeNull();+ act(() => view.result.current.open('a'));+ expect(view.result.current.view).toMatchObject({+ startId: 'a',+ targetM: 10_000,+ request: null,+ phase: 'setup',+ candidates: [],+ selected: null,+ confirming: false,+ notice: null,+ });+ expect(view.result.current.frame).toBeNull();+ view.rerender(options({ tourType: 'bike' }));+ expect(view.result.current.canStart('a')).toBe(false);+ });++ it('FE-TOUR-USE-ROUND-HIKES-002: looks for rounds under the hike’s limit and preferences, and frames where they can lie', async () => {+ answers = [{ phase: 'searching', candidates: [], asked: 2 }, ...answers];+ const view = setup(options({ maxHikingDifficulty: 4, hikingPreferences: { avoid_steps: true } }));+ act(() => view.result.current.open('a'));+ act(() => view.result.current.find(12_000));+ expect(view.result.current.view).toMatchObject({ phase: 'searching', asked: 0, targetM: 12_000 });+ expect(view.result.current.frame?.points).toHaveLength(4);+ await waitFor(() => expect(view.result.current.view?.phase).toBe('done'));+ const [request] = findRoundHikes.mock.calls[0];+ expect(request).toMatchObject({+ startId: 'a',+ start: { lat: 47.5, lng: 11.1 },+ targetM: 12_000,+ costing: { max_hiking_difficulty: 4, step_penalty: 600 },+ });+ expect(view.result.current.view?.candidates).toEqual([ROUND]);+ expect(view.result.current.view?.asked).toBe(3);+ });++ it('FE-TOUR-USE-ROUND-HIKES-003: a length out of range or no open card asks nothing', () => {+ const view = setup();+ act(() => view.result.current.find(10_000));+ act(() => view.result.current.open('a'));+ act(() => view.result.current.find(200));+ expect(findRoundHikes).not.toHaveBeenCalled();+ expect(view.result.current.view?.phase).toBe('setup');+ });++ it('FE-TOUR-USE-ROUND-HIKES-004: hovering and choosing light a round up; going back and closing change nothing', async () => {+ const replaceWaypoints = vi.fn();+ const view = setup(options({ replaceWaypoints }));+ await searched(view);+ act(() => view.result.current.hover('a'));+ expect(view.result.current.focus).toBe('a');+ act(() => view.result.current.hover(null));+ act(() => view.result.current.select('a'));+ expect(view.result.current.focus).toBe('a');+ expect(view.result.current.view?.selected).toBe('a');+ act(() => view.result.current.back());+ expect(view.result.current.view).toMatchObject({ phase: 'setup', candidates: [], selected: null });+ expect(view.result.current.frame).toBeNull();+ act(() => view.result.current.close());+ expect(view.result.current.view).toBeNull();+ expect(replaceWaypoints).not.toHaveBeenCalled();+ });++ it('FE-TOUR-USE-ROUND-HIKES-005: a tour of its start alone takes the chosen round at once, as one step with its undo note', async () => {+ const replaceWaypoints = vi.fn();+ const undo = vi.fn();+ const view = setup(options({ replaceWaypoints, undo }));+ await searched(view);+ act(() => view.result.current.select('a'));+ act(() => view.result.current.apply());+ expect(replaceWaypoints).toHaveBeenCalledTimes(1);+ const [plan] = replaceWaypoints.mock.calls[0] as [TourPlannerWaypoint[]];+ expect(plan[0]).toMatchObject({ id: 'a', name: 'Hut' });+ expect(plan.slice(1, 4).map(({ lat, lng, shaping }) => ({ lat, lng, shaping }))).toEqual(+ ROUND.via.map((spot) => ({ ...spot, shaping: true }))+ );+ expect(plan[4]).toMatchObject({ lat: A.lat, lng: A.lng });+ expect(view.result.current.view).toBeNull();+ // The planner writes the round; the note with its undo shows once the points changed.+ view.rerender(options({ replaceWaypoints, undo, waypoints: plan }));+ expect(view.result.current.appliedHint.shown).toBe(true);+ act(() => view.result.current.appliedHint.undo());+ expect(undo).toHaveBeenCalledTimes(1);+ });++ it('FE-TOUR-USE-ROUND-HIKES-006: a tour with more planned asks first, and only the yes replaces its points', async () => {+ const replaceWaypoints = vi.fn();+ const view = setup(options({ waypoints: [A, B], replaceWaypoints }));+ await searched(view);+ act(() => view.result.current.select('a'));+ act(() => view.result.current.apply());+ expect(view.result.current.view?.confirming).toBe(true);+ expect(replaceWaypoints).not.toHaveBeenCalled();+ act(() => view.result.current.cancelConfirm());+ expect(view.result.current.view?.confirming).toBe(false);+ act(() => view.result.current.apply());+ act(() => view.result.current.confirm());+ expect(replaceWaypoints).toHaveBeenCalledTimes(1);+ expect(view.result.current.view).toBeNull();+ });++ it('FE-TOUR-USE-ROUND-HIKES-007: nothing is taken before the search is done, without a choice, or without the right to edit', async () => {+ const replaceWaypoints = vi.fn();+ answers = [{ phase: 'searching', candidates: [ROUND], asked: 1 }];+ const view = setup(options({ replaceWaypoints }));+ act(() => view.result.current.open('a'));+ act(() => view.result.current.find(10_000));+ await waitFor(() => expect(view.result.current.view?.candidates).toHaveLength(1));+ expect(view.result.current.view?.phase).toBe('searching');+ act(() => view.result.current.select('a'));+ act(() => view.result.current.apply());+ expect(replaceWaypoints).not.toHaveBeenCalled();++ answers = [{ phase: 'done', candidates: [ROUND], asked: 3 }];+ const locked = setup(options({ replaceWaypoints, mayEdit: () => false }));+ await searched(locked);+ act(() => locked.result.current.apply());+ act(() => locked.result.current.select('a'));+ act(() => locked.result.current.apply());+ expect(replaceWaypoints).not.toHaveBeenCalled();+ act(() => locked.result.current.confirm());+ expect(locked.result.current.view?.confirming).toBe(false);+ expect(replaceWaypoints).not.toHaveBeenCalled();+ });++ it('FE-TOUR-USE-ROUND-HIKES-008: a moved start or another limit makes the rounds go, and the card says why', async () => {+ const view = setup();+ await searched(view);+ view.rerender(options({ waypoints: [{ ...A, lat: 47.6 }] }));+ expect(view.result.current.view).toMatchObject({ phase: 'setup', candidates: [], notice: 'stale' });++ act(() => view.result.current.find(10_000));+ await waitFor(() => expect(view.result.current.view?.phase).toBe('done'));+ expect(view.result.current.view?.notice).toBeNull();+ view.rerender(options({ waypoints: [{ ...A, lat: 47.6 }], maxHikingDifficulty: 5 }));+ expect(view.result.current.view?.notice).toBe('stale');+ });++ it('FE-TOUR-USE-ROUND-HIKES-009: a start that is gone closes the card; another start starts afresh', async () => {+ const view = setup(options({ waypoints: [A, B] }));+ await searched(view);+ act(() => view.result.current.open('b'));+ expect(view.result.current.view).toMatchObject({ startId: 'b', phase: 'setup', candidates: [] });+ view.rerender(options({ waypoints: [A] }));+ expect(view.result.current.view).toBeNull();+ });++ it('FE-TOUR-USE-ROUND-HIKES-010: a yes that comes after the start moved writes nothing and says so', async () => {+ const replaceWaypoints = vi.fn();+ const view = setup(options({ waypoints: [A, B], replaceWaypoints }));+ await searched(view);+ act(() => view.result.current.select('a'));+ act(() => view.result.current.apply());+ expect(view.result.current.view?.confirming).toBe(true);+ // The start moved while the question was open: the round was found for another spot.+ view.rerender(options({ waypoints: [{ ...A, lat: 47.7 }, B], replaceWaypoints }));+ expect(view.result.current.view).toMatchObject({ confirming: false, notice: 'stale', phase: 'setup' });+ act(() => view.result.current.confirm());+ expect(replaceWaypoints).not.toHaveBeenCalled();+ });+});diff --git a/client/src/components/Tours/planner/useRoundHikes.ts b/client/src/components/Tours/planner/useRoundHikes.tsnew file mode 100644index 000000000..3dcfbed9f--- /dev/null+++ b/client/src/components/Tours/planner/useRoundHikes.ts@@ -0,0 +1,258 @@+import type { HikingPreferences, PlannableTourType, TourMaxHikingDifficulty } from '@trek/shared';+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';+import { randomId } from '../../../utils/randomId';+import type { CostingOptions } from '../../Map/valhallaRoute';+import { hikingCosting } from './hikingCosting';+import { findRoundHikes, type RoundSearchReport } from './roundHikeRouting';+import {+ canStartRound,+ ROUND_DEFAULT_M,+ roundPlanOf,+ roundRequestOf,+ searchAreaOf,+ type RoundCandidate,+ type RoundKey,+ type RoundRequest,+} from './roundHikes';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';+import { useAppliedWayHint } from './useAppliedWayHint';++/** Why the card shows no rounds although some were found: the tour changed under them. */+type RoundNotice = 'stale';++/** One search asked: its token, so an answer for an older one is never shown. */+interface Search {+ token: number;+ request: RoundRequest;+}++/** What the open card shows: from where, how far, where the search stands and the choice. */+export interface RoundHikeView {+ startId: string;+ /** The length asked for last, in metres; the next search starts from it. */+ targetM: number;+ /** The search under way or done; null while the start and the length are being set. */+ request: RoundRequest | null;+ phase: 'setup' | RoundSearchReport['phase'];+ candidates: RoundCandidate[];+ /** The questions put to the router so far. */+ asked: number;+ selected: RoundKey | null;+ /** True while the replacement of the planned points waits for a yes. */+ confirming: boolean;+ notice: RoundNotice | null;+}++export interface RoundHikesOptions {+ waypoints: TourPlannerWaypoint[];+ tourType: PlannableTourType;+ maxHikingDifficulty: TourMaxHikingDifficulty;+ hikingPreferences: HikingPreferences | null;+ /** Puts the points of a chosen round in place of the tour's, as one step of the history. */+ replaceWaypoints: (points: TourPlannerWaypoint[]) => void;+ undo: () => void;+ /** Whether the route may change now: the permission held and no save under way. */+ mayEdit: () => boolean;+}++/** Whether the tour made a search another one: its start moved or went, or the hike's rules changed. */+function outgrown(+ request: RoundRequest,+ points: readonly TourPlannerWaypoint[],+ tourType: PlannableTourType,+ costing: CostingOptions+): boolean {+ return roundRequestOf(points, request.startId, tourType, costing, request.targetM)?.key !== request.key;+}++const NO_ROUNDS: RoundCandidate[] = [];++/** What the card shows, from the hook's state; null while it is closed. */+function viewOf(state: {+ startId: string | null;+ targetM: number;+ search: Search | null;+ found: RoundSearchReport | null;+ selected: RoundKey | null;+ confirming: boolean;+ notice: RoundNotice | null;+}): RoundHikeView | null {+ const { startId, search, found, selected } = state;+ if (startId === null) return null;+ const candidates = found?.candidates ?? NO_ROUNDS;+ return {+ startId,+ targetM: state.targetM,+ request: search?.request ?? null,+ phase: search ? (found?.phase ?? 'searching') : 'setup',+ candidates,+ asked: found?.asked ?? 0,+ selected: candidates.some((round) => round.key === selected) ? selected : null,+ confirming: state.confirming,+ notice: state.notice,+ };+}++/** Where the rounds of a search can lie, for the map to frame while they are looked for and shown. */+function frameOf(search: Search | null): { key: string; points: [number, number][] } | null {+ if (!search) return null;+ return { key: `round:${search.token}`, points: searchAreaOf(search.request.start, search.request.targetM) };+}++/** The plan the tour holds besides its start: a round taken would put something in its place. */+const plansMoreThan = (points: readonly TourPlannerWaypoint[], startId: string) =>+ points.some((point) => point.id !== startId);++/**+ * RTE-03: round hikes of about a wished length out of one of the tour's stops,+ * found by the router and taken on purpose. The card opens on a start; a+ * search asks under the hike's own limit and preferences. Once the tour makes+ * it another search (the start moved, the limit changed), the rounds go and+ * the card says why, so a round found for one start never lands on another.+ * Showing, choosing and closing change nothing; taking a round puts it in+ * place of the planned points as one step of the history, after a yes when+ * there were points to replace.+ */+export function useRoundHikes(options: RoundHikesOptions) {+ const { waypoints, tourType, maxHikingDifficulty, hikingPreferences } = options;+ const costing = useMemo(+ () => hikingCosting(maxHikingDifficulty, hikingPreferences),+ [hikingPreferences, maxHikingDifficulty]+ );+ const [startId, setStartId] = useState<string | null>(null);+ const [targetM, setTargetM] = useState(ROUND_DEFAULT_M);+ const [search, setSearch] = useState<Search | null>(null);+ const [answer, setAnswer] = useState<(RoundSearchReport & { token: number }) | null>(null);+ const [selected, setSelected] = useState<RoundKey | null>(null);+ const [hovered, setHovered] = useState<RoundKey | null>(null);+ const [confirming, setConfirming] = useState(false);+ const [notice, setNotice] = useState<RoundNotice | null>(null);+ const tokenRef = useRef(0);+ // The latest of what a round is written into, read when the yes comes.+ const latest = useRef(options);+ useLayoutEffect(() => {+ latest.current = options;+ });+ const { note: noteApplied, view: appliedHint } = useAppliedWayHint(waypoints, options.undo);++ const forgetSearch = useCallback(() => {+ setSearch(null);+ setSelected(null);+ setHovered(null);+ setConfirming(false);+ }, []);++ // Adjusted while rendering: a start that is gone closes the card, a search the tour outgrew goes.+ if (startId !== null && !canStartRound(waypoints, startId, tourType)) {+ setStartId(null);+ forgetSearch();+ } else if (search && outgrown(search.request, waypoints, tourType, costing)) {+ forgetSearch();+ setNotice('stale');+ }++ useEffect(() => {+ if (!search) return;+ const controller = new AbortController();+ void findRoundHikes(search.request, controller.signal, (found) => setAnswer({ ...found, token: search.token }));+ return () => controller.abort();+ }, [search]);++ const canStart = useCallback((id: string) => canStartRound(waypoints, id, tourType), [tourType, waypoints]);++ const open = useCallback(+ (id: string) => {+ if (!canStartRound(waypoints, id, tourType)) return;+ forgetSearch();+ setNotice(null);+ setStartId(id);+ },+ [forgetSearch, tourType, waypoints]+ );++ const close = useCallback(() => {+ forgetSearch();+ setNotice(null);+ setStartId(null);+ }, [forgetSearch]);++ /** Back to the start and the length, the rounds found let go. */+ const back = useCallback(() => {+ forgetSearch();+ setNotice(null);+ }, [forgetSearch]);++ const find = useCallback(+ (wishM: number) => {+ const request = startId ? roundRequestOf(waypoints, startId, tourType, costing, wishM) : null;+ if (!request) return;+ tokenRef.current += 1;+ setTargetM(wishM);+ setSelected(null);+ setHovered(null);+ setConfirming(false);+ setNotice(null);+ setSearch({ token: tokenRef.current, request });+ },+ [costing, startId, tourType, waypoints]+ );++ const found = search && answer?.token === search.token ? answer : null;++ const view = useMemo(+ () => viewOf({ startId, targetM, search, found, selected, confirming, notice }),+ [confirming, found, notice, search, selected, startId, targetM]+ );+ const candidates = view?.candidates ?? NO_ROUNDS;++ /**+ * Writes the chosen round in place of the plan. A start the tour moved or+ * removed meanwhile took the rounds with it already (see above), so the+ * round is always laid onto the start it was found from.+ */+ const write = useCallback(() => {+ const chosen = view?.candidates.find((round) => round.key === view.selected);+ const now = latest.current;+ const start = view?.request ? now.waypoints.find((point) => point.id === view.request?.startId) : undefined;+ setConfirming(false);+ if (!chosen || !start) return;+ noteApplied(now.waypoints);+ now.replaceWaypoints(roundPlanOf(start, chosen.via, randomId));+ close();+ }, [close, noteApplied, view]);++ const apply = useCallback(() => {+ if (!view || view.phase !== 'done' || !view.selected || !latest.current.mayEdit()) return;+ // A tour with more than its start asks first: its points give way to the round.+ if (plansMoreThan(latest.current.waypoints, view.startId)) setConfirming(true);+ else write();+ }, [view, write]);++ const confirm = useCallback(() => {+ if (latest.current.mayEdit()) write();+ else setConfirming(false);+ }, [write]);++ const cancelConfirm = useCallback(() => setConfirming(false), []);++ // The map frames where the rounds can lie while they are looked for and shown.+ const frame = useMemo(() => frameOf(search), [search]);+ const focus = hovered && candidates.some((round) => round.key === hovered) ? hovered : (view?.selected ?? null);++ return {+ view,+ focus,+ frame,+ canStart,+ open,+ find,+ back,+ select: setSelected,+ hover: setHovered,+ apply,+ confirm,+ cancelConfirm,+ close,+ appliedHint,+ };+}diff --git a/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsx b/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsxindex b1485434e..42c6bf5d0 100644--- a/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsx+++ b/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsx@@ -11,6 +11,7 @@ const {updateTour,paddlePlan,paddleForget,+ findRoundHikes,} = vi.hoisted(() => ({routeWalkingTour: vi.fn(),routeCityWalk: vi.fn(),@@ -20,10 +21,12 @@ const {updateTour: vi.fn(),paddlePlan: vi.fn(),paddleForget: vi.fn(),+ findRoundHikes: vi.fn(),}));vi.mock('./tourRouting', () => ({ routeWalkingTour, routeCityWalk, enrichTourElevations }));vi.mock('../../../repo/tourRepo', () => ({ tourRepo: { create: createTour, detail: detailTour, update: updateTour } }));+vi.mock('./roundHikeRouting', () => ({ findRoundHikes, MAX_ROUND_ASKS: 12 }));vi.mock('../../../repo/paddleRouteRepo', () => ({ paddleRouteRepo: { plan: paddlePlan, forget: paddleForget } }));vi.mock('../useTourPermissions', () => ({useTourPermissions: ({ canEdit = true, canAssign = true }: { canEdit?: boolean; canAssign?: boolean }) => ({@@ -569,6 +572,60 @@ describe('useTourPlanner route tools', () => {});});+ describe('round hikes (RTE-03)', () => {+ it('puts a round taken in place of the plan as one step after a yes, which one undo takes back', async () => {+ const via = [+ { lat: 48.01, lng: 11 },+ { lat: 48.02, lng: 11.01 },+ { lat: 48.01, lng: 11.02 },+ ];+ const round = {+ key: 'a',+ current: false,+ coordinates: [[48, 11], ...via.map(({ lat, lng }) => [lat, lng]), [48, 11]],+ distanceM: 9_800,+ gainM: 300,+ lossM: 300,+ minutes: 170,+ heights: 'known',+ via,+ };+ findRoundHikes.mockImplementation(+ async (_request: unknown, _signal: AbortSignal, report: (answer: unknown) => void) => {+ await Promise.resolve();+ report({ phase: 'done', candidates: [round], asked: 3 });+ }+ );+ const { result } = plannerWith([+ [48, 11],+ [48.03, 11.03],+ ]);+ const before = coordinatesOf(result.current.waypoints);+ const start = must(result.current.waypoints[0]);+ act(() => result.current.roundHikes.open(start.id));+ act(() => result.current.roundHikes.find(10_000));+ await act(async () => {+ await Promise.resolve();+ });+ expect(result.current.roundHikes.view?.phase).toBe('done');+ act(() => result.current.roundHikes.select('a'));+ act(() => result.current.roundHikes.apply());+ // The tour held more than its start: nothing changes before the yes.+ expect(coordinatesOf(result.current.waypoints)).toEqual(before);+ act(() => result.current.roundHikes.confirm());++ expect(result.current.isLoop).toBe(true);+ expect(must(result.current.waypoints[0]).id).toBe(start.id);+ expect(result.current.waypoints.map((point) => !!point.shaping)).toEqual([false, true, true, true, false]);+ expect(coordinatesOf(result.current.waypoints)).toEqual([[48, 11], ...coordinatesOf(via), [48, 11]]);+ expect(result.current.waypoints.map((point) => point.role)).toEqual(['start', 'via', 'via', 'via', 'end']);+ expect(result.current.roundHikes.appliedHint.shown).toBe(true);++ act(() => result.current.undo());+ expect(coordinatesOf(result.current.waypoints)).toEqual(before);+ });+ });+describe("a city walk's keys and stops (CW-02, CW-03)", () => {/** The server's answer to a save: the points in their order, a key sent kept, one missing made up. */const answered = (body: TourCreateRequest, revision: number): TourCreateResponse => ({diff --git a/client/src/components/Tours/planner/useTourPlanner.ts b/client/src/components/Tours/planner/useTourPlanner.tsindex e71fca4a0..18acac35c 100644--- a/client/src/components/Tours/planner/useTourPlanner.ts+++ b/client/src/components/Tours/planner/useTourPlanner.ts@@ -15,6 +15,7 @@ import { useTourDraftStorage } from './useTourDraftStorage'import { useTourRevisionGuard } from './useTourRevisionGuard'import { useRouteShaping } from './useRouteShaping'import { useLegVariants } from './useLegVariants'+import { useRoundHikes } from './useRoundHikes'import { useTourMapView } from './useTourMapView'import type { DraftPayload, DraftSource } from './tourPlannerDraft'import { paddleEstimateOf } from './paddlePlanOf'@@ -805,6 +806,10 @@ export function useTourPlanner({ tripId, active = true, onSaved, canEdit: editPewaypoints, route, enrichedGeometry, routeCurrent, tourType, maxHikingDifficulty, hikingPreferences, undo, mayEdit: mayEditRoute,insertShapingPoints: shaping.insertShapingPoints,})+ // RTE-03: round hikes of about a wished length out of a stop, put in place of the plan on purpose.+ const roundHikes = useRoundHikes({+ waypoints, tourType, maxHikingDifficulty, hikingPreferences, replaceWaypoints: commitWaypoints, undo, mayEdit: mayEditRoute,+ })const readOnlyGpxAnalysis = useMemo(() => analyzeRouteGeometry(readOnlyGpxTour?.routeGeometry),@@ -936,7 +941,7 @@ export function useTourPlanner({ tripId, active = true, onSaved, canEdit: editPewaypoints, selectedWaypointId, setSelectedWaypointId,addWaypoint, appendFixedLeg, setWaypointPosition, removeWaypoint, moveWaypoint, reorderWaypoint, editWaypoints: commitWaypoints,reverse, returnToStart, isLoop: isClosedLoop(waypoints), toggleWaypointFreeLeg, editPaddlePoints, amendWaypoints, paddleEstimate,- ...shaping, legVariants, paddleRoute, routeCurrent,+ ...shaping, legVariants, roundHikes, paddleRoute, routeCurrent,undo, redo, canUndo: history.canUndo, canRedo: history.canRedo,status, error, retry, isSaving,route, routeParts, enrichedGeometry, routeAnalysis, distanceMeters, durationSeconds, unreachable,diff --git a/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx b/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsxindex ce8bbd8df..7db4a25b8 100644--- a/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx+++ b/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx@@ -2,7 +2,7 @@import type { Ferrata, PaddleFeature } from '@trek/shared';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { act, fireEvent, render, screen, waitFor } from '../../../tests/helpers/render';-import { idleLegVariants } from '../../../tests/helpers/tourPlannerStub';+import { idleLegVariants, idleRoundHikes } from '../../../tests/helpers/tourPlannerStub';import { useTripFerratas } from '../../components/Ferratas/useTripFerratas';import type { MapViewProps } from '../../components/Map/mapViewContract';import { useTourMapView } from '../../components/Tours/planner/useTourMapView';@@ -137,6 +137,7 @@ function planner(routeProfileFocus: null,setRouteProfileFocus: vi.fn(),legVariants: idleLegVariants(),+ roundHikes: idleRoundHikes(),...overrides,} as unknown as Planner;}@@ -661,6 +662,85 @@ describe('TourPlannerMapStage', () => {});});+ describe('round hikes (RTE-03)', () => {+ const waypoints = [+ { id: 'w1', lat: 46, lng: 7 },+ { id: 'w2', lat: 46.2, lng: 7.2 },+ ];+ const route = [+ [46, 7],+ [46.2, 7.2],+ ];+ const roundView = {+ startId: 'w1',+ targetM: 10_000,+ request: null,+ phase: 'setup',+ candidates: [],+ asked: 0,+ selected: null,+ confirming: false,+ notice: null,+ };++ it('FE-PAGE-TOURSTAGE-023: while round hikes are offered their card is up, and a click on the route sets no shaping point', () => {+ renderStage(planner('new-draft', { waypoints, route, canEdit: true }));+ expect(stage.flatMap.props?.onRouteClick).toBeDefined();+ expect(screen.queryByTestId('round-hike-card')).not.toBeInTheDocument();++ const roundHikes = { ...idleRoundHikes(), view: roundView };+ renderStage(planner('new-draft', { waypoints, route, canEdit: true, maxHikingDifficulty: 2, roundHikes }));+ expect(stage.flatMap.props?.onRouteClick).toBeUndefined();+ expect(screen.getByTestId('round-hike-card')).toBeInTheDocument();+ });++ it('FE-PAGE-TOURSTAGE-024: "round taken" shows with its undo, which takes the round back', () => {+ const appliedHint = { shown: true, key: 1, undo: vi.fn(), hold: vi.fn() };+ renderStage(planner('new-draft', { roundHikes: { ...idleRoundHikes(), appliedHint } }));+ expect(screen.getByTestId('map-undo-hint')).toHaveTextContent('tours.round.applied');+ fireEvent.click(screen.getByRole('button', { name: 'undo.button' }));+ expect(appliedHint.undo).toHaveBeenCalledTimes(1);+ });++ it('FE-PAGE-TOURSTAGE-025: round hikes opened over a comparison close it, so one card stands in the corner', () => {+ const legVariants = {+ ...idleLegVariants(),+ comparison: {+ leg: {+ fromId: 'w1',+ toId: 'w2',+ from: { lat: 46, lng: 7 },+ to: { lat: 46.2, lng: 7.2 },+ costing: {},+ key: 'k',+ },+ phase: 'loading',+ variants: [],+ selected: null,+ proving: false,+ notice: null,+ },+ };+ const roundHikes = idleRoundHikes();+ const view = renderStage(planner('new-draft', { waypoints, canEdit: true, legVariants, roundHikes }));+ view.rerender(+ <TourPlannerMapStage+ {...stageProps(+ planner('new-draft', {+ waypoints,+ canEdit: true,+ maxHikingDifficulty: 2,+ legVariants,+ roundHikes: { ...roundHikes, view: roundView },+ })+ )}+ />+ );+ expect(legVariants.close).toHaveBeenCalledTimes(1);+ expect(roundHikes.close).not.toHaveBeenCalled();+ });+ });+describe('map layers per tour type (P2B-06/07, PAD-04, PAD-10)', () => {const flat = () => stage.flatMap.props as MapViewProps;diff --git a/client/src/pages/tripPlanner/TourPlannerMapStage.tsx b/client/src/pages/tripPlanner/TourPlannerMapStage.tsxindex 7a957fdbb..138c767af 100644--- a/client/src/pages/tripPlanner/TourPlannerMapStage.tsx+++ b/client/src/pages/tripPlanner/TourPlannerMapStage.tsx@@ -13,6 +13,7 @@ import { ChecklistObstaclePanel } from '../../components/Tours/paddle/ObstacleDeimport PaddleObstacleOverlay from '../../components/Tours/paddle/PaddleObstacleOverlay';import { PaddleObstaclePlaceButton } from '../../components/Tours/paddle/PaddleObstaclePlaceButton';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 { useTourPoiMarkers } from '../../components/Tours/poi/useTourPoiMarkers';@@ -168,23 +169,36 @@ 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();- // RTE-02: while other ways of a section are compared, a click on the line sets nothing on it.+ // 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;- // The comparison's card shares the corner with the others: the one opened last stays.+ const offeringRounds = tourPlanner.roundHikes.view !== null;+ // The planner's own cards share the corner with the others: the one opened last stays.useOneCornerCard({- comparing,- closeComparison: tourPlanner.legVariants.close,+ planned: [+ { open: comparing, close: tourPlanner.legVariants.close },+ { open: offeringRounds, close: tourPlanner.roundHikes.close },+ ],ferrataOpen: !!ferrataSelected,closeFerrata: ferrata.close,});- const shapeAt = useShapingClick(tourPlanner, { editable: !!waypoints.onMove, picking: pickOnLine || comparing });+ const shapeAt = useShapingClick(tourPlanner, {+ editable: !!waypoints.onMove,+ picking: pickOnLine || comparing || offeringRounds,+ });// What each panel covers of the map, a collapsed one its rail.const leftInset = leftHidden ? 56 : leftPanelPx;const rightInset = rightHidden ? 56 : rightPanelPx;// The cards over the map keep clear of the layer switcher, on the side the text ends.const cardInsetEnd = (isRtlLanguage(language) ? leftInset : rightInset) + MAP_LAYER_SWITCHER_INSET;const bottomRowTop = terrain3d ? CONTROL_GAP + terrainControlsPx + CONTROL_GAP : FERRATA_CARD_BOTTOM;- const mapHint = undoHintOf(placedHint, tourPlanner.legVariants.appliedHint, t);+ const mapHint = undoHintOf(+ placedHint,+ [+ { ...tourPlanner.legVariants.appliedHint, message: t('tours.variants.applied') },+ { ...tourPlanner.roundHikes.appliedHint, message: t('tours.round.applied') },+ ],+ t+ );return (<>{/* Around either map, to follow its presses and show the crosshair while placing. */}@@ -296,7 +310,13 @@ export function TourPlannerMapStage({insetEnd={cardInsetEnd}{...ferrataCardPlacement(terrain3d, bottomRowTop, terrainLegend)}/>- {/* "Point set" or "Way taken", with the way back, above the bottom row and between the panels. */}+ {/* RTE-03: the round hikes out of a stop, in the same corner. */}+ <RoundHikeOverlay+ planner={tourPlanner}+ insetEnd={cardInsetEnd}+ {...ferrataCardPlacement(terrain3d, bottomRowTop, terrainLegend)}+ />+ {/* "Point set", "Way taken" or "Round taken", with the way back, above the bottom row and between the panels. */}{mapHint && (<divclassName="pointer-events-none absolute inset-x-0 z-[19] flex justify-center"@@ -371,21 +391,20 @@ function paddlePlaceFromCard(};}-type HintState = { key: number | null; undo: () => void; hold: (held: boolean) => void };+type HintState = { key: number | null; undo: () => void; hold: (held: boolean) => void; message: string };/**- * The note at the foot of the map with its undo: the point just set, or the- * way just taken for a section (RTE-02). At most one is up, since each goes as- * soon as anything else changes the points.+ * The note at the foot of the map with its undo: the point just set, the way+ * just taken for a section (RTE-02) or the round just taken (RTE-03). At most+ * one is up, since each goes as soon as anything else changes the points.*/function undoHintOf(placed: { shown: boolean; key: number | null; undoPlacement: () => void; hold: (held: boolean) => void },- applied: HintState & { shown: boolean },+ applied: readonly (HintState & { shown: boolean })[],t: Planner['t']-): (HintState & { message: string }) | null {+): HintState | null {if (placed.shown) {return { key: placed.key, undo: placed.undoPlacement, hold: placed.hold, message: t('tours.planner.pointPlaced') };}- if (applied.shown) return { ...applied, message: t('tours.variants.applied') };- return null;+ return applied.find((hint) => hint.shown) ?? null;}diff --git a/client/src/pages/tripPlanner/useOneCornerCard.ts b/client/src/pages/tripPlanner/useOneCornerCard.tsindex 4a94505ed..f96585bf3 100644--- a/client/src/pages/tripPlanner/useOneCornerCard.ts+++ b/client/src/pages/tripPlanner/useOneCornerCard.ts@@ -3,23 +3,28 @@ import { useSelectedPoi } from '../../components/Tours/poi/useTourPoiSearch';import { selectPaddleObstacle, usePaddleObstacleStore } from '../../store/paddleObstacleStore';import { useTourPoiStore } from '../../store/tourPoiStore';+/** One of the planner's own cards: whether it is up, and how it is closed. */+interface StickyCard {+ open: boolean;+ close: () => void;+}+/*** The corner over the planner map holds one card at a time. A via ferrata's,* a paddle object's and a place's card close on any press outside them, so* the press that opens the next one has closed the last already. The- * comparison of a section's ways (RTE-02) stays up through presses on the map,- * so it is kept apart here: whichever of it and the others opened last stays,- * and the other closes. Laid out before paint, so two cards never show- * stacked in the corner, not even for a frame.+ * planner's own cards (the ways of a section compared, RTE-02, and the round+ * hikes out of a stop, RTE-03) stay up through presses on the map, so they+ * are kept apart here: whichever card opened last stays, and every other one+ * closes. Laid out before paint, so two cards never show stacked in the+ * corner, not even for a frame.*/export function useOneCornerCard({- comparing,- closeComparison,+ planned,ferrataOpen,closeFerrata,}: {- comparing: boolean;- closeComparison: () => void;+ planned: readonly StickyCard[];ferrataOpen: boolean;closeFerrata: () => void;}): void {@@ -27,19 +32,34 @@ export function useOneCornerCard({const poiOpen = useSelectedPoi() !== null;const selectPoi = useTourPoiStore((state) => state.select);const otherOpen = ferrataOpen || paddleOpen || poiOpen;- const was = useRef({ comparing, otherOpen });+ const cards: StickyCard[] = [+ ...planned,+ {+ open: otherOpen,+ close: () => {+ closeFerrata();+ selectPaddleObstacle(null);+ selectPoi(null);+ },+ },+ ];+ // The cards as this render has them, read by the layout pass that follows.+ const latest = useRef(cards);+ useLayoutEffect(() => {+ latest.current = cards;+ });+ const was = useRef(cards.map((card) => card.open));+ const openKey = cards.map((card) => card.open).join();+ // Runs when what is open changes: the cards that just opened take the corner, those up already make way.useLayoutEffect(() => {+ const now = latest.current;const before = was.current;- was.current = { comparing, otherOpen };- if (!comparing || !otherOpen) return;- // A card picked on the map while comparing takes the corner; a comparison opened over a card does.- if (!before.otherOpen) {- closeComparison();- return;- }- closeFerrata();- selectPaddleObstacle(null);- selectPoi(null);- }, [closeComparison, closeFerrata, comparing, otherOpen, selectPoi]);+ was.current = now.map((card) => card.open);+ if (now.filter((card) => card.open).length < 2) return;+ if (!now.some((card, index) => card.open && !before[index])) return;+ now.forEach((card, index) => {+ if (card.open && before[index]) card.close();+ });+ }, [openKey]);}diff --git a/client/src/pages/tripPlanner/useTripPlannerPage.ts b/client/src/pages/tripPlanner/useTripPlannerPage.tsindex 6155bd281..87020447d 100644--- a/client/src/pages/tripPlanner/useTripPlannerPage.ts+++ b/client/src/pages/tripPlanner/useTripPlannerPage.ts@@ -81,10 +81,14 @@ export function useTripPlannerPage() {// the one being edited or an import being viewed, never over a preview beside it.const ownLine = editingRoute || (tourPlanner.mode.type === 'view-gpx' && !tourConversion.line)const highlighted = useHighlightedRoute(ownLine && !wandererBrowser.open, route, routeWalking, partStyle.colors)- // RTE-02: the ways of a section being compared, over the route being edited.+ // RTE-02, RTE-03: the ways of a section being compared, or the round hikes offered, over the route being edited.const { comparison, focus: variantFocus } = tourPlanner.legVariants- const compared = editingRoute && !wandererBrowser.open ? comparison?.variants ?? null : null- const drawn = useLegVariantLines(highlighted.route, highlighted.walking, highlighted.colors, compared, variantFocus)+ const { view: rounds, focus: roundFocus, frame: roundFrame } = tourPlanner.roundHikes+ const offering = editingRoute && !wandererBrowser.open+ const offeredWays = offering ? comparison?.variants ?? rounds?.candidates ?? null : null+ // RTE-03: while round hikes are looked for and shown, the map frames where they can lie.+ const framedRounds = offering ? roundFrame : null+ const drawn = useLegVariantLines(highlighted.route, highlighted.walking, highlighted.colors, offeredWays, comparison ? variantFocus : roundFocus)const { closeGpxTour } = tourPlanneruseEffect(() => {@@ -132,10 +136,10 @@ export function useTripPlannerPage() {routeColors: drawn.colors,variantLines: drawn.overlays,previewPoints: tourConversion.status === 'idle' ? null : tourConversion.points,- focusPoints: mapFocusPoints,+ focusPoints: framedRounds?.points ?? mapFocusPoints,// A picked wanderer trail frames itself; the rest follows the planner.focusKey:- wandererBrowser.open && wandererBrowser.selected ? `wanderer:${wandererBrowser.selected.id}` : mapFocusKey, captureViewport,+ wandererBrowser.open && wandererBrowser.selected ? `wanderer:${wandererBrowser.selected.id}` : framedRounds?.key ?? mapFocusKey, captureViewport,},locationSearch,plannedTourDurations,diff --git a/client/tests/helpers/tourPlannerStub.ts b/client/tests/helpers/tourPlannerStub.tsindex 525eb0c82..0f7c6185a 100644--- a/client/tests/helpers/tourPlannerStub.ts+++ b/client/tests/helpers/tourPlannerStub.ts@@ -57,6 +57,7 @@ export function hikePlannerDefaults() {recomputeLeg: vi.fn(),routeDrawnLegsOnWater: vi.fn(),legVariants: idleLegVariants(),+ roundHikes: idleRoundHikes(),paddleRoute: null,routeCurrent: false,routeParts: null,@@ -96,3 +97,23 @@ export function idleLegVariants() {appliedHint: { shown: false, key: null, undo: vi.fn(), hold: vi.fn() },};}++/** RTE-03: a planner offering no round hike, with its actions as spies. */+export function idleRoundHikes() {+ return {+ view: null,+ focus: null,+ frame: null,+ canStart: vi.fn(() => false),+ open: vi.fn(),+ find: vi.fn(),+ back: vi.fn(),+ select: vi.fn(),+ hover: vi.fn(),+ apply: vi.fn(),+ confirm: vi.fn(),+ cancelConfirm: vi.fn(),+ close: vi.fn(),+ appliedHint: { shown: false, key: null, undo: vi.fn(), hold: vi.fn() },+ };+}diff --git a/shared/src/i18n/ar/tours.ts b/shared/src/i18n/ar/tours.tsindex 20d9d6afb..ef0b6c2a9 100644--- a/shared/src/i18n/ar/tours.ts+++ b/shared/src/i18n/ar/tours.ts@@ -1070,6 +1070,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'جارٍ التحقق من الطريق','tours.variants.apply': 'اعتمد هذا الطريق','tours.variants.applied': 'تم اعتماد الطريق',+ 'tours.planner.roundHike': 'مسار دائري من البداية',+ 'tours.planner.roundHikeFrom': 'مسار دائري من هنا',+ 'tours.round.title': 'نزهة دائرية',+ 'tours.round.from': 'من',+ 'tours.round.start': 'نقطة البداية',+ 'tours.round.distance': 'المسافة',+ 'tours.round.window': '{min} إلى {max}',+ 'tours.round.windowHint': 'تُعرض الدوائر التي تقع ضمن {percent} % من هذه المسافة',+ 'tours.round.limitHint': 'تلتزم الدوائر بحد الجولة: {limit}',+ 'tours.round.distanceRange': 'أدخل مسافة من {min} إلى {max}.',+ 'tours.round.find': 'ابحث عن دوائر',+ 'tours.round.searching': 'جارٍ البحث عن دوائر',+ 'tours.round.option': 'الدائرة {letter}',+ 'tours.round.deviationHint': 'مقارنةً بـ {target} المطلوبة',+ 'tours.round.none': 'لا توجد من هنا دائرة بين {min} و{max}. جرّب مسافة أخرى أو نقطة بداية أخرى.',+ 'tours.round.fewer': 'لا توجد من هنا دوائر أخرى تناسب هذه المسافة.',+ 'tours.round.failed': 'لم يستجب الموجّه أو لم يجد طريقًا من هنا. تبقى الجولة كما هي.',+ 'tours.round.stale': 'تغيّرت نقطة البداية أو الحد. ابحث مجددًا.',+ 'tours.round.again': 'ابحث مجددًا',+ 'tours.round.apply': 'اعتمد هذه الدائرة',+ 'tours.round.replaceTitle': 'استبدال المسار المخطط؟',+ 'tours.round.replaceBody': 'تُفسح النقاط المخططة حتى الآن المجال لهذه الدائرة. تراجعٌ واحد يعيدها.',+ 'tours.round.replace': 'استبدال',+ 'tours.round.applied': 'اعتُمدت الدائرة','tours.planner.shapeOnLine': 'انقر على المسار في الخريطة لإضافة نقطة تشكيل هناك.','tours.paddle.routeOnWater': 'خطّط المقطع التالي على الماء','tours.paddle.routeAllOnWater': 'خطّط على الماء المقاطع المرسومة يدويًا',diff --git a/shared/src/i18n/az/tours.ts b/shared/src/i18n/az/tours.tsindex a582e17c7..053d08c03 100644--- a/shared/src/i18n/az/tours.ts+++ b/shared/src/i18n/az/tours.ts@@ -1037,6 +1037,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Yol yoxlanılır','tours.variants.apply': 'Bu yolu seç','tours.variants.applied': 'Yol seçildi',+ 'tours.planner.roundHike': 'Başlanğıcdan dairəvi marşrut',+ 'tours.planner.roundHikeFrom': 'Buradan dairəvi marşrut',+ 'tours.round.title': 'Dairəvi yürüş',+ 'tours.round.from': 'Haradan',+ 'tours.round.start': 'Başlanğıc nöqtəsi',+ 'tours.round.distance': 'Məsafə',+ 'tours.round.window': '{min} ilə {max} arası',+ 'tours.round.windowHint': 'Bu məsafənin {percent} % daxilində olan dairələr təklif olunur',+ 'tours.round.limitHint': 'Dairələr turun limitinə əməl edir: {limit}',+ 'tours.round.distanceRange': '{min} ilə {max} arasında məsafə daxil edin.',+ 'tours.round.find': 'Dairələri tap',+ 'tours.round.searching': 'Dairələr axtarılır',+ 'tours.round.option': 'Dairə {letter}',+ 'tours.round.deviationHint': 'İstənilən {target} ilə müqayisədə',+ 'tours.round.none': 'Buradan {min} ilə {max} arasında dairə yoxdur. Başqa məsafə və ya başlanğıc nöqtəsi sınayın.',+ 'tours.round.fewer': 'Buradan bu məsafəyə uyğun başqa dairə yoxdur.',+ 'tours.round.failed': 'Marşrutlaşdırıcı cavab vermədi və ya buradan yol tapmadı. Tur olduğu kimi qalır.',+ 'tours.round.stale': 'Başlanğıc nöqtəsi və ya limit dəyişdi. Yenidən axtarın.',+ 'tours.round.again': 'Yenidən axtar',+ 'tours.round.apply': 'Bu dairəni seç',+ 'tours.round.replaceTitle': 'Planlaşdırılmış marşrut əvəz edilsin?',+ 'tours.round.replaceBody': 'İndiyədək planlaşdırılmış nöqtələr bu dairəyə yer verir. Bir geri al onları qaytarır.',+ 'tours.round.replace': 'Əvəz et',+ 'tours.round.applied': 'Dairə seçildi','tours.planner.shapeOnLine': 'Ora forma nöqtəsi əlavə etmək üçün xəritədəki marşruta klik et.','tours.paddle.routeOnWater': 'Növbəti hissəni su ilə planlaşdır','tours.paddle.routeAllOnWater': 'Əllə çəkilmiş hissələri su ilə planlaşdır',diff --git a/shared/src/i18n/br/tours.ts b/shared/src/i18n/br/tours.tsindex 616c7c780..bc7ac0f6b 100644--- a/shared/src/i18n/br/tours.ts+++ b/shared/src/i18n/br/tours.ts@@ -1044,6 +1044,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Verificando o caminho','tours.variants.apply': 'Usar este caminho','tours.variants.applied': 'Caminho adotado',+ 'tours.planner.roundHike': 'Trilha circular a partir do início',+ 'tours.planner.roundHikeFrom': 'Trilha circular a partir daqui',+ 'tours.round.title': 'Trilha circular',+ 'tours.round.from': 'A partir de',+ 'tours.round.start': 'Ponto de partida',+ 'tours.round.distance': 'Distância',+ 'tours.round.window': '{min} a {max}',+ 'tours.round.windowHint': 'São oferecidas voltas dentro de {percent} % desta distância',+ 'tours.round.limitHint': 'As voltas respeitam o limite do passeio: {limit}',+ 'tours.round.distanceRange': 'Informe uma distância de {min} a {max}.',+ 'tours.round.find': 'Buscar voltas',+ 'tours.round.searching': 'Buscando voltas',+ 'tours.round.option': 'Volta {letter}',+ 'tours.round.deviationHint': 'Em relação aos {target} desejados',+ 'tours.round.none': 'Daqui nenhuma volta fica entre {min} e {max}. Tente outra distância ou outro ponto de partida.',+ 'tours.round.fewer': 'Daqui não há mais voltas que caibam nesta distância.',+ 'tours.round.failed': 'O roteador não respondeu ou não achou caminho daqui. O passeio fica como está.',+ 'tours.round.stale': 'O ponto de partida ou o limite mudou. Busque de novo.',+ 'tours.round.again': 'Buscar de novo',+ 'tours.round.apply': 'Usar esta volta',+ 'tours.round.replaceTitle': 'Substituir a rota planejada?',+ 'tours.round.replaceBody': 'Os pontos planejados até agora dão lugar a esta volta. Um desfazer os traz de volta.',+ 'tours.round.replace': 'Substituir',+ 'tours.round.applied': 'Volta usada','tours.planner.shapeOnLine': 'Clique na rota no mapa para adicionar ali um ponto de forma.','tours.paddle.routeOnWater': 'Planejar o próximo trecho pela água','tours.paddle.routeAllOnWater': 'Planejar pela água os trechos desenhados à mão',diff --git a/shared/src/i18n/ca/tours.ts b/shared/src/i18n/ca/tours.tsindex 7d975c72c..f449a0d5d 100644--- a/shared/src/i18n/ca/tours.ts+++ b/shared/src/i18n/ca/tours.ts@@ -1046,6 +1046,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'S’està comprovant el camí','tours.variants.apply': 'Fes servir aquest camí','tours.variants.applied': 'Camí adoptat',+ 'tours.planner.roundHike': 'Ruta circular des de l’inici',+ 'tours.planner.roundHikeFrom': 'Ruta circular des d’aquí',+ 'tours.round.title': 'Ruta circular',+ 'tours.round.from': 'Des de',+ 'tours.round.start': 'Punt d’inici',+ 'tours.round.distance': 'Distància',+ 'tours.round.window': '{min} a {max}',+ 'tours.round.windowHint': 'S’ofereixen rutes dins d’un {percent} % d’aquesta distància',+ 'tours.round.limitHint': 'Les rutes respecten el límit del tour: {limit}',+ 'tours.round.distanceRange': 'Introdueix una distància de {min} a {max}.',+ 'tours.round.find': 'Cerca rutes',+ 'tours.round.searching': 'Cercant rutes',+ 'tours.round.option': 'Ruta {letter}',+ 'tours.round.deviationHint': 'Comparada amb els {target} desitjats',+ 'tours.round.none': 'Des d’aquí cap ruta fa entre {min} i {max}. Prova una altra distància o un altre punt d’inici.',+ 'tours.round.fewer': 'Des d’aquí no hi ha més rutes que encaixin amb aquesta distància.',+ 'tours.round.failed': 'L’encaminador no ha respost o no ha trobat cap camí des d’aquí. El tour queda com està.',+ 'tours.round.stale': 'El punt d’inici o el límit ha canviat. Torna a cercar.',+ 'tours.round.again': 'Torna a cercar',+ 'tours.round.apply': 'Agafa aquesta ruta',+ 'tours.round.replaceTitle': 'Vols substituir la ruta planificada?',+ 'tours.round.replaceBody': 'Els punts planificats fins ara deixen lloc a aquesta ruta. Un desfer els recupera.',+ 'tours.round.replace': 'Substitueix',+ 'tours.round.applied': 'Ruta agafada','tours.planner.shapeOnLine': 'Fes clic a la ruta del mapa per afegir-hi un punt de forma.','tours.paddle.routeOnWater': 'Planifica el tram següent per l’aigua','tours.paddle.routeAllOnWater': 'Planifica per l’aigua els trams dibuixats a mà',diff --git a/shared/src/i18n/cs/tours.ts b/shared/src/i18n/cs/tours.tsindex 40c4c4dfd..0cf7e63ea 100644--- a/shared/src/i18n/cs/tours.ts+++ b/shared/src/i18n/cs/tours.ts@@ -1036,6 +1036,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Cesta se ověřuje','tours.variants.apply': 'Použít tuto cestu','tours.variants.applied': 'Cesta převzata',+ 'tours.planner.roundHike': 'Okruh od startu',+ 'tours.planner.roundHikeFrom': 'Okruh odsud',+ 'tours.round.title': 'Okružní túra',+ 'tours.round.from': 'Od',+ 'tours.round.start': 'Výchozí bod',+ 'tours.round.distance': 'Vzdálenost',+ 'tours.round.window': '{min} až {max}',+ 'tours.round.windowHint': 'Nabízejí se okruhy do {percent} % od této vzdálenosti',+ 'tours.round.limitHint': 'Okruhy dodržují limit túry: {limit}',+ 'tours.round.distanceRange': 'Zadejte vzdálenost od {min} do {max}.',+ 'tours.round.find': 'Hledat okruhy',+ 'tours.round.searching': 'Hledají se okruhy',+ 'tours.round.option': 'Okruh {letter}',+ 'tours.round.deviationHint': 'Ve srovnání s požadovanými {target}',+ 'tours.round.none': 'Odsud žádný okruh nemá mezi {min} a {max}. Zkuste jinou vzdálenost nebo jiný výchozí bod.',+ 'tours.round.fewer': 'Odsud k této vzdálenosti další okruhy nesedí.',+ 'tours.round.failed': 'Router neodpověděl nebo odsud nenašel cestu. Túra zůstává, jak je.',+ 'tours.round.stale': 'Výchozí bod nebo limit se změnil. Hledejte znovu.',+ 'tours.round.again': 'Hledat znovu',+ 'tours.round.apply': 'Vzít tento okruh',+ 'tours.round.replaceTitle': 'Nahradit naplánovanou trasu?',+ 'tours.round.replaceBody': 'Dosud naplánované body ustoupí tomuto okruhu. Jedno zpět je vrátí.',+ 'tours.round.replace': 'Nahradit',+ 'tours.round.applied': 'Okruh převzat','tours.planner.shapeOnLine': 'Kliknutím na trasu v mapě tam přidáš tvarový bod.','tours.paddle.routeOnWater': 'Naplánovat další úsek po vodě','tours.paddle.routeAllOnWater': 'Naplánovat ručně kreslené úseky po vodě',diff --git a/shared/src/i18n/de/tours.ts b/shared/src/i18n/de/tours.tsindex 80bef76e7..cfcfc3b14 100644--- a/shared/src/i18n/de/tours.ts+++ b/shared/src/i18n/de/tours.ts@@ -1051,6 +1051,32 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Weg wird geprüft','tours.variants.apply': 'Diesen Weg nehmen','tours.variants.applied': 'Weg übernommen',+ 'tours.planner.roundHike': 'Rundtour ab dem Start',+ 'tours.planner.roundHikeFrom': 'Rundtour ab hier',+ 'tours.round.title': 'Rundtour',+ 'tours.round.from': 'Ab',+ 'tours.round.start': 'Startpunkt',+ 'tours.round.distance': 'Distanz',+ 'tours.round.window': '{min} bis {max}',+ 'tours.round.windowHint': 'Angeboten werden Runden bis {percent} % neben dieser Distanz',+ 'tours.round.limitHint': 'Die Runden halten sich an das Limit der Tour: {limit}',+ 'tours.round.distanceRange': 'Gib eine Distanz von {min} bis {max} ein.',+ 'tours.round.find': 'Runden suchen',+ 'tours.round.searching': 'Runden werden gesucht',+ 'tours.round.option': 'Runde {letter}',+ 'tours.round.deviationHint': 'Im Vergleich zu den gewünschten {target}',+ 'tours.round.none':+ 'Ab hier liegt keine Runde zwischen {min} und {max}. Versuch eine andere Distanz oder einen anderen Startpunkt.',+ 'tours.round.fewer': 'Mehr Runden passen ab hier nicht zu dieser Distanz.',+ 'tours.round.failed':+ 'Der Router hat nicht geantwortet oder ab hier keinen Weg gefunden. Die Tour bleibt, wie sie ist.',+ 'tours.round.stale': 'Startpunkt oder Limit haben sich geändert. Such die Runden neu.',+ 'tours.round.again': 'Neu suchen',+ 'tours.round.apply': 'Diese Runde nehmen',+ 'tours.round.replaceTitle': 'Geplante Route ersetzen?',+ 'tours.round.replaceBody': 'Die bisher geplanten Punkte weichen dieser Runde. Ein Rückgängig holt sie zurück.',+ 'tours.round.replace': 'Ersetzen',+ 'tours.round.applied': 'Runde übernommen','tours.planner.shapeOnLine': 'Ein Klick auf die Route in der Karte setzt dort einen Formpunkt.','tours.paddle.routeOnWater': 'Nächsten Abschnitt auf dem Wasser planen','tours.paddle.routeAllOnWater': 'Von Hand gezeichnete Abschnitte auf dem Wasser planen',diff --git a/shared/src/i18n/en/tours.ts b/shared/src/i18n/en/tours.tsindex 8121bb3ce..a94ce3bbb 100644--- a/shared/src/i18n/en/tours.ts+++ b/shared/src/i18n/en/tours.ts@@ -1025,6 +1025,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Checking the way','tours.variants.apply': 'Take this way','tours.variants.applied': 'Way taken',+ 'tours.planner.roundHike': 'Round hike from the start',+ 'tours.planner.roundHikeFrom': 'Round hike from here',+ 'tours.round.title': 'Round hike',+ 'tours.round.from': 'From',+ 'tours.round.start': 'Start point',+ 'tours.round.distance': 'Distance',+ 'tours.round.window': '{min} to {max}',+ 'tours.round.windowHint': 'Rounds within {percent} % of this distance are offered',+ 'tours.round.limitHint': "Rounds keep to the tour's limit: {limit}",+ 'tours.round.distanceRange': 'Enter a distance from {min} to {max}.',+ 'tours.round.find': 'Find rounds',+ 'tours.round.searching': 'Looking for rounds',+ 'tours.round.option': 'Round {letter}',+ 'tours.round.deviationHint': 'Compared with the wished {target}',+ 'tours.round.none': 'No round from here lies between {min} and {max}. Try another distance or start point.',+ 'tours.round.fewer': 'No more rounds fit this distance from here.',+ 'tours.round.failed': 'The router did not answer or found no way from here. The tour stays as it is.',+ 'tours.round.stale': 'The start point or the limit changed. Find rounds again.',+ 'tours.round.again': 'Search again',+ 'tours.round.apply': 'Take this round',+ 'tours.round.replaceTitle': 'Replace the planned route?',+ 'tours.round.replaceBody': 'The points planned so far give way to this round. One undo brings them back.',+ 'tours.round.replace': 'Replace',+ 'tours.round.applied': 'Round taken','tours.planner.shapeOnLine': 'Click the route on the map to add a shaping point there.','tours.paddle.routeOnWater': 'Plan the next leg on the water','tours.paddle.routeAllOnWater': 'Plan the legs drawn by hand on the water',diff --git a/shared/src/i18n/es/tours.ts b/shared/src/i18n/es/tours.tsindex 936b10bad..3211e1571 100644--- a/shared/src/i18n/es/tours.ts+++ b/shared/src/i18n/es/tours.ts@@ -1043,6 +1043,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Comprobando el camino','tours.variants.apply': 'Usar este camino','tours.variants.applied': 'Camino adoptado',+ 'tours.planner.roundHike': 'Ruta circular desde el inicio',+ 'tours.planner.roundHikeFrom': 'Ruta circular desde aquí',+ 'tours.round.title': 'Ruta circular',+ 'tours.round.from': 'Desde',+ 'tours.round.start': 'Punto de inicio',+ 'tours.round.distance': 'Distancia',+ 'tours.round.window': '{min} a {max}',+ 'tours.round.windowHint': 'Se ofrecen rutas a menos de un {percent} % de esta distancia',+ 'tours.round.limitHint': 'Las rutas respetan el límite del tour: {limit}',+ 'tours.round.distanceRange': 'Introduce una distancia de {min} a {max}.',+ 'tours.round.find': 'Buscar rutas',+ 'tours.round.searching': 'Buscando rutas',+ 'tours.round.option': 'Ruta {letter}',+ 'tours.round.deviationHint': 'Comparada con los {target} deseados',+ 'tours.round.none': 'Desde aquí ninguna ruta mide entre {min} y {max}. Prueba otra distancia u otro punto de inicio.',+ 'tours.round.fewer': 'Desde aquí no hay más rutas que encajen con esta distancia.',+ 'tours.round.failed': 'El enrutador no respondió o no encontró ningún camino desde aquí. El tour queda como está.',+ 'tours.round.stale': 'El punto de inicio o el límite ha cambiado. Vuelve a buscar.',+ 'tours.round.again': 'Buscar de nuevo',+ 'tours.round.apply': 'Tomar esta ruta',+ 'tours.round.replaceTitle': '¿Reemplazar la ruta planificada?',+ 'tours.round.replaceBody': 'Los puntos planificados hasta ahora dejan paso a esta ruta. Un deshacer los recupera.',+ 'tours.round.replace': 'Reemplazar',+ 'tours.round.applied': 'Ruta tomada','tours.planner.shapeOnLine': 'Haz clic en la ruta del mapa para añadir ahí un punto de forma.','tours.paddle.routeOnWater': 'Planificar el siguiente tramo por el agua','tours.paddle.routeAllOnWater': 'Planificar por el agua los tramos dibujados a mano',diff --git a/shared/src/i18n/et/tours.ts b/shared/src/i18n/et/tours.tsindex e7d86ef7c..1e908570d 100644--- a/shared/src/i18n/et/tours.ts+++ b/shared/src/i18n/et/tours.ts@@ -1030,6 +1030,31 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Teed kontrollitakse','tours.variants.apply': 'Vali see tee','tours.variants.applied': 'Tee valitud',+ 'tours.planner.roundHike': 'Ringmatk algusest',+ 'tours.planner.roundHikeFrom': 'Ringmatk siit',+ 'tours.round.title': 'Ringmatk',+ 'tours.round.from': 'Alates',+ 'tours.round.start': 'Alguspunkt',+ 'tours.round.distance': 'Pikkus',+ 'tours.round.window': '{min} kuni {max}',+ 'tours.round.windowHint': 'Pakutakse ringe, mis jäävad selle pikkuse {percent} % piiresse',+ 'tours.round.limitHint': 'Ringid peavad kinni matka piirist: {limit}',+ 'tours.round.distanceRange': 'Sisestage pikkus vahemikus {min} kuni {max}.',+ 'tours.round.find': 'Otsi ringe',+ 'tours.round.searching': 'Ringe otsitakse',+ 'tours.round.option': 'Ring {letter}',+ 'tours.round.deviationHint': 'Võrreldes soovitud {target}',+ 'tours.round.none': 'Siit ei jää ükski ring vahemikku {min} kuni {max}. Proovige teist pikkust või alguspunkti.',+ 'tours.round.fewer': 'Rohkem ringe siit selle pikkusega ei sobi.',+ 'tours.round.failed': 'Marsruuter ei vastanud või ei leidnud siit teed. Matk jääb samaks.',+ 'tours.round.stale': 'Alguspunkt või piir muutus. Otsige uuesti.',+ 'tours.round.again': 'Otsi uuesti',+ 'tours.round.apply': 'Vali see ring',+ 'tours.round.replaceTitle': 'Kas asendada planeeritud marsruut?',+ 'tours.round.replaceBody':+ 'Seni planeeritud punktid annavad koha sellele ringile. Üks tagasivõtmine toob need tagasi.',+ 'tours.round.replace': 'Asenda',+ 'tours.round.applied': 'Ring valitud','tours.planner.shapeOnLine': 'Klõpsa kaardil marsruudil, et lisada sinna kujunduspunkt.','tours.paddle.routeOnWater': 'Planeeri järgmine lõik vett mööda','tours.paddle.routeAllOnWater': 'Planeeri käsitsi joonistatud lõigud vett mööda',diff --git a/shared/src/i18n/fr/tours.ts b/shared/src/i18n/fr/tours.tsindex 1ffc98ea9..765d621d7 100644--- a/shared/src/i18n/fr/tours.ts+++ b/shared/src/i18n/fr/tours.ts@@ -1061,6 +1061,32 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Vérification du chemin','tours.variants.apply': 'Prendre ce chemin','tours.variants.applied': 'Chemin adopté',+ 'tours.planner.roundHike': 'Boucle depuis le départ',+ 'tours.planner.roundHikeFrom': 'Boucle depuis ici',+ 'tours.round.title': 'Randonnée en boucle',+ 'tours.round.from': 'Depuis',+ 'tours.round.start': 'Point de départ',+ 'tours.round.distance': 'Longueur',+ 'tours.round.window': '{min} à {max}',+ 'tours.round.windowHint': 'Les boucles à {percent} % près de cette longueur sont proposées',+ 'tours.round.limitHint': 'Les boucles respectent la limite du tour : {limit}',+ 'tours.round.distanceRange': 'Saisissez une longueur de {min} à {max}.',+ 'tours.round.find': 'Chercher des boucles',+ 'tours.round.searching': 'Recherche de boucles',+ 'tours.round.option': 'Boucle {letter}',+ 'tours.round.deviationHint': 'Par rapport aux {target} souhaités',+ 'tours.round.none':+ 'Aucune boucle depuis ici ne fait entre {min} et {max}. Essayez une autre longueur ou un autre point de départ.',+ 'tours.round.fewer': 'Aucune autre boucle ne correspond à cette longueur depuis ici.',+ 'tours.round.failed': "Le routeur n'a pas répondu ou n'a trouvé aucun chemin depuis ici. Le tour reste tel quel.",+ 'tours.round.stale': 'Le point de départ ou la limite a changé. Relancez la recherche.',+ 'tours.round.again': 'Chercher à nouveau',+ 'tours.round.apply': 'Prendre cette boucle',+ 'tours.round.replaceTitle': "Remplacer l'itinéraire prévu ?",+ 'tours.round.replaceBody':+ "Les points prévus jusqu'ici cèdent la place à cette boucle. Une annulation les fait revenir.",+ 'tours.round.replace': 'Remplacer',+ 'tours.round.applied': 'Boucle reprise','tours.planner.shapeOnLine': 'Cliquez sur l’itinéraire dans la carte pour y ajouter un point de guidage.','tours.paddle.routeOnWater': 'Planifier le tronçon suivant sur l’eau','tours.paddle.routeAllOnWater': 'Planifier sur l’eau les tronçons tracés à la main',diff --git a/shared/src/i18n/gr/tours.ts b/shared/src/i18n/gr/tours.tsindex 52a791ad2..bbb68f5e8 100644--- a/shared/src/i18n/gr/tours.ts+++ b/shared/src/i18n/gr/tours.ts@@ -1064,6 +1064,32 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Έλεγχος διαδρομής','tours.variants.apply': 'Χρήση αυτής της διαδρομής','tours.variants.applied': 'Η διαδρομή υιοθετήθηκε',+ 'tours.planner.roundHike': 'Κυκλική διαδρομή από την αφετηρία',+ 'tours.planner.roundHikeFrom': 'Κυκλική διαδρομή από εδώ',+ 'tours.round.title': 'Κυκλική πεζοπορία',+ 'tours.round.from': 'Από',+ 'tours.round.start': 'Σημείο αφετηρίας',+ 'tours.round.distance': 'Απόσταση',+ 'tours.round.window': '{min} έως {max}',+ 'tours.round.windowHint': 'Προτείνονται κύκλοι εντός {percent} % από αυτή την απόσταση',+ 'tours.round.limitHint': 'Οι κύκλοι τηρούν το όριο της διαδρομής: {limit}',+ 'tours.round.distanceRange': 'Εισαγάγετε απόσταση από {min} έως {max}.',+ 'tours.round.find': 'Εύρεση κύκλων',+ 'tours.round.searching': 'Αναζήτηση κύκλων',+ 'tours.round.option': 'Κύκλος {letter}',+ 'tours.round.deviationHint': 'Σε σύγκριση με τα επιθυμητά {target}',+ 'tours.round.none':+ 'Από εδώ κανένας κύκλος δεν είναι μεταξύ {min} και {max}. Δοκιμάστε άλλη απόσταση ή άλλη αφετηρία.',+ 'tours.round.fewer': 'Από εδώ δεν ταιριάζουν άλλοι κύκλοι σε αυτή την απόσταση.',+ 'tours.round.failed': 'Ο δρομολογητής δεν απάντησε ή δεν βρήκε δρόμο από εδώ. Η διαδρομή μένει ως έχει.',+ 'tours.round.stale': 'Η αφετηρία ή το όριο άλλαξε. Αναζητήστε ξανά.',+ 'tours.round.again': 'Νέα αναζήτηση',+ 'tours.round.apply': 'Επιλογή αυτού του κύκλου',+ 'tours.round.replaceTitle': 'Αντικατάσταση της σχεδιασμένης διαδρομής;',+ 'tours.round.replaceBody':+ 'Τα σημεία που σχεδιάστηκαν ως τώρα δίνουν τη θέση τους σε αυτόν τον κύκλο. Μία αναίρεση τα επαναφέρει.',+ 'tours.round.replace': 'Αντικατάσταση',+ 'tours.round.applied': 'Ο κύκλος επιλέχθηκε','tours.planner.shapeOnLine': 'Κάνε κλικ στη διαδρομή στον χάρτη για να προσθέσεις εκεί σημείο διαμόρφωσης.','tours.paddle.routeOnWater': 'Σχεδίασε το επόμενο τμήμα στο νερό','tours.paddle.routeAllOnWater': 'Σχεδίασε στο νερό τα τμήματα που ζωγραφίστηκαν με το χέρι',diff --git a/shared/src/i18n/hu/tours.ts b/shared/src/i18n/hu/tours.tsindex 708db0e28..a61c647e6 100644--- a/shared/src/i18n/hu/tours.ts+++ b/shared/src/i18n/hu/tours.ts@@ -1049,6 +1049,31 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Az út ellenőrzése','tours.variants.apply': 'Ezt az utat választom','tours.variants.applied': 'Út átvéve',+ 'tours.planner.roundHike': 'Körtúra a kezdőponttól',+ 'tours.planner.roundHikeFrom': 'Körtúra innen',+ 'tours.round.title': 'Körtúra',+ 'tours.round.from': 'Innen',+ 'tours.round.start': 'Kezdőpont',+ 'tours.round.distance': 'Táv',+ 'tours.round.window': '{min} és {max} között',+ 'tours.round.windowHint': 'A táv {percent} %-án belüli körök jelennek meg',+ 'tours.round.limitHint': 'A körök tartják a túra határát: {limit}',+ 'tours.round.distanceRange': 'Adjon meg egy távot {min} és {max} között.',+ 'tours.round.find': 'Körök keresése',+ 'tours.round.searching': 'Körök keresése folyamatban',+ 'tours.round.option': '{letter} kör',+ 'tours.round.deviationHint': 'A kívánt {target} távhoz képest',+ 'tours.round.none': 'Innen nincs kör {min} és {max} között. Próbáljon más távot vagy más kezdőpontot.',+ 'tours.round.fewer': 'Innen nincs több kör, amely ehhez a távhoz illik.',+ 'tours.round.failed': 'Az útvonaltervező nem válaszolt, vagy innen nem talált utat. A túra változatlan marad.',+ 'tours.round.stale': 'A kezdőpont vagy a határ megváltozott. Keressen újra.',+ 'tours.round.again': 'Újrakeresés',+ 'tours.round.apply': 'Ezt a kört választom',+ 'tours.round.replaceTitle': 'Lecseréled a tervezett útvonalat?',+ 'tours.round.replaceBody':+ 'Az eddig tervezett pontok átadják a helyüket ennek a körnek. Egy visszavonás visszahozza őket.',+ 'tours.round.replace': 'Csere',+ 'tours.round.applied': 'Kör átvéve','tours.planner.shapeOnLine': 'Kattints az útvonalra a térképen, hogy oda alakítópontot tegyél.','tours.paddle.routeOnWater': 'Következő szakasz tervezése a vízen','tours.paddle.routeAllOnWater': 'Kézzel rajzolt szakaszok tervezése a vízen',diff --git a/shared/src/i18n/id/tours.ts b/shared/src/i18n/id/tours.tsindex a9a2b4e91..723be8bb1 100644--- a/shared/src/i18n/id/tours.ts+++ b/shared/src/i18n/id/tours.ts@@ -1029,6 +1029,31 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Memeriksa jalan','tours.variants.apply': 'Pakai jalan ini','tours.variants.applied': 'Jalan dipakai',+ 'tours.planner.roundHike': 'Rute melingkar dari awal',+ 'tours.planner.roundHikeFrom': 'Rute melingkar dari sini',+ 'tours.round.title': 'Pendakian melingkar',+ 'tours.round.from': 'Dari',+ 'tours.round.start': 'Titik awal',+ 'tours.round.distance': 'Jarak',+ 'tours.round.window': '{min} sampai {max}',+ 'tours.round.windowHint': 'Putaran dalam {percent} % dari jarak ini ditawarkan',+ 'tours.round.limitHint': 'Putaran mematuhi batas tur: {limit}',+ 'tours.round.distanceRange': 'Masukkan jarak dari {min} sampai {max}.',+ 'tours.round.find': 'Cari putaran',+ 'tours.round.searching': 'Mencari putaran',+ 'tours.round.option': 'Putaran {letter}',+ 'tours.round.deviationHint': 'Dibandingkan dengan {target} yang diinginkan',+ 'tours.round.none': 'Dari sini tidak ada putaran antara {min} dan {max}. Coba jarak atau titik awal lain.',+ 'tours.round.fewer': 'Dari sini tidak ada putaran lain yang cocok dengan jarak ini.',+ 'tours.round.failed': 'Router tidak menjawab atau tidak menemukan jalan dari sini. Tur tetap seperti adanya.',+ 'tours.round.stale': 'Titik awal atau batas berubah. Cari lagi.',+ 'tours.round.again': 'Cari lagi',+ 'tours.round.apply': 'Ambil putaran ini',+ 'tours.round.replaceTitle': 'Ganti rute yang direncanakan?',+ 'tours.round.replaceBody':+ 'Titik yang direncanakan sejauh ini diganti oleh putaran ini. Satu kali urungkan mengembalikannya.',+ 'tours.round.replace': 'Ganti',+ 'tours.round.applied': 'Putaran diambil','tours.planner.shapeOnLine': 'Klik rute di peta untuk menambahkan titik bentuk di sana.','tours.paddle.routeOnWater': 'Rencanakan bagian berikutnya di air','tours.paddle.routeAllOnWater': 'Rencanakan di air bagian yang digambar tangan',diff --git a/shared/src/i18n/it/tours.ts b/shared/src/i18n/it/tours.tsindex ab2921f56..bc244afc3 100644--- a/shared/src/i18n/it/tours.ts+++ b/shared/src/i18n/it/tours.ts@@ -1051,6 +1051,32 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Verifica del percorso','tours.variants.apply': 'Usa questo percorso','tours.variants.applied': 'Percorso adottato',+ 'tours.planner.roundHike': 'Anello dalla partenza',+ 'tours.planner.roundHikeFrom': 'Anello da qui',+ 'tours.round.title': 'Escursione ad anello',+ 'tours.round.from': 'Da',+ 'tours.round.start': 'Punto di partenza',+ 'tours.round.distance': 'Distanza',+ 'tours.round.window': 'da {min} a {max}',+ 'tours.round.windowHint': 'Vengono proposti anelli entro il {percent} % di questa distanza',+ 'tours.round.limitHint': 'Gli anelli rispettano il limite del tour: {limit}',+ 'tours.round.distanceRange': 'Inserisci una distanza da {min} a {max}.',+ 'tours.round.find': 'Cerca anelli',+ 'tours.round.searching': 'Ricerca degli anelli',+ 'tours.round.option': 'Anello {letter}',+ 'tours.round.deviationHint': 'Rispetto ai {target} desiderati',+ 'tours.round.none':+ 'Da qui nessun anello misura tra {min} e {max}. Prova un’altra distanza o un altro punto di partenza.',+ 'tours.round.fewer': 'Da qui non ci sono altri anelli adatti a questa distanza.',+ 'tours.round.failed': 'Il router non ha risposto o non ha trovato percorsi da qui. Il tour resta com’è.',+ 'tours.round.stale': 'Il punto di partenza o il limite è cambiato. Cerca di nuovo.',+ 'tours.round.again': 'Cerca di nuovo',+ 'tours.round.apply': 'Scegli questo anello',+ 'tours.round.replaceTitle': 'Sostituire il percorso pianificato?',+ 'tours.round.replaceBody':+ 'I punti pianificati finora lasciano il posto a questo anello. Un annullamento li riporta indietro.',+ 'tours.round.replace': 'Sostituisci',+ 'tours.round.applied': 'Anello scelto','tours.planner.shapeOnLine': 'Fai clic sul percorso nella mappa per aggiungervi un punto di forma.','tours.paddle.routeOnWater': 'Pianifica il tratto successivo sull’acqua','tours.paddle.routeAllOnWater': 'Pianifica sull’acqua i tratti disegnati a mano',diff --git a/shared/src/i18n/ja/tours.ts b/shared/src/i18n/ja/tours.tsindex 61a122ac9..2d2f8265e 100644--- a/shared/src/i18n/ja/tours.ts+++ b/shared/src/i18n/ja/tours.ts@@ -1005,6 +1005,30 @@ const tours: TranslationStrings = {'tours.variants.checking': '道を確認中','tours.variants.apply': 'この道にする','tours.variants.applied': '道を採用しました',+ 'tours.planner.roundHike': 'スタートから周回ルート',+ 'tours.planner.roundHikeFrom': 'ここから周回ルート',+ 'tours.round.title': '周回ハイキング',+ 'tours.round.from': '出発',+ 'tours.round.start': 'スタート地点',+ 'tours.round.distance': '距離',+ 'tours.round.window': '{min}〜{max}',+ 'tours.round.windowHint': 'この距離の {percent} % 以内の周回を表示します',+ 'tours.round.limitHint': '周回はツアーの上限を守ります: {limit}',+ 'tours.round.distanceRange': '{min}から{max}の距離を入力してください。',+ 'tours.round.find': '周回を探す',+ 'tours.round.searching': '周回を検索中',+ 'tours.round.option': '周回 {letter}',+ 'tours.round.deviationHint': '希望の {target} との比較',+ 'tours.round.none': 'ここから {min}〜{max} の周回はありません。別の距離か別のスタート地点をお試しください。',+ 'tours.round.fewer': 'ここからこの距離に合う周回はほかにありません。',+ 'tours.round.failed': 'ルーターが応答しないか、ここから道が見つかりませんでした。ツアーはそのままです。',+ 'tours.round.stale': 'スタート地点か上限が変わりました。もう一度探してください。',+ 'tours.round.again': 'もう一度探す',+ 'tours.round.apply': 'この周回にする',+ 'tours.round.replaceTitle': '計画中のルートを置き換えますか?',+ 'tours.round.replaceBody': 'これまで計画したポイントはこの周回に置き換わります。元に戻すを1回行えば戻せます。',+ 'tours.round.replace': '置き換える',+ 'tours.round.applied': '周回を採用しました','tours.planner.shapeOnLine': '地図上のルートをクリックすると、そこに形状ポイントを追加できます。','tours.paddle.routeOnWater': '次の区間を水上で計画','tours.paddle.routeAllOnWater': '手描きの区間を水上で計画',diff --git a/shared/src/i18n/ko/tours.ts b/shared/src/i18n/ko/tours.tsindex 8a6f05e41..486e016f9 100644--- a/shared/src/i18n/ko/tours.ts+++ b/shared/src/i18n/ko/tours.ts@@ -1002,6 +1002,30 @@ const tours: TranslationStrings = {'tours.variants.checking': '길을 확인하는 중','tours.variants.apply': '이 길로 하기','tours.variants.applied': '길을 적용했습니다',+ 'tours.planner.roundHike': '출발점에서 순환 코스',+ 'tours.planner.roundHikeFrom': '여기서 순환 코스',+ 'tours.round.title': '순환 하이킹',+ 'tours.round.from': '출발',+ 'tours.round.start': '출발 지점',+ 'tours.round.distance': '거리',+ 'tours.round.window': '{min}~{max}',+ 'tours.round.windowHint': '이 거리의 {percent} % 이내 순환 코스를 보여 줍니다',+ 'tours.round.limitHint': '순환 코스는 투어 한도를 지킵니다: {limit}',+ 'tours.round.distanceRange': '{min}에서 {max} 사이의 거리를 입력하세요.',+ 'tours.round.find': '순환 코스 찾기',+ 'tours.round.searching': '순환 코스를 찾는 중',+ 'tours.round.option': '순환 코스 {letter}',+ 'tours.round.deviationHint': '원하는 {target}와 비교',+ 'tours.round.none': '여기서 {min}~{max} 사이의 순환 코스가 없습니다. 다른 거리나 출발 지점을 시도해 보세요.',+ 'tours.round.fewer': '여기서 이 거리에 맞는 순환 코스가 더 없습니다.',+ 'tours.round.failed': '라우터가 응답하지 않았거나 여기서 길을 찾지 못했습니다. 투어는 그대로입니다.',+ 'tours.round.stale': '출발 지점이나 한도가 바뀌었습니다. 다시 찾아 보세요.',+ 'tours.round.again': '다시 찾기',+ 'tours.round.apply': '이 순환 코스 선택',+ 'tours.round.replaceTitle': '계획한 경로를 바꿀까요?',+ 'tours.round.replaceBody': '지금까지 계획한 지점이 이 순환 코스로 바뀝니다. 실행 취소 한 번으로 되돌릴 수 있습니다.',+ 'tours.round.replace': '바꾸기',+ 'tours.round.applied': '순환 코스 선택됨','tours.planner.shapeOnLine': '지도에서 경로를 클릭하면 그곳에 형태 지점을 추가합니다.','tours.paddle.routeOnWater': '다음 구간을 물 위로 계획','tours.paddle.routeAllOnWater': '손으로 그린 구간을 물 위로 계획',diff --git a/shared/src/i18n/nl/tours.ts b/shared/src/i18n/nl/tours.tsindex ccd3f80a8..87f094148 100644--- a/shared/src/i18n/nl/tours.ts+++ b/shared/src/i18n/nl/tours.ts@@ -1046,6 +1046,32 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Weg wordt gecontroleerd','tours.variants.apply': 'Deze weg nemen','tours.variants.applied': 'Weg overgenomen',+ 'tours.planner.roundHike': 'Rondwandeling vanaf de start',+ 'tours.planner.roundHikeFrom': 'Rondwandeling vanaf hier',+ 'tours.round.title': 'Rondwandeling',+ 'tours.round.from': 'Vanaf',+ 'tours.round.start': 'Startpunt',+ 'tours.round.distance': 'Afstand',+ 'tours.round.window': '{min} tot {max}',+ 'tours.round.windowHint': 'Rondes binnen {percent} % van deze afstand worden aangeboden',+ 'tours.round.limitHint': 'De rondes houden zich aan de limiet van de tour: {limit}',+ 'tours.round.distanceRange': 'Vul een afstand in van {min} tot {max}.',+ 'tours.round.find': 'Rondes zoeken',+ 'tours.round.searching': 'Rondes worden gezocht',+ 'tours.round.option': 'Ronde {letter}',+ 'tours.round.deviationHint': 'Vergeleken met de gewenste {target}',+ 'tours.round.none':+ 'Vanaf hier ligt geen ronde tussen {min} en {max}. Probeer een andere afstand of een ander startpunt.',+ 'tours.round.fewer': 'Meer rondes passen vanaf hier niet bij deze afstand.',+ 'tours.round.failed': 'De router gaf geen antwoord of vond vanaf hier geen weg. De tour blijft zoals hij is.',+ 'tours.round.stale': 'Het startpunt of de limiet is veranderd. Zoek opnieuw.',+ 'tours.round.again': 'Opnieuw zoeken',+ 'tours.round.apply': 'Deze ronde nemen',+ 'tours.round.replaceTitle': 'Geplande route vervangen?',+ 'tours.round.replaceBody':+ 'De tot nu toe geplande punten maken plaats voor deze ronde. Eén keer ongedaan maken brengt ze terug.',+ 'tours.round.replace': 'Vervangen',+ 'tours.round.applied': 'Ronde overgenomen','tours.planner.shapeOnLine': 'Klik op de route op de kaart om daar een vormpunt toe te voegen.','tours.paddle.routeOnWater': 'Volgend deel over het water plannen','tours.paddle.routeAllOnWater': 'Met de hand getekende delen over het water plannen',diff --git a/shared/src/i18n/pl/tours.ts b/shared/src/i18n/pl/tours.tsindex 3e6a21aea..2be2242d0 100644--- a/shared/src/i18n/pl/tours.ts+++ b/shared/src/i18n/pl/tours.ts@@ -1072,6 +1072,31 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Sprawdzanie drogi','tours.variants.apply': 'Wybierz tę drogę','tours.variants.applied': 'Droga przyjęta',+ 'tours.planner.roundHike': 'Pętla od startu',+ 'tours.planner.roundHikeFrom': 'Pętla stąd',+ 'tours.round.title': 'Wędrówka w pętli',+ 'tours.round.from': 'Od',+ 'tours.round.start': 'Punkt startowy',+ 'tours.round.distance': 'Dystans',+ 'tours.round.window': '{min} do {max}',+ 'tours.round.windowHint': 'Proponowane są pętle w granicach {percent} % tego dystansu',+ 'tours.round.limitHint': 'Pętle trzymają się limitu trasy: {limit}',+ 'tours.round.distanceRange': 'Wpisz dystans od {min} do {max}.',+ 'tours.round.find': 'Szukaj pętli',+ 'tours.round.searching': 'Szukanie pętli',+ 'tours.round.option': 'Pętla {letter}',+ 'tours.round.deviationHint': 'W porównaniu z oczekiwanymi {target}',+ 'tours.round.none':+ 'Stąd żadna pętla nie mieści się między {min} a {max}. Spróbuj innego dystansu lub punktu startowego.',+ 'tours.round.fewer': 'Stąd więcej pętli nie pasuje do tego dystansu.',+ 'tours.round.failed': 'Router nie odpowiedział lub nie znalazł stąd drogi. Trasa zostaje bez zmian.',+ 'tours.round.stale': 'Punkt startowy lub limit się zmienił. Wyszukaj ponownie.',+ 'tours.round.again': 'Szukaj ponownie',+ 'tours.round.apply': 'Wybierz tę pętlę',+ 'tours.round.replaceTitle': 'Zastąpić zaplanowaną trasę?',+ 'tours.round.replaceBody': 'Dotychczas zaplanowane punkty ustępują tej pętli. Jedno cofnięcie przywraca je.',+ 'tours.round.replace': 'Zastąp',+ 'tours.round.applied': 'Pętla przyjęta','tours.planner.shapeOnLine': 'Kliknij trasę na mapie, aby dodać tam punkt kształtujący.','tours.paddle.routeOnWater': 'Zaplanuj następny odcinek po wodzie','tours.paddle.routeAllOnWater': 'Zaplanuj po wodzie odcinki narysowane ręcznie',diff --git a/shared/src/i18n/ru/tours.ts b/shared/src/i18n/ru/tours.tsindex 7605beb0d..ac0812db1 100644--- a/shared/src/i18n/ru/tours.ts+++ b/shared/src/i18n/ru/tours.ts@@ -1076,6 +1076,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Путь проверяется','tours.variants.apply': 'Выбрать этот путь','tours.variants.applied': 'Путь принят',+ 'tours.planner.roundHike': 'Кольцевой маршрут от старта',+ 'tours.planner.roundHikeFrom': 'Кольцевой маршрут отсюда',+ 'tours.round.title': 'Кольцевой поход',+ 'tours.round.from': 'От',+ 'tours.round.start': 'Точка старта',+ 'tours.round.distance': 'Расстояние',+ 'tours.round.window': 'от {min} до {max}',+ 'tours.round.windowHint': 'Предлагаются кольца в пределах {percent} % от этого расстояния',+ 'tours.round.limitHint': 'Кольца соблюдают лимит тура: {limit}',+ 'tours.round.distanceRange': 'Введите расстояние от {min} до {max}.',+ 'tours.round.find': 'Найти кольца',+ 'tours.round.searching': 'Идёт поиск колец',+ 'tours.round.option': 'Кольцо {letter}',+ 'tours.round.deviationHint': 'По сравнению с желаемыми {target}',+ 'tours.round.none': 'Отсюда нет кольца от {min} до {max}. Попробуйте другое расстояние или другую точку старта.',+ 'tours.round.fewer': 'Отсюда больше колец под это расстояние нет.',+ 'tours.round.failed': 'Маршрутизатор не ответил или не нашёл отсюда пути. Тур остаётся без изменений.',+ 'tours.round.stale': 'Точка старта или лимит изменились. Повторите поиск.',+ 'tours.round.again': 'Искать заново',+ 'tours.round.apply': 'Взять это кольцо',+ 'tours.round.replaceTitle': 'Заменить запланированный маршрут?',+ 'tours.round.replaceBody': 'Запланированные до сих пор точки уступают место этому кольцу. Одна отмена вернёт их.',+ 'tours.round.replace': 'Заменить',+ 'tours.round.applied': 'Кольцо выбрано','tours.planner.shapeOnLine': 'Нажмите на маршрут на карте, чтобы добавить там точку формы.','tours.paddle.routeOnWater': 'Проложить следующий участок по воде','tours.paddle.routeAllOnWater': 'Проложить по воде участки, нарисованные вручную',diff --git a/shared/src/i18n/sk/tours.ts b/shared/src/i18n/sk/tours.tsindex 0a4a1bc6e..db9f6fb83 100644--- a/shared/src/i18n/sk/tours.ts+++ b/shared/src/i18n/sk/tours.ts@@ -1040,6 +1040,31 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Cesta sa overuje','tours.variants.apply': 'Použiť túto cestu','tours.variants.applied': 'Cesta prevzatá',+ 'tours.planner.roundHike': 'Okruh od štartu',+ 'tours.planner.roundHikeFrom': 'Okruh odtiaľto',+ 'tours.round.title': 'Okružná túra',+ 'tours.round.from': 'Od',+ 'tours.round.start': 'Východiskový bod',+ 'tours.round.distance': 'Vzdialenosť',+ 'tours.round.window': '{min} až {max}',+ 'tours.round.windowHint': 'Ponúkajú sa okruhy do {percent} % od tejto vzdialenosti',+ 'tours.round.limitHint': 'Okruhy dodržiavajú limit túry: {limit}',+ 'tours.round.distanceRange': 'Zadajte vzdialenosť od {min} do {max}.',+ 'tours.round.find': 'Hľadať okruhy',+ 'tours.round.searching': 'Hľadajú sa okruhy',+ 'tours.round.option': 'Okruh {letter}',+ 'tours.round.deviationHint': 'V porovnaní s požadovanými {target}',+ 'tours.round.none':+ 'Odtiaľto žiadny okruh nemá medzi {min} a {max}. Skúste inú vzdialenosť alebo iný východiskový bod.',+ 'tours.round.fewer': 'Odtiaľto k tejto vzdialenosti ďalšie okruhy nesedia.',+ 'tours.round.failed': 'Router neodpovedal alebo odtiaľto nenašiel cestu. Túra zostáva, ako je.',+ 'tours.round.stale': 'Východiskový bod alebo limit sa zmenil. Hľadajte znova.',+ 'tours.round.again': 'Hľadať znova',+ 'tours.round.apply': 'Vziať tento okruh',+ 'tours.round.replaceTitle': 'Nahradiť naplánovanú trasu?',+ 'tours.round.replaceBody': 'Doteraz naplánované body ustúpia tomuto okruhu. Jedno späť ich vráti.',+ 'tours.round.replace': 'Nahradiť',+ 'tours.round.applied': 'Okruh prevzatý','tours.planner.shapeOnLine': 'Kliknutím na trasu v mape tam pridáš tvarovací bod.','tours.paddle.routeOnWater': 'Naplánovať ďalší úsek po vode','tours.paddle.routeAllOnWater': 'Naplánovať ručne kreslené úseky po vode',diff --git a/shared/src/i18n/sv/tours.ts b/shared/src/i18n/sv/tours.tsindex e150a72e1..e17281988 100644--- a/shared/src/i18n/sv/tours.ts+++ b/shared/src/i18n/sv/tours.ts@@ -1027,6 +1027,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Kontrollerar vägen','tours.variants.apply': 'Ta den här vägen','tours.variants.applied': 'Vägen vald',+ 'tours.planner.roundHike': 'Rundtur från starten',+ 'tours.planner.roundHikeFrom': 'Rundtur härifrån',+ 'tours.round.title': 'Rundtur',+ 'tours.round.from': 'Från',+ 'tours.round.start': 'Startpunkt',+ 'tours.round.distance': 'Sträcka',+ 'tours.round.window': '{min} till {max}',+ 'tours.round.windowHint': 'Rundor inom {percent} % av denna sträcka erbjuds',+ 'tours.round.limitHint': 'Rundorna håller sig till turens gräns: {limit}',+ 'tours.round.distanceRange': 'Ange en sträcka från {min} till {max}.',+ 'tours.round.find': 'Hitta rundor',+ 'tours.round.searching': 'Letar efter rundor',+ 'tours.round.option': 'Runda {letter}',+ 'tours.round.deviationHint': 'Jämfört med önskade {target}',+ 'tours.round.none': 'Härifrån ligger ingen runda mellan {min} och {max}. Prova en annan sträcka eller startpunkt.',+ 'tours.round.fewer': 'Fler rundor passar inte denna sträcka härifrån.',+ 'tours.round.failed': 'Routern svarade inte eller hittade ingen väg härifrån. Turen förblir som den är.',+ 'tours.round.stale': 'Startpunkten eller gränsen har ändrats. Sök igen.',+ 'tours.round.again': 'Sök igen',+ 'tours.round.apply': 'Ta den här rundan',+ 'tours.round.replaceTitle': 'Ersätta den planerade rutten?',+ 'tours.round.replaceBody': 'Punkterna som planerats hittills ger plats åt denna runda. En ångra tar tillbaka dem.',+ 'tours.round.replace': 'Ersätt',+ 'tours.round.applied': 'Runda vald','tours.planner.shapeOnLine': 'Klicka på rutten på kartan för att lägga till en formpunkt där.','tours.paddle.routeOnWater': 'Planera nästa etapp på vattnet','tours.paddle.routeAllOnWater': 'Planera handritade etapper på vattnet',diff --git a/shared/src/i18n/th/tours.ts b/shared/src/i18n/th/tours.tsindex 9915944c2..8f1f328b3 100644--- a/shared/src/i18n/th/tours.ts+++ b/shared/src/i18n/th/tours.ts@@ -985,6 +985,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'กำลังตรวจสอบเส้นทาง','tours.variants.apply': 'ใช้เส้นทางนี้','tours.variants.applied': 'ใช้เส้นทางแล้ว',+ 'tours.planner.roundHike': 'เส้นทางวงรอบจากจุดเริ่ม',+ 'tours.planner.roundHikeFrom': 'เส้นทางวงรอบจากตรงนี้',+ 'tours.round.title': 'เดินป่าแบบวงรอบ',+ 'tours.round.from': 'จาก',+ 'tours.round.start': 'จุดเริ่มต้น',+ 'tours.round.distance': 'ระยะทาง',+ 'tours.round.window': '{min} ถึง {max}',+ 'tours.round.windowHint': 'แสดงวงรอบที่อยู่ภายใน {percent} % ของระยะทางนี้',+ 'tours.round.limitHint': 'วงรอบเป็นไปตามขีดจำกัดของทัวร์: {limit}',+ 'tours.round.distanceRange': 'ใส่ระยะทางตั้งแต่ {min} ถึง {max}',+ 'tours.round.find': 'ค้นหาวงรอบ',+ 'tours.round.searching': 'กำลังค้นหาวงรอบ',+ 'tours.round.option': 'วงรอบ {letter}',+ 'tours.round.deviationHint': 'เทียบกับ {target} ที่ต้องการ',+ 'tours.round.none': 'จากตรงนี้ไม่มีวงรอบระหว่าง {min} ถึง {max} ลองระยะทางหรือจุดเริ่มต้นอื่น',+ 'tours.round.fewer': 'จากตรงนี้ไม่มีวงรอบอื่นที่เข้ากับระยะทางนี้',+ 'tours.round.failed': 'เราเตอร์ไม่ตอบหรือหาทางจากตรงนี้ไม่พบ ทัวร์ยังคงเหมือนเดิม',+ 'tours.round.stale': 'จุดเริ่มต้นหรือขีดจำกัดเปลี่ยนไป ค้นหาใหม่อีกครั้ง',+ 'tours.round.again': 'ค้นหาอีกครั้ง',+ 'tours.round.apply': 'ใช้วงรอบนี้',+ 'tours.round.replaceTitle': 'แทนที่เส้นทางที่วางแผนไว้หรือไม่',+ 'tours.round.replaceBody': 'จุดที่วางแผนไว้จนถึงตอนนี้จะถูกแทนที่ด้วยวงรอบนี้ เลิกทำครั้งเดียวก็นำกลับมาได้',+ 'tours.round.replace': 'แทนที่',+ 'tours.round.applied': 'ใช้วงรอบแล้ว','tours.planner.shapeOnLine': 'คลิกเส้นทางบนแผนที่เพื่อเพิ่มจุดกำหนดเส้นทางที่นั่น','tours.paddle.routeOnWater': 'วางแผนช่วงถัดไปบนผืนน้ำ','tours.paddle.routeAllOnWater': 'วางแผนช่วงที่วาดด้วยมือบนผืนน้ำ',diff --git a/shared/src/i18n/tours-locales.spec.ts b/shared/src/i18n/tours-locales.spec.tsindex 3eca4959f..386e08bfc 100644--- a/shared/src/i18n/tours-locales.spec.ts+++ b/shared/src/i18n/tours-locales.spec.ts@@ -20,7 +20,7 @@ const tokens = (value: string) => [...value.matchAll(/\{[^{}]+\}/g)].map((match)// placeholder spec; here only the general keys are.const groups = pluralGroups(Object.keys(english));const generalKeys = (keys: string[]) => keys.filter((key) => !pluralFormOf(key, groups));-const GENERAL_KEY_COUNT = 1039;+const GENERAL_KEY_COUNT = 1063;function literalKeys(source: string): string[] {const tree = ts.createSourceFile('locale.ts', source, ts.ScriptTarget.Latest, true);diff --git a/shared/src/i18n/tr/tours.ts b/shared/src/i18n/tr/tours.tsindex 77f5da6ae..d879226b8 100644--- a/shared/src/i18n/tr/tours.ts+++ b/shared/src/i18n/tr/tours.ts@@ -1036,6 +1036,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Yol kontrol ediliyor','tours.variants.apply': 'Bu yolu kullan','tours.variants.applied': 'Yol alındı',+ 'tours.planner.roundHike': 'Başlangıçtan döngü rotası',+ 'tours.planner.roundHikeFrom': 'Buradan döngü rotası',+ 'tours.round.title': 'Döngü yürüyüşü',+ 'tours.round.from': 'Nereden',+ 'tours.round.start': 'Başlangıç noktası',+ 'tours.round.distance': 'Mesafe',+ 'tours.round.window': '{min} ile {max} arası',+ 'tours.round.windowHint': 'Bu mesafenin %{percent} kadar yakınındaki turlar sunulur',+ 'tours.round.limitHint': 'Turlar rotanın sınırına uyar: {limit}',+ 'tours.round.distanceRange': '{min} ile {max} arasında bir mesafe girin.',+ 'tours.round.find': 'Tur bul',+ 'tours.round.searching': 'Turlar aranıyor',+ 'tours.round.option': 'Tur {letter}',+ 'tours.round.deviationHint': 'İstenen {target} ile karşılaştırıldığında',+ 'tours.round.none': 'Buradan {min} ile {max} arasında tur yok. Başka bir mesafe ya da başlangıç noktası deneyin.',+ 'tours.round.fewer': 'Buradan bu mesafeye uyan başka tur yok.',+ 'tours.round.failed': 'Yönlendirici yanıt vermedi ya da buradan yol bulamadı. Rota olduğu gibi kalır.',+ 'tours.round.stale': 'Başlangıç noktası ya da sınır değişti. Yeniden arayın.',+ 'tours.round.again': 'Yeniden ara',+ 'tours.round.apply': 'Bu turu al',+ 'tours.round.replaceTitle': 'Planlanan rota değiştirilsin mi?',+ 'tours.round.replaceBody': 'Şimdiye kadar planlanan noktalar bu tura yer açar. Bir geri alma onları geri getirir.',+ 'tours.round.replace': 'Değiştir',+ 'tours.round.applied': 'Tur alındı','tours.planner.shapeOnLine': 'Oraya bir şekil noktası eklemek için haritadaki rotaya tıkla.','tours.paddle.routeOnWater': 'Sonraki bölümü suda planla','tours.paddle.routeAllOnWater': 'Elle çizilen bölümleri suda planla',diff --git a/shared/src/i18n/uk/tours.ts b/shared/src/i18n/uk/tours.tsindex e6e069c9d..6826b9c09 100644--- a/shared/src/i18n/uk/tours.ts+++ b/shared/src/i18n/uk/tours.ts@@ -1069,6 +1069,30 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Шлях перевіряється','tours.variants.apply': 'Обрати цей шлях','tours.variants.applied': 'Шлях прийнято',+ 'tours.planner.roundHike': 'Кільцевий маршрут від старту',+ 'tours.planner.roundHikeFrom': 'Кільцевий маршрут звідси',+ 'tours.round.title': 'Кільцевий похід',+ 'tours.round.from': 'Від',+ 'tours.round.start': 'Точка старту',+ 'tours.round.distance': 'Відстань',+ 'tours.round.window': 'від {min} до {max}',+ 'tours.round.windowHint': 'Пропонуються кільця в межах {percent} % від цієї відстані',+ 'tours.round.limitHint': 'Кільця дотримуються ліміту туру: {limit}',+ 'tours.round.distanceRange': 'Введіть відстань від {min} до {max}.',+ 'tours.round.find': 'Знайти кільця',+ 'tours.round.searching': 'Триває пошук кілець',+ 'tours.round.option': 'Кільце {letter}',+ 'tours.round.deviationHint': 'Порівняно з бажаними {target}',+ 'tours.round.none': 'Звідси немає кільця від {min} до {max}. Спробуйте іншу відстань або іншу точку старту.',+ 'tours.round.fewer': 'Звідси більше кілець під цю відстань немає.',+ 'tours.round.failed': 'Маршрутизатор не відповів або не знайшов звідси шляху. Тур лишається без змін.',+ 'tours.round.stale': 'Точка старту або ліміт змінилися. Повторіть пошук.',+ 'tours.round.again': 'Шукати знову',+ 'tours.round.apply': 'Взяти це кільце',+ 'tours.round.replaceTitle': 'Замінити запланований маршрут?',+ 'tours.round.replaceBody': 'Заплановані досі точки поступаються місцем цьому кільцю. Одне скасування поверне їх.',+ 'tours.round.replace': 'Замінити',+ 'tours.round.applied': 'Кільце вибрано','tours.planner.shapeOnLine': 'Натисніть на маршрут на мапі, щоб додати там точку форми.','tours.paddle.routeOnWater': 'Прокласти наступну ділянку по воді','tours.paddle.routeAllOnWater': 'Прокласти по воді ділянки, намальовані вручну',diff --git a/shared/src/i18n/vi/tours.ts b/shared/src/i18n/vi/tours.tsindex f6ba56e50..17b61ea28 100644--- a/shared/src/i18n/vi/tours.ts+++ b/shared/src/i18n/vi/tours.ts@@ -1021,6 +1021,31 @@ const tours: TranslationStrings = {'tours.variants.checking': 'Đang kiểm tra lối đi','tours.variants.apply': 'Dùng lối đi này','tours.variants.applied': 'Đã dùng lối đi',+ 'tours.planner.roundHike': 'Vòng đi bộ từ điểm xuất phát',+ 'tours.planner.roundHikeFrom': 'Vòng đi bộ từ đây',+ 'tours.round.title': 'Đi bộ đường vòng',+ 'tours.round.from': 'Từ',+ 'tours.round.start': 'Điểm xuất phát',+ 'tours.round.distance': 'Khoảng cách',+ 'tours.round.window': '{min} đến {max}',+ 'tours.round.windowHint': 'Các vòng trong phạm vi {percent} % của khoảng cách này được đề xuất',+ 'tours.round.limitHint': 'Các vòng tuân theo giới hạn của tour: {limit}',+ 'tours.round.distanceRange': 'Nhập khoảng cách từ {min} đến {max}.',+ 'tours.round.find': 'Tìm vòng',+ 'tours.round.searching': 'Đang tìm vòng',+ 'tours.round.option': 'Vòng {letter}',+ 'tours.round.deviationHint': 'So với {target} mong muốn',+ 'tours.round.none': 'Từ đây không có vòng nào dài từ {min} đến {max}. Hãy thử khoảng cách hoặc điểm xuất phát khác.',+ 'tours.round.fewer': 'Từ đây không còn vòng nào khác hợp với khoảng cách này.',+ 'tours.round.failed': 'Bộ định tuyến không trả lời hoặc không tìm thấy đường từ đây. Tour giữ nguyên.',+ 'tours.round.stale': 'Điểm xuất phát hoặc giới hạn đã thay đổi. Hãy tìm lại.',+ 'tours.round.again': 'Tìm lại',+ 'tours.round.apply': 'Chọn vòng này',+ 'tours.round.replaceTitle': 'Thay thế tuyến đường đã lên kế hoạch?',+ 'tours.round.replaceBody':+ 'Các điểm đã lên kế hoạch đến nay nhường chỗ cho vòng này. Một lần hoàn tác sẽ đưa chúng trở lại.',+ 'tours.round.replace': 'Thay thế',+ 'tours.round.applied': 'Đã chọn vòng','tours.planner.shapeOnLine': 'Nhấp vào tuyến đường trên bản đồ để thêm điểm định hình tại đó.','tours.paddle.routeOnWater': 'Lập chặng tiếp theo trên mặt nước','tours.paddle.routeAllOnWater': 'Lập trên mặt nước các chặng vẽ tay',diff --git a/shared/src/i18n/zh-TW/tours.ts b/shared/src/i18n/zh-TW/tours.tsindex 1d13c1f23..8c73d882e 100644--- a/shared/src/i18n/zh-TW/tours.ts+++ b/shared/src/i18n/zh-TW/tours.ts@@ -952,6 +952,30 @@ const tours: TranslationStrings = {'tours.variants.checking': '正在核實道路','tours.variants.apply': '採用這條道路','tours.variants.applied': '已採用道路',+ 'tours.planner.roundHike': '從起點規劃環線',+ 'tours.planner.roundHikeFrom': '從這裡規劃環線',+ 'tours.round.title': '環線健行',+ 'tours.round.from': '起點',+ 'tours.round.start': '出發點',+ 'tours.round.distance': '距離',+ 'tours.round.window': '{min} 至 {max}',+ 'tours.round.windowHint': '提供與此距離相差 {percent} % 以內的環線',+ 'tours.round.limitHint': '環線遵守路線的難度上限:{limit}',+ 'tours.round.distanceRange': '請輸入 {min} 至 {max} 的距離。',+ 'tours.round.find': '尋找環線',+ 'tours.round.searching': '正在尋找環線',+ 'tours.round.option': '環線 {letter}',+ 'tours.round.deviationHint': '與期望的 {target} 相比',+ 'tours.round.none': '從這裡沒有 {min} 至 {max} 的環線。請換一個距離或出發點。',+ 'tours.round.fewer': '從這裡沒有更多符合此距離的環線。',+ 'tours.round.failed': '路由器沒有回應,或從這裡找不到路。路線保持不變。',+ 'tours.round.stale': '出發點或上限已變更。請重新尋找。',+ 'tours.round.again': '重新尋找',+ 'tours.round.apply': '選用此環線',+ 'tours.round.replaceTitle': '取代已規劃的路線?',+ 'tours.round.replaceBody': '目前規劃的點將讓位給此環線。復原一次即可恢復。',+ 'tours.round.replace': '取代',+ 'tours.round.applied': '已選用環線','tours.planner.shapeOnLine': '點選地圖上的路線即可在該處新增塑形點。','tours.paddle.routeOnWater': '沿水路規劃下一段','tours.paddle.routeAllOnWater': '沿水路規劃手繪的路段',diff --git a/shared/src/i18n/zh/tours.ts b/shared/src/i18n/zh/tours.tsindex c55739dd7..6c0878a4b 100644--- a/shared/src/i18n/zh/tours.ts+++ b/shared/src/i18n/zh/tours.ts@@ -953,6 +953,30 @@ const tours: TranslationStrings = {'tours.variants.checking': '正在核实道路','tours.variants.apply': '采用这条道路','tours.variants.applied': '已采用道路',+ 'tours.planner.roundHike': '从起点规划环线',+ 'tours.planner.roundHikeFrom': '从这里规划环线',+ 'tours.round.title': '环线徒步',+ 'tours.round.from': '起点',+ 'tours.round.start': '出发点',+ 'tours.round.distance': '距离',+ 'tours.round.window': '{min} 至 {max}',+ 'tours.round.windowHint': '提供与此距离相差 {percent} % 以内的环线',+ 'tours.round.limitHint': '环线遵守路线的难度上限:{limit}',+ 'tours.round.distanceRange': '请输入 {min} 至 {max} 的距离。',+ 'tours.round.find': '查找环线',+ 'tours.round.searching': '正在查找环线',+ 'tours.round.option': '环线 {letter}',+ 'tours.round.deviationHint': '与期望的 {target} 相比',+ 'tours.round.none': '从这里没有 {min} 至 {max} 的环线。请换一个距离或出发点。',+ 'tours.round.fewer': '从这里没有更多符合此距离的环线。',+ 'tours.round.failed': '路由器没有响应,或从这里找不到路。路线保持不变。',+ 'tours.round.stale': '出发点或上限已更改。请重新查找。',+ 'tours.round.again': '重新查找',+ 'tours.round.apply': '选用此环线',+ 'tours.round.replaceTitle': '替换已规划的路线?',+ 'tours.round.replaceBody': '目前规划的点将让位于此环线。撤销一次即可恢复。',+ 'tours.round.replace': '替换',+ 'tours.round.applied': '已选用环线','tours.planner.shapeOnLine': '点击地图上的路线即可在该处添加塑形点。','tours.paddle.routeOnWater': '沿水路规划下一段','tours.paddle.routeAllOnWater': '沿水路规划手绘的路段',