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): compare other ways for one section of a hike (RTE-02)
Maurice64445a520409
diff --git a/client/src/components/Map/valhallaRoute.test.ts b/client/src/components/Map/valhallaRoute.test.tsindex 2182a8eec..a6acc53e1 100644--- a/client/src/components/Map/valhallaRoute.test.ts+++ b/client/src/components/Map/valhallaRoute.test.ts@@ -519,6 +519,23 @@ describe('valhallaAlternates', () => {expect(bodies[1]).not.toHaveProperty('alternates')})+ it('VALHALLA-ALT-005: a section of a hike is offered ways on foot under its own limit and preferences (RTE-02)', async () => {+ const bodies: Record<string, unknown>[] = []+ server.use(http.post(FOSSGIS_VALHALLA, async ({ request }) => {+ bodies.push(await request.json() as Record<string, unknown>)+ return HttpResponse.json(withAlternates([answer({ time: 12_000 })]))+ }))++ const ways = await valhallaAlternates(HAMBURG, BERLIN, 'walking', [], 3, undefined, { max_hiking_difficulty: 4, use_hills: 0.2 })++ expect(ways).toHaveLength(2)+ expect(bodies[0]).toMatchObject({+ alternates: 3,+ costing: 'pedestrian',+ costing_options: { pedestrian: { max_hiking_difficulty: 4, use_hills: 0.2 } },+ })+ })+it('VALHALLA-ALT-004: a refusal is asked once more, then is no answer; an instance with its own OSRM asks nothing', async () => {let calls = 0server.use(http.post(FOSSGIS_VALHALLA, () => { calls++; return new HttpResponse(null, { status: 429 }) }))diff --git a/client/src/components/Map/valhallaRoute.ts b/client/src/components/Map/valhallaRoute.tsindex 30cf31b91..d114047bf 100644--- a/client/src/components/Map/valhallaRoute.ts+++ b/client/src/components/Map/valhallaRoute.ts@@ -460,6 +460,8 @@ async function requestRun(* quickest road beside a day Valhalla had routed was offered as the faster way, and* taking it changed nothing. Valhalla answers `alternates` between exactly two locations,* which is all one leg is, and weighs every one of them the way it weighed the day.+ * `costingOptions` carries the rest of how that day was weighed, such as a hike's limit+ * and preferences (RTE-02), so a section of a tour is offered ways under its own rules.*/export async function valhallaAlternates(from: Waypoint,@@ -468,10 +470,11 @@ export async function valhallaAlternates(avoid: readonly AvoidClass[],count: number,signal?: AbortSignal,+ costingOptions: Readonly<CostingOptions> = {},): Promise<ValhallaLeg[] | null> {const base = valhallaBase()if (!base || notValhalla.has(base)) return null- const body = { ...routeBody([from, to], profile, avoid), ...(count > 0 ? { alternates: count } : {}) }+ const body = { ...routeBody([from, to], profile, avoid, costingOptions), ...(count > 0 ? { alternates: count } : {}) }return askWithRetry(base, async () => {const data = await postRoute(base, body, signal)return data === null ? null : alternatesFrom(data)diff --git a/client/src/components/Tours/planner/LegVariantsCard.test.tsx b/client/src/components/Tours/planner/LegVariantsCard.test.tsxnew file mode 100644index 000000000..c056884de--- /dev/null+++ b/client/src/components/Tours/planner/LegVariantsCard.test.tsx@@ -0,0 +1,173 @@+// FE-TOUR-LEG-VARIANTS-CARD-001 to FE-TOUR-LEG-VARIANTS-CARD-007: the card that compares the ways+// of a hike's section over the planner map (RTE-02).+import userEvent from '@testing-library/user-event';+import { beforeEach, describe, expect, it, vi } from 'vitest';+import { fireEvent, render, screen, within } from '../../../../tests/helpers/render';+import { seedStore } from '../../../../tests/helpers/store';+import { idleLegVariants } from '../../../../tests/helpers/tourPlannerStub';+import { useSettingsStore } from '../../../store/settingsStore';+import LegVariantsOverlay, { LegVariantsCard } from './LegVariantsCard';+import type { LegVariant } from './legVariants';+import type { LegComparison } from './useLegVariants';+import type { TourPlannerController } from './useTourPlanner';++const POINTS = [+ { id: 'a', lat: 47, lng: 11, role: 'start' as const },+ { id: 's', lat: 47.001, lng: 11.01, role: 'via' as const, shaping: true },+ { id: 'b', lat: 47, lng: 11.02, role: 'end' as const },+];++const way = (key: LegVariant['key'], overrides: Partial<LegVariant> = {}): LegVariant => ({+ key,+ current: key === 'current',+ direct: false,+ coordinates: [+ [47, 11],+ [47, 11.02],+ ],+ distanceM: 1500,+ gainM: 120,+ lossM: 40,+ minutes: 35,+ heights: 'known',+ ...overrides,+});++function comparison(overrides: Partial<LegComparison> = {}): LegComparison {+ return {+ leg: {+ fromId: 'a',+ toId: 's',+ from: { lat: 47, lng: 11 },+ to: { lat: 47.001, lng: 11.01 },+ costing: { max_hiking_difficulty: 2 },+ key: 'a>s',+ },+ phase: 'choose',+ variants: [way('current'), way('a', { distanceM: 1900, gainM: 180, minutes: 47 })],+ selected: null,+ proving: false,+ notice: null,+ ...overrides,+ };+}++type CardPlanner = Pick<TourPlannerController, 'waypoints' | 'legVariants' | 'canEdit' | 'isSaving'>;++function planner(open: LegComparison | null, overrides: Partial<CardPlanner> = {}): CardPlanner {+ return {+ waypoints: POINTS,+ legVariants: { ...idleLegVariants(), comparison: open },+ canEdit: true,+ isSaving: false,+ ...overrides,+ } as unknown as CardPlanner;+}++function renderCard(open: LegComparison, overrides: Partial<CardPlanner> = {}) {+ const controller = planner(open, overrides);+ render(<LegVariantsCard planner={controller} comparison={open} />);+ return controller.legVariants;+}++beforeEach(() => {+ seedStore(useSettingsStore, { settings: { distance_unit: 'metric' } });+});++describe('LegVariantsCard', () => {+ it('FE-TOUR-LEG-VARIANTS-CARD-001: names the section by its ends and lists each way with its figures', () => {+ renderCard(comparison());+ const card = screen.getByTestId('leg-variants-card');+ expect(within(card).getByRole('heading', { name: 'Other ways for this section' })).toBeInTheDocument();+ expect(within(card).getByLabelText('Section from Waypoint 1 to Shaping point')).toBeInTheDocument();+ const [current, other] = within(card).getAllByRole('radio');+ expect(current).toHaveAccessibleName('Current way');+ expect(other).toHaveAccessibleName('Way A');+ expect(within(current).getByText('1.5 km')).toBeInTheDocument();+ expect(within(current).getByText('120 m')).toBeInTheDocument();+ expect(within(current).getByText('40 m')).toBeInTheDocument();+ // How the other way differs: longer, more climb, more time; the way taken now has no difference to show.+ const delta = within(other).getByTestId('leg-variant-delta');+ expect(delta).toHaveTextContent('+400 m');+ expect(delta).toHaveTextContent('+60 m');+ expect(delta).toHaveTextContent('+12 min');+ expect(within(current).queryByTestId('leg-variant-delta')).not.toBeInTheDocument();+ });++ it('FE-TOUR-LEG-VARIANTS-CARD-002: heights still asked for turn, heights not to be had stay unknown, never a guess', () => {+ renderCard(+ comparison({+ variants: [+ way('current', { gainM: null, lossM: null, minutes: null, heights: 'unknown' }),+ way('a', { gainM: null, lossM: null, minutes: null, heights: 'pending', distanceM: 1400 }),+ ],+ })+ );+ const [current, other] = screen.getAllByRole('radio');+ expect(within(current).getAllByText('Unknown')).toHaveLength(3);+ expect(within(other).getAllByLabelText('Heights are being looked up')).toHaveLength(3);+ // Only the length is known on both, so only it is compared.+ expect(within(other).getByTestId('leg-variant-delta')).toHaveTextContent('−100 m');+ });++ it('FE-TOUR-LEG-VARIANTS-CARD-003: choosing marks a way; taking it is a separate, explicit step', async () => {+ const actions = renderCard(comparison());+ const apply = screen.getByTestId('leg-variants-apply');+ expect(apply).toBeDisabled();+ await userEvent.click(screen.getByRole('radio', { name: 'Way A' }));+ expect(actions.select).toHaveBeenCalledWith('a');+ expect(actions.apply).not.toHaveBeenCalled();+ fireEvent.mouseEnter(screen.getByRole('radio', { name: 'Way A' }));+ expect(actions.hover).toHaveBeenLastCalledWith('a');+ fireEvent.mouseLeave(screen.getByRole('radio', { name: 'Way A' }));+ expect(actions.hover).toHaveBeenLastCalledWith(null);+ });++ it('FE-TOUR-LEG-VARIANTS-CARD-004: a chosen other way can be taken; the way taken now and a locked tour cannot', async () => {+ const actions = renderCard(comparison({ selected: 'a' }));+ expect(screen.getByRole('radio', { name: 'Way A' })).toHaveAttribute('aria-checked', 'true');+ await userEvent.click(screen.getByRole('button', { name: 'Take this way' }));+ expect(actions.apply).toHaveBeenCalledTimes(1);++ renderCard(comparison({ selected: 'current' }));+ expect(screen.getAllByTestId('leg-variants-apply').at(-1)).toBeDisabled();+ renderCard(comparison({ selected: 'a' }), { isSaving: true });+ expect(screen.getAllByTestId('leg-variants-apply').at(-1)).toBeDisabled();+ });++ it('FE-TOUR-LEG-VARIANTS-CARD-005: while a choice is checked the list stands still and the button says what happens', async () => {+ const actions = renderCard(comparison({ selected: 'a', proving: true }));+ expect(screen.getByTestId('leg-variants-apply')).toHaveTextContent('Checking the way');+ expect(screen.getByTestId('leg-variants-apply')).toBeDisabled();+ await userEvent.click(screen.getByRole('radio', { name: 'Current way' }));+ expect(actions.select).not.toHaveBeenCalled();+ });++ it('FE-TOUR-LEG-VARIANTS-CARD-006: says what it is doing and why nothing changed', () => {+ renderCard(comparison({ phase: 'loading', variants: [way('current')] }));+ expect(screen.getByRole('status')).toHaveTextContent('Looking for other ways');+ renderCard(comparison({ phase: 'none', variants: [way('current')] }));+ expect(screen.getAllByRole('status').at(-1)).toHaveTextContent('The router knows no other way');+ renderCard(comparison({ phase: 'failed', variants: [way('current')] }));+ expect(screen.getAllByRole('status').at(-1)).toHaveTextContent('The router did not answer');+ renderCard(comparison({ notice: 'notHeld' }));+ expect(screen.getAllByRole('status').at(-1)).toHaveTextContent('The router does not keep to this way');+ renderCard(comparison({ notice: 'stale' }));+ expect(screen.getAllByRole('status').at(-1)).toHaveTextContent('The tour changed in the meantime');+ renderCard(comparison({ notice: 'failed' }));+ expect(screen.getAllByRole('status').at(-1)).toHaveTextContent('This way could not be checked');+ });++ it('FE-TOUR-LEG-VARIANTS-CARD-007: the overlay shows only while a section is compared; cancel, the cross and Escape close it', async () => {+ const { rerender } = render(<LegVariantsOverlay planner={planner(null)} insetEnd={12} bottom={66} />);+ expect(screen.queryByTestId('leg-variants-overlay')).not.toBeInTheDocument();++ const open = planner(comparison());+ rerender(<LegVariantsOverlay planner={open} insetEnd={12} bottom={66} />);+ expect(screen.getByTestId('leg-variants-overlay').style.bottom).toBe('66px');+ await userEvent.click(screen.getByRole('button', { name: 'Cancel' }));+ await userEvent.click(screen.getByRole('button', { name: 'Close' }));+ fireEvent.keyDown(document, { key: 'Escape' });+ expect(open.legVariants.close).toHaveBeenCalledTimes(3);+ });+});diff --git a/client/src/components/Tours/planner/LegVariantsCard.tsx b/client/src/components/Tours/planner/LegVariantsCard.tsxnew file mode 100644index 000000000..c688ea449--- /dev/null+++ b/client/src/components/Tours/planner/LegVariantsCard.tsx@@ -0,0 +1,402 @@+import {+ AlertTriangle,+ ArrowRight,+ Check,+ Clock,+ Loader2,+ MoveHorizontal,+ Route,+ Shuffle,+ TrendingDown,+ TrendingUp,+ X,+} from 'lucide-react';+import { useEffect, type ReactNode } from '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 { Tooltip } from '../../shared/Tooltip';+import { TourNotice } from '../tourParts';+import { variantPaintCss } from './legVariantPaint';+import { variantDelta, type LegVariant } from './legVariants';+import { formatTourDuration } from './tourDurationInput';+import { stopNumbersOf } from './tourPlannerWaypoints';+import type { LegComparison } from './useLegVariants';+import type { TourPlannerController } from './useTourPlanner';++type Translate = ReturnType<typeof useTranslation>['t'];++/** A signed difference: a plus for more, a minus sign for fewer, nothing for none worth printing. */+function signed(value: number, format: (absolute: number) => string): string | null {+ const text = format(Math.abs(value));+ if (Math.abs(value) < 1e-9 || /^0\s/.test(text)) return null;+ return `${value > 0 ? '+' : '−'}${text}`;+}++/** An end of the section by name: the stop by its number, else the shaping point it is. */+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,+ current,+ unit,+ t,+}: {+ variant: LegVariant;+ current: LegVariant;+ unit: DistanceUnit;+ t: Translate;+}) {+ const delta = variantDelta(variant, current);+ const parts = [+ { key: 'distance', Icon: MoveHorizontal, text: signed(delta.distanceM / 1000, (km) => formatDistance(km, unit)) },+ {+ key: 'ascent',+ Icon: TrendingUp,+ text: delta.gainM === null ? null : signed(delta.gainM, (meters) => formatElevation(meters, unit)),+ },+ { key: 'time', Icon: Clock, text: delta.minutes === null ? null : signed(delta.minutes, formatTourDuration) },+ ].filter((part) => part.text !== null);+ if (parts.length === 0) return null;+ return (+ <Tooltip label={t('tours.variants.deltaHint')}>+ <span className="flex flex-wrap gap-1" data-testid="leg-variant-delta">+ {parts.map(({ key, Icon, text }) => (+ <SoftPill key={key} icon={<Icon size={10} strokeWidth={2.2} aria-hidden="true" />}>+ <span className="tabular-nums">{text}</span>+ </SoftPill>+ ))}+ </span>+ </Tooltip>+ );+}++/** One way as a choice in the list: its mark, its figures, and how it differs from the way taken now. */+function VariantRow({+ variant,+ current,+ chosen,+ disabled,+ unit,+ onSelect,+ onHover,+}: {+ variant: LegVariant;+ current: LegVariant;+ chosen: boolean;+ disabled: boolean;+ unit: DistanceUnit;+ onSelect: () => void;+ onHover: (on: boolean) => void;+}) {+ const { t } = useTranslation();+ const name = variant.current+ ? 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>+ );+}++/** What the card says besides the ways: that it is asking, that there is nothing to choose, or why a choice changed nothing. */+function ComparisonNotice({ comparison, t }: { comparison: LegComparison; t: Translate }) {+ if (comparison.phase === 'loading') {+ return (+ <TourNotice role="status" icon={<Loader2 size={13} className="animate-spin" aria-hidden="true" />}>+ {t('tours.variants.loading')}+ </TourNotice>+ );+ }+ const warning =+ comparison.notice !== null+ ? t(`tours.variants.notice.${comparison.notice}`)+ : comparison.phase === 'failed'+ ? t('tours.variants.failed')+ : null;+ if (warning) {+ return (+ <TourNotice role="status" tone="warning" icon={<AlertTriangle size={13} aria-hidden="true" />}>+ {warning}+ </TourNotice>+ );+ }+ return comparison.phase === 'none' ? <TourNotice role="status">{t('tours.variants.none')}</TourNotice> : null;+}++/**+ * RTE-02: the ways a routed section of a hike can take, side by side in the+ * look of the other cards over the planner map. Each row is drawn on the map+ * in its colour; pointing at one lights its line up. Choosing one only marks+ * it: the route changes on the button, after the router was asked whether it+ * keeps to that way, and closing leaves everything as it was.+ */+export function LegVariantsCard({+ planner,+ comparison,+ width,+}: {+ planner: Pick<TourPlannerController, 'waypoints' | 'legVariants' | 'canEdit' | 'isSaving'>;+ comparison: LegComparison;+ width?: number;+}) {+ const { t } = useTranslation();+ const unit = useSettingsStore((state) => state.settings.distance_unit) ?? 'metric';+ const { select, hover, apply, close } = planner.legVariants;+ const stops = stopNumbersOf(planner.waypoints);+ const from = stops.get(comparison.leg.fromId);+ const to = stops.get(comparison.leg.toId);+ const current = comparison.variants.find((variant) => variant.current) ?? comparison.variants[0];+ const chosen = comparison.variants.find((variant) => variant.key === comparison.selected);+ 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"+ >+ <X size={14} aria-hidden="true" />+ </button>+ </div>+ <div role="radiogroup" aria-label={t('tours.variants.title')} className="flex flex-col gap-1.5">+ {comparison.variants.map((variant) => (+ <VariantRow+ key={variant.key}+ variant={variant}+ current={current}+ chosen={variant.key === comparison.selected}+ disabled={comparison.proving}+ unit={unit}+ onSelect={() => select(variant.key)}+ onHover={(on) => hover(on ? variant.key : null)}+ />+ ))}+ </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>+ );+}++/**+ * 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.+ */+export default function LegVariantsOverlay({+ planner,+ insetEnd,+ bottom,+ width,+}: {+ planner: Pick<TourPlannerController, 'waypoints' | 'legVariants' | 'canEdit' | 'isSaving'>;+ insetEnd: number;+ bottom: number;+ 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"+ >+ <LegVariantsCard planner={planner} comparison={comparison} width={width} />+ </div>+ );+}diff --git a/client/src/components/Tours/planner/TourWaypointList.test.tsx b/client/src/components/Tours/planner/TourWaypointList.test.tsxindex 5e03704bd..7d0694fda 100644--- a/client/src/components/Tours/planner/TourWaypointList.test.tsx+++ b/client/src/components/Tours/planner/TourWaypointList.test.tsx@@ -1,13 +1,13 @@-// FE-TOUR-WAYPOINT-LIST-001 to FE-TOUR-WAYPOINT-LIST-011: 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-// (P2A-03, P2A-05, PAD-11, CW-01, CW-02, CW-04).+// 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).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 } from '../../../../tests/helpers/tourPlannerStub';+import { hikePlannerDefaults, idleLegVariants } from '../../../../tests/helpers/tourPlannerStub';import { useSettingsStore } from '../../../store/settingsStore';import { useTripStore } from '../../../store/tripStore';import type { PaddleTourRoute } from './paddleRouting';@@ -252,6 +252,41 @@ describe('TourWaypointList', () => {expect(screen.queryByRole('button', { name: 'Edit stop' })).not.toBeInTheDocument();});+ it('FE-TOUR-WAYPOINT-LIST-012: a hike offers other ways for a routed leg, dimmed while it cannot be compared (RTE-02)', async () => {+ const legVariants = { ...idleLegVariants(), canCompare: vi.fn((id: string) => id === 'a') };+ const controller = planner({ legVariants });+ render(<TourWaypointList planner={controller} canEdit isSaving={false} />);+ const rows = screen.getAllByTestId('tour-planner-waypoint-row');+ await userEvent.click(within(at(rows, 0)).getByRole('button', { name: 'More actions' }));+ await userEvent.click(screen.getByRole('button', { name: 'Compare ways for the next leg' }));+ expect(legVariants.compare).toHaveBeenCalledWith('a');++ await userEvent.click(within(at(rows, 2)).getByRole('button', { name: 'More actions' }));+ expect(screen.getByRole('button', { name: 'Compare ways for the next leg' })).toBeDisabled();+ // The last point has no leg to compare.+ await userEvent.click(within(at(rows, 3)).getByRole('button', { name: 'More actions' }));+ expect(screen.queryByRole('button', { name: 'Compare ways for the next leg' })).not.toBeInTheDocument();+ });++ it('FE-TOUR-WAYPOINT-LIST-013: a bike tour and a leg drawn by hand offer no other ways (RTE-02)', async () => {+ const legVariants = { ...idleLegVariants(), canCompare: vi.fn(() => true) };+ const bike = planner({ legVariants, tourType: 'bike' });+ const { unmount } = render(<TourWaypointList planner={bike} canEdit isSaving={false} />);+ await userEvent.click(+ within(at(screen.getAllByTestId('tour-planner-waypoint-row'), 0)).getByRole('button', { name: 'More actions' })+ );+ expect(screen.queryByRole('button', { name: 'Compare ways for the next leg' })).not.toBeInTheDocument();+ unmount();++ const drawn = { ...START, fixedLeg: { kind: 'free' as const, geometry: [] } };+ const hike = planner({ legVariants, waypoints: [drawn, STOP, END] });+ render(<TourWaypointList planner={hike} canEdit isSaving={false} />);+ await userEvent.click(+ within(at(screen.getAllByTestId('tour-planner-waypoint-row'), 0)).getByRole('button', { name: 'More actions' })+ );+ expect(screen.queryByRole('button', { name: 'Compare ways for the next leg' })).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 5d8f55fb0..89578ffa8 100644--- a/client/src/components/Tours/planner/TourWaypointList.tsx+++ b/client/src/components/Tours/planner/TourWaypointList.tsx@@ -11,6 +11,7 @@ import {Navigation,RefreshCw,Repeat,+ Shuffle,Spline,SquarePen,Trash2,@@ -45,6 +46,7 @@ import { paddlePlanPoints, paddleRolesById } from './paddlePlanOf';import { StationDialog } from './StationDialog';import { stationMarkNote, stationRingClass } from './stationMarks';import { StationPills, StationShield } from './stationParts';+import { stopNumbersOf } from './tourPlannerWaypoints';import { TripPlacePicker } from './TripPlacePicker';import type { TourPlannerController } from './useTourPlanner';import { useTripPlaceWaypoints } from './useTripPlaceWaypoints';@@ -354,9 +356,10 @@ type WaypointPoint = TourPlannerController['waypoints'][number];/*** The tools for the leg after a point: drawn by hand or routed (on a paddle- * tour: on the water), planned again (P2A-05), and the point a stop or a- * shaping point (P2A-03; never the first or the last). A ride (HOR-01) has- * none: no router plans any of its legs, so there is nothing to switch.+ * tour: on the water), planned again (P2A-05), other ways for it compared on+ * a hike (RTE-02), and the point a stop or a shaping point (P2A-03; never the+ * first or the last). A ride (HOR-01) has none: no router plans any of its+ * legs, so there is nothing to switch.*/function routeMenuItems(planner: TourPlannerController,@@ -387,6 +390,14 @@ function routeMenuItems(icon: RefreshCw,onClick: () => planner.recomputeLeg(point.id),});+ // RTE-02: a hike's routed section offered other ways; dimmed while its route is still being planned.+ if (routed && planner.tourType === 'hike')+ items.push({+ label: t('tours.planner.compareLeg'),+ icon: Shuffle,+ disabled: !planner.legVariants.canCompare(point.id),+ onClick: () => planner.legVariants.compare(point.id),+ });if (index > 0 && index < lastIndex) {items.push({label: t(point.shaping ? 'tours.planner.makeStop' : 'tours.planner.makeShaping'),@@ -584,13 +595,6 @@ function ShapeOnLineHint({ planner, canEdit }: { planner: TourPlannerController;);}-/** Stops are numbered on their own, as on the map: a shaping point (P2A-03) takes no number. */-function stopNumbersOf(points: ReadonlyArray<WaypointPoint>): Map<string, number> {- const numbers = new Map<string, number>();- for (const point of points) if (!point.shaping) numbers.set(point.id, numbers.size + 1);- return numbers;-}-/** The route tools in the card head: reverse, plan the drawn legs on the water (PAD-11), back to the start. */function WaypointListTools({ planner, isSaving }: { planner: TourPlannerController; isSaving: boolean }) {const { t } = useTranslation();diff --git a/client/src/components/Tours/planner/hikingCosting.ts b/client/src/components/Tours/planner/hikingCosting.tsnew file mode 100644index 000000000..3ebe6dda4--- /dev/null+++ b/client/src/components/Tours/planner/hikingCosting.ts@@ -0,0 +1,45 @@+import type { HikingPreferences } from '@trek/shared';+import type { CostingOptions } from '../../Map/valhallaRoute';++/**+ * Defensive fallback only. Normal planner calls pass the persisted/draft value.+ * TREK exposes 1..6 and never exposes Valhalla's internal 0.+ */+export const TOURS_MAX_HIKING_DIFFICULTY = 2;++/**+ * MF-08, RTE-01: a hike's preferences as Valhalla's pedestrian costing+ * options. Each one was checked against the public instance before it was+ * offered, and is a weighting that gives way where there is no other path:+ * - avoid_climbs, `use_hills` 0.2: Freiburg Martinstor to the Schlossberg went+ * from 1.64 km with a 37 % pitch and 30 m over 25 % to 1.73 km whose steepest+ * stretch is 23 % (heights every 30 m). It weighs the grade, not the climb in+ * sum: the same height is still gained. 0.1 and below sent Garmisch station+ * to the Eckbauer round a 10 km detour with more steep metres, 0.25 and up+ * left Freiburg as it was; 0.2 does neither.+ * - avoid_steps, `step_penalty` 600 s: Würzburg Altstadt to the Festung went+ * from four flights of steps over 1.49 km to one over 2.67 km.+ * - avoid_ferries, `use_ferry` 0: Kiel Reventlou to Dietrichsdorf went from the+ * Förde ferry (2.7 km) round the fjord on land (8.3 km); Hamburg+ * Landungsbrücken to Steinwerder through the old Elbe tunnel instead of the ferry.+ * The router has no option for marked, paved or rough ways on foot.+ */+export function hikingCostingOptions(preferences: HikingPreferences | null | undefined): Record<string, number> {+ return {+ ...(preferences?.avoid_climbs ? { use_hills: 0.2 } : {}),+ ...(preferences?.avoid_steps ? { step_penalty: 600 } : {}),+ ...(preferences?.avoid_ferries ? { use_ferry: 0 } : {}),+ };+}++/**+ * Everything a hike asks the pedestrian costing for: its limit and its+ * preferences. One reading for the whole tour and for the ways offered for one+ * of its sections (RTE-02), so both are weighed by the same rules.+ */+export function hikingCosting(+ maxHikingDifficulty: number = TOURS_MAX_HIKING_DIFFICULTY,+ preferences: HikingPreferences | null = null+): CostingOptions {+ return { max_hiking_difficulty: maxHikingDifficulty, ...hikingCostingOptions(preferences) };+}diff --git a/client/src/components/Tours/planner/hikingPreferences.test.tsx b/client/src/components/Tours/planner/hikingPreferences.test.tsxindex 879f1e8b8..b8929220b 100644--- a/client/src/components/Tours/planner/hikingPreferences.test.tsx+++ b/client/src/components/Tours/planner/hikingPreferences.test.tsx@@ -1,7 +1,7 @@import { fireEvent, render, screen } from '@testing-library/react';import { describe, expect, it, vi } from 'vitest';import { HikingPreferencesField } from './HikingPreferencesField';-import { hikingCostingOptions } from './tourRouting';+import { hikingCosting, hikingCostingOptions } from './hikingCosting';describe('hikingCostingOptions (MF-08, RTE-01)', () => {it('asks the router only for what was switched on, in the options it was checked with', () => {@@ -13,6 +13,11 @@ describe('hikingCostingOptions (MF-08, RTE-01)', () => {use_ferry: 0,});});++ it('weighs the whole tour and one of its sections alike: the limit with the preferences (RTE-02)', () => {+ expect(hikingCosting()).toEqual({ max_hiking_difficulty: 2 });+ expect(hikingCosting(4, { avoid_steps: true })).toEqual({ max_hiking_difficulty: 4, step_penalty: 600 });+ });});describe('HikingPreferencesField (MF-08, RTE-01)', () => {diff --git a/client/src/components/Tours/planner/legVariantPaint.test.ts b/client/src/components/Tours/planner/legVariantPaint.test.tsnew file mode 100644index 000000000..7c3d25bad--- /dev/null+++ b/client/src/components/Tours/planner/legVariantPaint.test.ts@@ -0,0 +1,76 @@+// 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).+import { renderHook } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it } from 'vitest';+import { drawOrder, useLegVariantLines, variantPaintCss } from './legVariantPaint';+import type { LegVariant } from './legVariants';++const variant = (key: LegVariant['key'], lat: number): LegVariant => ({+ key,+ current: key === 'current',+ direct: false,+ coordinates: [+ [lat, 11],+ [lat, 11.02],+ ],+ distanceM: 1500,+ gainM: null,+ lossM: null,+ minutes: null,+ heights: 'pending',+});++const WAYS = [variant('current', 47), variant('a', 47.01), variant('b', 47.02)];+const ROUTE: [number, number][][] = [+ [+ [47, 10.9],+ [47, 11.1],+ ],+];+const PAINT = {+ '--hike-variant-current': '#0a84ff',+ '--hike-variant-a': '#f97316',+ '--hike-variant-b': '#d946ef',+ '--hike-variant-c': '#14b8a6',+ '--bike-highlight-casing': '#ffffff',+};++beforeEach(() => {+ for (const [token, value] of Object.entries(PAINT)) document.documentElement.style.setProperty(token, value);+});++afterEach(() => {+ for (const token of Object.keys(PAINT)) document.documentElement.style.removeProperty(token);+});++describe('legVariantPaint', () => {+ it('FE-TOUR-LEG-VARIANT-PAINT-001: the way in focus is drawn last, the others in their order', () => {+ expect(drawOrder(WAYS, 'a').map((way) => way.key)).toEqual(['current', 'b', 'a']);+ expect(drawOrder(WAYS, null).map((way) => way.key)).toEqual(['current', 'a', 'b']);+ expect(variantPaintCss('b')).toBe('var(--hike-variant-b)');+ });++ it('FE-TOUR-LEG-VARIANT-PAINT-002: lays the ways over the route in their colours, on the white rim, for 2D and 3D alike', () => {+ const { result } = renderHook(() => useLegVariantLines(ROUTE, [false], null, WAYS, 'current'));+ expect(result.current.route).toEqual([ROUTE[0], WAYS[1].coordinates, WAYS[2].coordinates, WAYS[0].coordinates]);+ expect(result.current.walking).toEqual([false, false, false, false]);+ expect(result.current.colors).toEqual([+ undefined,+ { line: '#f97316', casing: '#ffffff' },+ { line: '#d946ef', casing: '#ffffff' },+ { line: '#0a84ff', casing: '#ffffff' },+ ]);+ expect(result.current.overlays).toEqual([+ { coordinates: WAYS[1].coordinates, color: '#f97316' },+ { coordinates: WAYS[2].coordinates, color: '#d946ef' },+ { coordinates: WAYS[0].coordinates, color: '#0a84ff' },+ ]);+ });++ it('FE-TOUR-LEG-VARIANT-PAINT-003: with nothing compared the lines stay exactly as they came', () => {+ const { result } = renderHook(() => useLegVariantLines(ROUTE, [false], null, null, null));+ expect(result.current.route).toBe(ROUTE);+ expect(result.current.colors).toBeNull();+ expect(result.current.overlays).toEqual([]);+ });+});diff --git a/client/src/components/Tours/planner/legVariantPaint.ts b/client/src/components/Tours/planner/legVariantPaint.tsnew file mode 100644index 000000000..c238989ce--- /dev/null+++ b/client/src/components/Tours/planner/legVariantPaint.ts@@ -0,0 +1,65 @@+import { useMemo } from 'react';+import { useMapPaint } from '../../Map/mapPaint';+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.+ */+const VARIANT_PAINT_TOKENS = {+ current: '--hike-variant-current',+ a: '--hike-variant-a',+ b: '--hike-variant-b',+ c: '--hike-variant-c',+ casing: '--bike-highlight-casing',+} as const;++/** A way's colour as a CSS variable, for markup on the page. */+export function variantPaintCss(key: LegVariantKey): string {+ return `var(${VARIANT_PAINT_TOKENS[key]})`;+}++type Drawn = Parameters<typeof withRouteHighlight>;++/**+ * 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[] {+ return [+ ...variants.filter((variant) => variant.key !== focus),+ ...variants.filter((variant) => variant.key === focus),+ ];+}++/**+ * 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.+ * `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,+ focus: LegVariantKey | null+) {+ const paint = useMapPaint(VARIANT_PAINT_TOKENS);+ return useMemo(() => {+ const ordered = variants ? drawOrder(variants, focus) : [];+ const highlight = ordered.length+ ? {+ id: 'leg-variants',+ lines: ordered.map((variant) => variant.coordinates),+ paint: 'current',+ 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] }));+ return { ...drawn, overlays };+ }, [colors, focus, paint, route, variants, walking]);+}diff --git a/client/src/components/Tours/planner/legVariantRouting.test.ts b/client/src/components/Tours/planner/legVariantRouting.test.tsnew file mode 100644index 000000000..a9cd22e8a--- /dev/null+++ b/client/src/components/Tours/planner/legVariantRouting.test.ts@@ -0,0 +1,141 @@+// FE-TOUR-LEG-VARIANT-ROUTING-001 to FE-TOUR-LEG-VARIANT-ROUTING-005: asking the router for the+// other ways of a hike's section under its own rules, and routing a section through pins (RTE-02).+import { beforeEach, describe, expect, it, vi } from 'vitest';++const { valhallaAlternates, valhallaRun, enrichTourElevations } = vi.hoisted(() => ({+ valhallaAlternates: vi.fn(),+ valhallaRun: vi.fn(),+ enrichTourElevations: vi.fn(),+}));++vi.mock('../../Map/valhallaRoute', () => ({ valhallaAlternates, valhallaRun }));+vi.mock('./tourRouting', () => ({ enrichTourElevations }));++import { askOtherWays, routeSection, type OtherWaysAnswer } from './legVariantRouting';+import type { ComparedLeg, LegVariant } from './legVariants';++const LEG: ComparedLeg = {+ fromId: 'a',+ toId: 'b',+ from: { lat: 47, lng: 11 },+ to: { lat: 47, lng: 11.02 },+ costing: { max_hiking_difficulty: 3, use_hills: 0.2 },+ key: 'a>b',+};+const CURRENT: LegVariant = {+ key: 'current',+ current: true,+ direct: false,+ coordinates: [+ [47, 11],+ [47.001, 11.01],+ [47, 11.02],+ ],+ distanceM: 1530,+ gainM: 50,+ lossM: 30,+ minutes: 30,+ heights: 'known',+};+const NORTH: [number, number][] = [+ [47, 11],+ [47.03, 11.01],+ [47, 11.02],+];+const leg = (coordinates: [number, number][]) => ({+ coordinates,+ distance: 6000,+ duration: 4000,+ hasToll: false,+ hasHighway: false,+ hasFerry: false,+});++beforeEach(() => {+ vi.clearAllMocks();+});++describe('askOtherWays', () => {+ it('FE-TOUR-LEG-VARIANT-ROUTING-001: asks on foot between the two ends under the hike’s rules, then the heights of each way', async () => {+ valhallaAlternates.mockResolvedValue([leg(CURRENT.coordinates), leg(NORTH)]);+ enrichTourElevations.mockResolvedValue(+ NORTH.map(([lat, lng], i): [number, number, number] => [lat, lng, i === 1 ? 1100 : 1000])+ );+ const reports: OtherWaysAnswer[] = [];+ await askOtherWays(LEG, CURRENT, new AbortController().signal, (answer) => reports.push(answer));++ expect(valhallaAlternates).toHaveBeenCalledWith(+ LEG.from,+ LEG.to,+ 'walking',+ [],+ 3,+ expect.any(AbortSignal),+ LEG.costing+ );+ expect(enrichTourElevations).toHaveBeenCalledTimes(1);+ expect(enrichTourElevations).toHaveBeenCalledWith(NORTH, expect.any(AbortSignal));+ expect(reports.map((report) => report.phase)).toEqual(['choose', 'choose']);+ expect(reports[0].variants.map((variant) => [variant.key, variant.heights])).toEqual([+ ['current', 'known'],+ ['a', 'pending'],+ ]);+ expect(reports[1].variants[1]).toMatchObject({ heights: 'known', gainM: 100, lossM: 100 });+ });++ it('FE-TOUR-LEG-VARIANT-ROUTING-002: one way back is no choice, no answer is a failure; neither asks for heights', async () => {+ const reports: OtherWaysAnswer[] = [];+ valhallaAlternates.mockResolvedValueOnce([leg(CURRENT.coordinates)]);+ await askOtherWays(LEG, CURRENT, new AbortController().signal, (answer) => reports.push(answer));+ valhallaAlternates.mockResolvedValueOnce(null);+ await askOtherWays(LEG, CURRENT, new AbortController().signal, (answer) => reports.push(answer));++ expect(reports).toEqual([+ { phase: 'none', variants: [CURRENT] },+ { phase: 'failed', variants: [CURRENT] },+ ]);+ expect(enrichTourElevations).not.toHaveBeenCalled();+ });++ it('FE-TOUR-LEG-VARIANT-ROUTING-003: nothing is reported once the comparison is gone, not even what was asked before', async () => {+ const controller = new AbortController();+ const report = vi.fn();+ valhallaAlternates.mockImplementationOnce(async () => {+ controller.abort();+ return [leg(NORTH)];+ });+ await askOtherWays(LEG, CURRENT, controller.signal, report);+ expect(report).not.toHaveBeenCalled();++ const later = new AbortController();+ valhallaAlternates.mockResolvedValueOnce([leg(NORTH)]);+ enrichTourElevations.mockImplementationOnce(async () => {+ later.abort();+ return null;+ });+ await askOtherWays(LEG, CURRENT, later.signal, report);+ expect(report).toHaveBeenCalledTimes(1);+ });+});++describe('routeSection', () => {+ it('FE-TOUR-LEG-VARIANT-ROUTING-004: routes the section through the pins in order, under its own rules', async () => {+ valhallaRun.mockResolvedValue({ legs: [], total: { ...leg(NORTH), hasFerry: true }, snapped: [] });+ const signal = new AbortController().signal;+ const routed = await routeSection(LEG, [{ lat: 47.03, lng: 11.01 }], signal);++ expect(valhallaRun).toHaveBeenCalledWith(+ [LEG.from, { lat: 47.03, lng: 11.01 }, LEG.to],+ 'walking',+ [],+ signal,+ LEG.costing+ );+ expect(routed).toEqual({ coordinates: NORTH, distance: 6000, duration: 4000, hasFerry: true });+ });++ it('FE-TOUR-LEG-VARIANT-ROUTING-005: a router without an answer is a failure, never an empty way', async () => {+ valhallaRun.mockResolvedValue(null);+ await expect(routeSection(LEG, [], new AbortController().signal)).rejects.toThrow('No route found');+ });+});diff --git a/client/src/components/Tours/planner/legVariantRouting.ts b/client/src/components/Tours/planner/legVariantRouting.tsnew file mode 100644index 000000000..f91b4dc20--- /dev/null+++ b/client/src/components/Tours/planner/legVariantRouting.ts@@ -0,0 +1,58 @@+import { valhallaAlternates, valhallaRun } from '../../Map/valhallaRoute';+import type { RailLegRoute } from '../../Roadtrip/useRoadtripRoutes';+import { OTHER_WAY_KEYS, offeredVariants, withVariantHeights, type ComparedLeg, type LegVariant } from './legVariants';+import { enrichTourElevations } from './tourRouting';++/** What a comparison has found so far: the router's answer and the ways it offered, their heights as they come in. */+export interface OtherWaysAnswer {+ /** `failed`: the router did not answer; `none`: it knows no other way; `choose`: there are ways to choose from. */+ phase: 'failed' | 'none' | 'choose';+ variants: LegVariant[];+}++/**+ * RTE-02: the other ways between the two ends of a hike's section, asked+ * under the hike's own rules, then the heights of each, one after the other+ * (the router allows a question a second). `report` hears every step, so the+ * figures fill in as they arrive; nothing is reported once `signal` aborts.+ */+export async function askOtherWays(+ leg: ComparedLeg,+ current: LegVariant,+ signal: AbortSignal,+ report: (answer: OtherWaysAnswer) => void+): Promise<void> {+ const offers = await valhallaAlternates(leg.from, leg.to, 'walking', [], OTHER_WAY_KEYS.length, signal, leg.costing);+ if (signal.aborted) return;+ if (!offers) {+ report({ phase: 'failed', variants: [current] });+ return;+ }+ let variants = offeredVariants(current, offers);+ const phase = variants.length > 1 ? 'choose' : 'none';+ report({ phase, variants });+ for (const variant of variants) {+ if (variant.heights !== 'pending') continue;+ const heights = await enrichTourElevations(variant.coordinates, signal);+ if (signal.aborted) return;+ variants = variants.map((known) => (known.key === variant.key ? withVariantHeights(known, heights) : known));+ report({ phase, variants });+ }+}++/**+ * The section routed again through `pins` under its own rules, the way the+ * planner will route it once the pins are its shaping points. It is what a+ * choice is checked against before anything is written: a way the router+ * does not keep to with a few pins is no way the tour can hold.+ */+export async function routeSection(+ leg: ComparedLeg,+ pins: ReadonlyArray<{ lat: number; lng: number }>,+ signal: AbortSignal+): Promise<RailLegRoute> {+ const run = await valhallaRun([leg.from, ...pins, leg.to], 'walking', [], signal, leg.costing);+ if (!run) throw new Error('No route found');+ const { coordinates, distance, duration, hasFerry } = run.total;+ return { coordinates, distance, duration, hasFerry };+}diff --git a/client/src/components/Tours/planner/legVariants.test.ts b/client/src/components/Tours/planner/legVariants.test.tsnew file mode 100644index 000000000..0fb86d285--- /dev/null+++ b/client/src/components/Tours/planner/legVariants.test.ts@@ -0,0 +1,175 @@+// FE-TOUR-LEG-VARIANTS-001 to FE-TOUR-LEG-VARIANTS-008: the model of the ways a hike's section+// can take, which section can be compared, and the figures of each way (RTE-02).+import { describe, expect, it } from 'vitest';+import type { ValhallaLeg } from '../../Map/valhallaRoute';+import { hikingTimeMinutes } from '../hikingTime';+import {+ comparedLegOf,+ currentVariantOf,+ figuresOf,+ isComparableLeg,+ offeredVariants,+ variantDelta,+ withVariantHeights,+ type LegVariant,+} from './legVariants';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';++const A: TourPlannerWaypoint = { id: 'a', lat: 47.0, lng: 11.0, role: 'start' };+const B: TourPlannerWaypoint = { id: 'b', lat: 47.0, lng: 11.02, role: 'via' };+const C: TourPlannerWaypoint = { id: 'c', lat: 47.01, lng: 11.02, role: 'end' };+const ROUTE: [number, number][] = [+ [47.0, 11.0],+ [47.001, 11.01],+ [47.0, 11.02],+ [47.005, 11.021],+ [47.01, 11.02],+];+const HEIGHTS: [number, number, number][] = ROUTE.map(([lat, lng], index) => [+ lat,+ lng,+ 1000 + [0, 50, 20, 80, 60][index],+]);+const COSTING = { max_hiking_difficulty: 2 };++/** A way the router offered, with the figures it gave for it. */+const offer = (coordinates: [number, number][], distance = 1000): ValhallaLeg => ({+ coordinates,+ distance,+ duration: 900,+ hasToll: false,+ hasHighway: false,+ hasFerry: false,+});++describe('which section can be compared', () => {+ it('FE-TOUR-LEG-VARIANTS-001: a routed leg of a hike, never a fixed line, the last point, another type or a missing point', () => {+ const ferrata = {+ ...B,+ fixedLeg: { kind: 'ferrata', ref: 'way/1', geometry: [[47, 11.02]] },+ } as TourPlannerWaypoint;+ expect(isComparableLeg([A, B, C], 0, 'hike')).toBe(true);+ expect(isComparableLeg([A, B, C], 2, 'hike')).toBe(false);+ expect(isComparableLeg([A, B, C], -1, 'hike')).toBe(false);+ expect(isComparableLeg([A, B, C], 0, 'bike')).toBe(false);+ expect(isComparableLeg([A, B, C], 0, 'walk')).toBe(false);+ expect(isComparableLeg([A, ferrata, C], 1, 'hike')).toBe(false);+ const geometry = [+ [47, 11],+ [47, 11.02],+ ];+ const free = { ...A, fixedLeg: { kind: 'free', geometry } } as TourPlannerWaypoint;+ expect(isComparableLeg([free, B, C], 0, 'hike')).toBe(false);+ });++ it('FE-TOUR-LEG-VARIANTS-002: a section is named by both ends and the rules; any change makes it another section', () => {+ const leg = comparedLegOf([A, B, C], 'a', 'hike', COSTING);+ expect(leg).toMatchObject({ fromId: 'a', toId: 'b', from: { lat: 47, lng: 11 }, to: { lat: 47, lng: 11.02 } });+ expect(comparedLegOf([A, B, C], 'a', 'hike', COSTING)?.key).toBe(leg?.key);+ expect(comparedLegOf([A, { ...B, lat: 47.001 }, C], 'a', 'hike', COSTING)?.key).not.toBe(leg?.key);+ expect(comparedLegOf([A, { ...B, id: 'x' }, C], 'a', 'hike', COSTING)?.key).not.toBe(leg?.key);+ expect(comparedLegOf([A, B, C], 'a', 'hike', { max_hiking_difficulty: 3 })?.key).not.toBe(leg?.key);+ expect(comparedLegOf([A, B, C], 'gone', 'hike', COSTING)).toBeNull();+ expect(comparedLegOf([A, B, C], 'c', 'hike', COSTING)).toBeNull();+ });+});++describe('the figures of a way', () => {+ it('FE-TOUR-LEG-VARIANTS-003: length, climb, descent and the signposts’ time once every point has its height', () => {+ const figures = figuresOf(HEIGHTS);+ expect(figures.heights).toBe('known');+ expect(figures.gainM).toBe(110);+ expect(figures.lossM).toBe(50);+ expect(figures.distanceM).toBeGreaterThan(2000);+ expect(figures.minutes).toBe(hikingTimeMinutes(figures.distanceM / 1000, 110, 50));+ });++ it('FE-TOUR-LEG-VARIANTS-004: a line short of a single height keeps climb, descent and time unknown, never a guess', () => {+ const partly: ([number, number] | [number, number, number])[] = [+ ...HEIGHTS.slice(0, 2),+ ROUTE[2],+ ...HEIGHTS.slice(3),+ ];+ expect(figuresOf(partly)).toMatchObject({ gainM: null, lossM: null, minutes: null, heights: 'unknown' });+ expect(figuresOf(ROUTE).distanceM).toBe(figuresOf(partly).distanceM);+ });++ it('FE-TOUR-LEG-VARIANTS-005: the way taken now is cut from the drawn route between its two points, with its heights', () => {+ const current = currentVariantOf([A, B, C], 1, ROUTE, HEIGHTS);+ expect(current).toMatchObject({+ key: 'current',+ current: true,+ direct: false,+ heights: 'known',+ gainM: 60,+ lossM: 20,+ });+ expect(current?.coordinates).toEqual(ROUTE.slice(2));+ // Heights that are not the route's own are no heights for it.+ expect(currentVariantOf([A, B, C], 0, ROUTE, HEIGHTS.slice(1))?.heights).toBe('unknown');+ expect(currentVariantOf([A, B, C], 0, null, null)).toBeNull();+ expect(currentVariantOf([A, B, C], 2, ROUTE, HEIGHTS)).toBeNull();+ });+});++describe('the ways offered', () => {+ const current = currentVariantOf([A, B, C], 0, ROUTE, HEIGHTS) as LegVariant;+ const north: [number, number][] = [+ [47.0, 11.0],+ [47.03, 11.01],+ [47.0, 11.02],+ ];+ const south: [number, number][] = [+ [47.0, 11.0],+ [46.97, 11.01],+ [47.0, 11.02],+ ];+ const east: [number, number][] = [+ [47.0, 11.0],+ [47.0, 11.05],+ [47.0, 11.02],+ ];+ const west: [number, number][] = [+ [47.0, 11.0],+ [47.02, 10.98],+ [47.0, 11.02],+ ];++ it('FE-TOUR-LEG-VARIANTS-006: the way taken now first, the same way never twice, at most three others lettered in order', () => {+ const variants = offeredVariants(current, [+ offer(current.coordinates),+ offer(north),+ offer(north),+ offer(south),+ offer(east),+ offer(west),+ ]);+ expect(variants.map((variant) => variant.key)).toEqual(['current', 'a', 'b', 'c']);+ expect(variants[1]).toMatchObject({ coordinates: north, current: false, direct: false, heights: 'pending' });+ expect(variants.slice(1).every((variant) => variant.gainM === null && variant.minutes === null)).toBe(true);+ });++ it("FE-TOUR-LEG-VARIANTS-007: the router's own way is marked direct, so it is held without a shaping point", () => {+ const [, first, second] = offeredVariants(current, [offer(north), offer(south)]);+ expect(first.direct).toBe(true);+ expect(second.direct).toBe(false);+ expect(offeredVariants(current, [])).toEqual([current]);+ });++ it('FE-TOUR-LEG-VARIANTS-008: heights fill a way in, and the difference to the way taken now is what is known of both', () => {+ const [, pending] = offeredVariants(current, [offer(north)]);+ const known = withVariantHeights(pending, [+ [47.0, 11.0, 1000],+ [47.03, 11.01, 1300],+ [47.0, 11.02, 1020],+ ]);+ expect(known).toMatchObject({ heights: 'known', gainM: 300, lossM: 280 });+ expect(withVariantHeights(pending, null)).toMatchObject({ heights: 'unknown', gainM: null, minutes: null });++ const delta = variantDelta(known, current);+ expect(delta.distanceM).toBe(known.distanceM - current.distanceM);+ expect(delta.gainM).toBe(300 - (current.gainM ?? 0));+ expect(delta.minutes).toBe((known.minutes ?? 0) - (current.minutes ?? 0));+ expect(variantDelta(pending, current)).toMatchObject({ minutes: null, gainM: null });+ });+});diff --git a/client/src/components/Tours/planner/legVariants.ts b/client/src/components/Tours/planner/legVariants.tsnew file mode 100644index 000000000..302e09e12--- /dev/null+++ b/client/src/components/Tours/planner/legVariants.ts@@ -0,0 +1,183 @@+import type { PlannableTourType } from '@trek/shared';+import { analyzeRouteGeometry } from '../../../utils/routeGeometry';+import { sameRoad } from '../../Map/RouteCalculator';+import type { CostingOptions, ValhallaLeg } from '../../Map/valhallaRoute';+import { hikingTimeMinutes } from '../hikingTime';+import { legSpanOf } from './routeLegAt';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';+import type { TourElevationPoint } from './tourRouting';++/**+ * RTE-02: the ways a hike's routed section can take, as a pure model: which+ * section can be compared, the way it takes now, the other ways the router+ * offers between the same two points under the same rules, and the figures+ * each one has. Nothing here asks a router or changes the tour.+ */++/** The most other ways one section is offered: the colours and letters the card and the map have for them. */+export const OTHER_WAY_KEYS = ['a', 'b', 'c'] as const;++type OtherWayKey = (typeof OTHER_WAY_KEYS)[number];+export type LegVariantKey = 'current' | OtherWayKey;++/** Where a way's heights stand: still being asked for, in, or not to be had. */+type VariantHeights = 'pending' | 'known' | 'unknown';++/** One way of walking the section, with what is known of it. */+export interface LegVariant {+ key: LegVariantKey;+ /** The way the section takes now, cut from the drawn route. */+ current: boolean;+ /** The router's own way between the two points: held without a shaping point. */+ direct: boolean;+ coordinates: [number, number][];+ /** Measured along the line, as the tour's own distance is. */+ distanceM: number;+ gainM: number | null;+ lossM: number | null;+ /** The walking time by the signposts' rule the tour is timed by; known once the heights are. */+ minutes: number | null;+ heights: VariantHeights;+}++/** The section a comparison is about, as it stood when it was asked. */+export interface ComparedLeg {+ fromId: string;+ toId: string;+ from: { lat: number; lng: number };+ to: { lat: number; lng: number };+ /** The hike's rules the ways were asked under. */+ costing: CostingOptions;+ /** What the section is planned from; another key is another section. */+ key: string;+}++/**+ * Whether the leg after waypoint `index` is a routed section of a hike: a+ * leg drawn by hand or a via ferrata taken over keeps its fixed line and is+ * never offered another way.+ */+export function isComparableLeg(+ points: readonly TourPlannerWaypoint[],+ index: number,+ tourType: PlannableTourType+): boolean {+ return tourType === 'hike' && index >= 0 && index < points.length - 1 && !points[index].fixedLeg;+}++const spot = (point: { lat: number; lng: number }) => `${point.lat.toFixed(7)},${point.lng.toFixed(7)}`;++/**+ * The section after the waypoint `fromId` as it stands now, or null when the+ * point is gone or its leg cannot be compared. Its key holds both ends and+ * the rules, so a moved point, a point set in between or a changed limit makes+ * a comparison asked before it one of another section.+ */+export function comparedLegOf(+ points: readonly TourPlannerWaypoint[],+ fromId: string,+ tourType: PlannableTourType,+ costing: CostingOptions+): ComparedLeg | null {+ const index = points.findIndex((point) => point.id === fromId);+ if (!isComparableLeg(points, index, tourType)) return null;+ const from = points[index];+ const to = points[index + 1];+ return {+ fromId: from.id,+ toId: to.id,+ from: { lat: from.lat, lng: from.lng },+ to: { lat: to.lat, lng: to.lng },+ costing,+ key: `${from.id}@${spot(from)}>${to.id}@${spot(to)}#${JSON.stringify(costing)}`,+ };+}++/**+ * Distance, climb, descent and walking time of a line. The climb, descent and+ * time stay unknown unless every point has its height: a figure from part of a+ * line would be set beside whole ones as if it were one.+ */+export function figuresOf(+ line: readonly TourElevationPoint[]+): Pick<LegVariant, 'distanceM' | 'gainM' | 'lossM' | 'minutes' | 'heights'> {+ const analysis = analyzeRouteGeometry(JSON.stringify(line));+ const distanceM = Math.round((analysis?.distanceKm ?? 0) * 1000);+ const gainM = analysis?.gain ?? null;+ const lossM = analysis?.loss ?? null;+ if (gainM === null || lossM === null) {+ return { distanceM, gainM: null, lossM: null, minutes: null, heights: 'unknown' };+ }+ return {+ distanceM,+ gainM: Math.round(gainM),+ lossM: Math.round(lossM),+ minutes: hikingTimeMinutes(distanceM / 1000, gainM, lossM),+ heights: 'known',+ };+}++/**+ * The way the section after waypoint `index` takes now, cut from the drawn+ * route, with its heights where the route has them all; null while the route+ * has no such stretch.+ */+export function currentVariantOf(+ points: ReadonlyArray<{ lat: number; lng: number }>,+ index: number,+ route: readonly [number, number][] | null,+ heights: readonly TourElevationPoint[] | null+): LegVariant | null {+ const span = legSpanOf(points, route, index);+ if (!route || !span) return null;+ const line = route.slice(span.from, span.to + 1);+ const withHeights = heights?.length === route.length ? heights.slice(span.from, span.to + 1) : null;+ return {+ key: 'current',+ current: true,+ direct: false,+ coordinates: line.map(([lat, lng]): [number, number] => [lat, lng]),+ ...figuresOf(withHeights ?? line),+ };+}++const roadOf = (coordinates: [number, number][]) => ({ coordinates, distance: 0, duration: 0 });++/**+ * The way the section takes now first, then each other way the router+ * offered that is not the same way again, lettered in the order the router+ * gave them and at most three. Their heights are still to be asked for.+ */+export function offeredVariants(current: LegVariant, offers: readonly ValhallaLeg[]): LegVariant[] {+ const variants: LegVariant[] = [current];+ offers.forEach((offer, index) => {+ const key = OTHER_WAY_KEYS[variants.length - 1];+ if (!key || variants.some((known) => sameRoad(roadOf(known.coordinates), roadOf(offer.coordinates)))) return;+ variants.push({+ key,+ current: false,+ direct: index === 0,+ coordinates: offer.coordinates,+ ...figuresOf(offer.coordinates),+ heights: 'pending',+ });+ });+ return variants;+}++/** A way with the heights the router answered, or with its heights unknown when there were none. */+export function withVariantHeights(variant: LegVariant, heights: readonly TourElevationPoint[] | null): LegVariant {+ return { ...variant, ...figuresOf(heights ?? variant.coordinates) };+}++/** How a way differs from the one taken now: metres and minutes more (positive) or fewer; null where unknown. */+export function variantDelta(+ variant: LegVariant,+ current: LegVariant+): { distanceM: number; minutes: number | null; gainM: number | null } {+ return {+ distanceM: variant.distanceM - current.distanceM,+ minutes: variant.minutes !== null && current.minutes !== null ? variant.minutes - current.minutes : null,+ gainM: variant.gainM !== null && current.gainM !== null ? variant.gainM - current.gainM : null,+ };+}diff --git a/client/src/components/Tours/planner/routeLegAt.test.ts b/client/src/components/Tours/planner/routeLegAt.test.tsindex 84cdec01c..d4d0ce297 100644--- a/client/src/components/Tours/planner/routeLegAt.test.ts+++ b/client/src/components/Tours/planner/routeLegAt.test.ts@@ -1,6 +1,7 @@-// FE-ROUTE-LEG-AT-001 to FE-ROUTE-LEG-AT-003: which leg a click on the drawn route lands in (P2A-03).+// FE-ROUTE-LEG-AT-001 to FE-ROUTE-LEG-AT-005: which leg a click on the drawn route lands in (P2A-03),+// and the stretch of the route a leg spans (RTE-02).import { describe, expect, it } from 'vitest';-import { legStartAt } from './routeLegAt';+import { legSpanOf, legStartAt } from './routeLegAt';const A = { id: 'a', lat: 49.0, lng: 12.0 };const B = { id: 'b', lat: 49.0, lng: 12.1 };@@ -32,3 +33,21 @@ describe('legStartAt', () => {expect(legStartAt([A, B], [[49, 12]], 49, 12.05)).toBeNull();});});++describe('legSpanOf', () => {+ it('FE-ROUTE-LEG-AT-004: a leg spans the vertices from where its point lies to where the next one does', () => {+ expect(legSpanOf([A, B, C], LINE, 0)).toEqual({ from: 0, to: 2 });+ expect(legSpanOf([A, B, C], LINE, 1)).toEqual({ from: 2, to: 4 });+ // The way back of a loop ends on the line's end, not on the start it shares a spot with.+ const back = { lat: A.lat, lng: A.lng };+ const loop: [number, number][] = [...LINE, [49.05, 12.02], [49.0, 12.0]];+ expect(legSpanOf([A, B, C, back], loop, 2)).toEqual({ from: 4, to: 6 });+ });++ it('FE-ROUTE-LEG-AT-005: no span without a line, past the last point, or for two points on one spot', () => {+ expect(legSpanOf([A, B], null, 0)).toBeNull();+ expect(legSpanOf([A, B], LINE, 1)).toBeNull();+ expect(legSpanOf([A, B], LINE, -1)).toBeNull();+ expect(legSpanOf([A, A], LINE, 0)).toBeNull();+ });+});diff --git a/client/src/components/Tours/planner/routeLegAt.ts b/client/src/components/Tours/planner/routeLegAt.tsindex 194e076dd..ea294e998 100644--- a/client/src/components/Tours/planner/routeLegAt.ts+++ b/client/src/components/Tours/planner/routeLegAt.ts@@ -11,10 +11,10 @@ function alongLine(lat: number,lng: number,fromIndex: number-): { at: number; index: number } {+): { at: number; index: number; vertex: number } {const cos = Math.cos((lat * Math.PI) / 180);let travelled = 0;- let best = { at: 0, index: fromIndex, distance: Infinity };+ let best = { at: 0, index: fromIndex, vertex: fromIndex, distance: Infinity };for (let i = 0; i < line.length - 1; i += 1) {const [aLat, aLng] = line[i];const [bLat, bLng] = line[i + 1];@@ -25,11 +25,21 @@ function alongLine(const t =length === 0 ? 0 : Math.max(0, Math.min(1, ((lng - aLng) * cos * dx + (lat - aLat) * dy) / (length * length)));const distance = Math.hypot(aLng * cos + dx * t - lng * cos, aLat + dy * t - lat);- if (distance < best.distance) best = { at: travelled + length * t, index: i, distance };+ if (distance < best.distance) best = { at: travelled + length * t, index: i, vertex: t < 0.5 ? i : i + 1, distance };}travelled += length;}- return { at: best.at, index: best.index };+ return { at: best.at, index: best.index, vertex: best.vertex };+}++/** Every waypoint placed along the line, each searched for from where the one before it lay. */+function placedAlong(points: ReadonlyArray<{ lat: number; lng: number }>, line: readonly [number, number][]) {+ let from = 0;+ return points.map((point) => {+ const placed = alongLine(line, point.lat, point.lng, from);+ from = placed.index;+ return placed;+ });}/** The id of the waypoint that starts the leg holding the spot, or null when the route has no such leg. */@@ -40,16 +50,28 @@ export function legStartAt(lng: number): string | null {if (!line || line.length < 2 || points.length < 2) return null;- const positions: number[] = [];- let from = 0;- for (const point of points) {- const placed = alongLine(line, point.lat, point.lng, from);- positions.push(placed.at);- from = placed.index;- }+ const positions = placedAlong(points, line).map((placed) => placed.at);const spot = alongLine(line, lat, lng, 0).at;for (let i = 0; i < points.length - 1; i += 1) {if (spot >= positions[i] && spot <= positions[i + 1]) return points[i].id;}return null;}++/**+ * RTE-02: the stretch of the drawn route that runs from waypoint `index` to the+ * next one, as the vertices it spans (`to` included), or null when the route+ * has no such leg. A route and its heights share their vertices, so the span+ * cuts both alike.+ */+export function legSpanOf(+ points: ReadonlyArray<{ lat: number; lng: number }>,+ line: readonly [number, number][] | null,+ index: number+): { from: number; to: number } | null {+ if (!line || line.length < 2 || index < 0 || index >= points.length - 1) return null;+ const placed = placedAlong(points, line);+ const from = placed[index].vertex;+ const to = placed[index + 1].vertex;+ return to > from ? { from, to } : null;+}diff --git a/client/src/components/Tours/planner/tourPlannerWaypoints.test.ts b/client/src/components/Tours/planner/tourPlannerWaypoints.test.tsindex c2b40f520..3213c297d 100644--- a/client/src/components/Tours/planner/tourPlannerWaypoints.test.ts+++ b/client/src/components/Tours/planner/tourPlannerWaypoints.test.ts@@ -1,5 +1,5 @@-// FE-TOUR-WAYPOINTS-001 to FE-TOUR-WAYPOINTS-010: the editor's waypoint model, shaping points, drawn legs-// and a city walk's stations with the keys a save answers (P2A-03, PAD-11, CW-01 to CW-04).+// FE-TOUR-WAYPOINTS-001 to FE-TOUR-WAYPOINTS-012: the editor's waypoint model, shaping points, drawn legs+// and a city walk's stations with the keys a save answers (P2A-03, PAD-11, CW-01 to CW-04, RTE-02).import type { TourWaypoint } from '@trek/shared';import { describe, expect, it } from 'vitest';import {@@ -9,11 +9,13 @@ import {routeInputsKey,sameWaypointSnapshot,savedWaypointsOf,+ stopNumbersOf,tourWaypointKey,withDrawnLegsRouted,withSavedKeys,withShaping,withShapingPoint,+ withShapingPoints,type TourPlannerWaypoint,} from './tourPlannerWaypoints';@@ -223,4 +225,34 @@ describe('tourPlannerWaypoints', () => {for (const edit of routed) expect(routeInputsKey([A, { ...B, ...edit }, C])).not.toBe(routeInputsKey([A, B, C]));expect(routeInputsKey([A, C])).not.toBe(routeInputsKey([A, B, C]));});++ it('FE-TOUR-WAYPOINTS-011: the shaping points of a chosen way go in order between the two neighbours, and only there', () => {+ const shapes = [+ { id: 's1', lat: 49.003, lng: 12.004 },+ { id: 's2', lat: 49.006, lng: 12.008 },+ ];+ const shaped = withShapingPoints([A, B, C], 'a', 'b', shapes);+ expect(shaped.map((point) => point.id)).toEqual(['a', 's1', 's2', 'b', 'c']);+ expect(shaped[1]).toEqual({ ...shapes[0], role: 'via', shaping: true });+ const points = [A, B, C];+ // No longer neighbours, a fixed line in between, or nothing to set: the points stay as they are.+ expect(withShapingPoints(points, 'a', 'c', shapes)).toBe(points);+ expect(withShapingPoints(points, 'c', 'a', shapes)).toBe(points);+ expect(withShapingPoints(points, 'a', 'b', [])).toBe(points);+ const geometry = [+ [49, 12],+ [49.01, 12.01],+ ];+ const free = { kind: 'free', geometry } as TourPlannerWaypoint['fixedLeg'];+ const drawn = [{ ...A, fixedLeg: free }, B, C];+ expect(withShapingPoints(drawn, 'a', 'b', shapes)).toBe(drawn);+ });++ it('FE-TOUR-WAYPOINTS-012: stops are numbered on their own; a shaping point takes no number', () => {+ const numbers = stopNumbersOf([A, { ...B, shaping: true }, C]);+ expect([...numbers.entries()]).toEqual([+ ['a', 1],+ ['c', 2],+ ]);+ });});diff --git a/client/src/components/Tours/planner/tourPlannerWaypoints.ts b/client/src/components/Tours/planner/tourPlannerWaypoints.tsindex 88cfa3149..e621c9c1e 100644--- a/client/src/components/Tours/planner/tourPlannerWaypoints.ts+++ b/client/src/components/Tours/planner/tourPlannerWaypoints.ts@@ -46,6 +46,13 @@ export interface TourPlannerWaypoint {poiCategory?: TourPoiCategory | null;}+/** Stops are numbered on their own, as on the map: a shaping point (P2A-03) takes no number. */+export function stopNumbersOf(points: ReadonlyArray<Pick<TourPlannerWaypoint, 'id' | 'shaping'>>): Map<string, number> {+ const numbers = new Map<string, number>();+ for (const point of points) if (!point.shaping) numbers.set(point.id, numbers.size + 1);+ return numbers;+}+/** A saved tour's waypoints as the editor holds them, each under a fresh id. */export function plannerWaypointsOf(saved: readonly TourWaypoint[], newId: () => string): TourPlannerWaypoint[] {return saved.map((point) => ({@@ -233,6 +240,24 @@ export function withShapingPoint(return [...points.slice(0, index + 1), { ...shape, role: 'via', shaping: true }, ...points.slice(index + 1)];}+/**+ * RTE-02: the points with shaping points set, in their order, into the routed+ * leg from `afterId` to `beforeId`; unchanged when the two are no longer+ * neighbours or the leg between them is a fixed line, so a choice worked out+ * for one leg never lands in another.+ */+export function withShapingPoints(+ points: TourPlannerWaypoint[],+ afterId: string,+ beforeId: string,+ shapes: ReadonlyArray<Pick<TourPlannerWaypoint, 'id' | 'lat' | 'lng'>>+): TourPlannerWaypoint[] {+ const index = points.findIndex((point) => point.id === afterId);+ if (index < 0 || points[index + 1]?.id !== beforeId || points[index].fixedLeg || shapes.length === 0) return points;+ const inserted = shapes.map((shape) => ({ ...shape, role: 'via' as const, shaping: true }));+ return [...points.slice(0, index + 1), ...inserted, ...points.slice(index + 1)];+}+/** P2A-03: a stop made a shaping point, or a shaping point a stop. The ends of a tour are always stops. */export function withShaping(points: TourPlannerWaypoint[], id: string, shaping: boolean): TourPlannerWaypoint[] {return points.map((point, index) => {diff --git a/client/src/components/Tours/planner/tourRouting.ts b/client/src/components/Tours/planner/tourRouting.tsindex 632efaf0b..fc201b059 100644--- a/client/src/components/Tours/planner/tourRouting.ts+++ b/client/src/components/Tours/planner/tourRouting.ts@@ -1,6 +1,7 @@import type { BikeProfile, HikingPreferences, RunProfile, TourFixedLeg } from '@trek/shared'import type { Waypoint } from '../../../types'import { valhallaBase, valhallaRun, valhallaTurn, type CostingOptions } from '../../Map/valhallaRoute'+import { hikingCosting, TOURS_MAX_HIKING_DIFFICULTY } from './hikingCosting'import { densifyLine, lineLengthM } from './tourFixedLegs'import { MAX_TOUR_SNAP_M, type TourRouteUnreachable } from './tourRouteOutcome'@@ -27,42 +28,11 @@ export interface TourRouteResult {durationSeconds: number | null}-/**- * Defensive fallback only. Normal planner calls pass the persisted/draft value.- * TREK exposes 1..6 and never exposes Valhalla's internal 0.- */-const TOURS_MAX_HIKING_DIFFICULTY = 2-/** How fast a fixed leg is reckoned until the heights are in: a via ferrata climbs slowly, a free leg is walked. */const FIXED_LEG_KM_PER_HOUR = { ferrata: 1.5, free: 4, portage: 2 } as const/** A leg drawn by hand on a bike tour is reckoned at an easy riding pace: no router saw it. */const FREE_LEG_RIDING_KM_PER_HOUR = 15-/**- * MF-08, RTE-01: a hike's preferences as Valhalla's pedestrian costing- * options. Each one was checked against the public instance before it was- * offered, and is a weighting that gives way where there is no other path:- * - avoid_climbs, `use_hills` 0.2: Freiburg Martinstor to the Schlossberg went- * from 1.64 km with a 37 % pitch and 30 m over 25 % to 1.73 km whose steepest- * stretch is 23 % (heights every 30 m). It weighs the grade, not the climb in- * sum: the same height is still gained. 0.1 and below sent Garmisch station- * to the Eckbauer round a 10 km detour with more steep metres, 0.25 and up- * left Freiburg as it was; 0.2 does neither.- * - avoid_steps, `step_penalty` 600 s: Würzburg Altstadt to the Festung went- * from four flights of steps over 1.49 km to one over 2.67 km.- * - avoid_ferries, `use_ferry` 0: Kiel Reventlou to Dietrichsdorf went from the- * Förde ferry (2.7 km) round the fjord on land (8.3 km); Hamburg- * Landungsbrücken to Steinwerder through the old Elbe tunnel instead of the ferry.- * The router has no option for marked, paved or rough ways on foot.- */-export function hikingCostingOptions(preferences: HikingPreferences | null | undefined): Record<string, number> {- return {- ...(preferences?.avoid_climbs ? { use_hills: 0.2 } : {}),- ...(preferences?.avoid_steps ? { step_penalty: 600 } : {}),- ...(preferences?.avoid_ferries ? { use_ferry: 0 } : {}),- }-}-/*** BIK-01 to BIK-04: what each bike profile asks Valhalla's bicycle costing for.* Every one was checked against the public instance with trace_attributes over@@ -98,10 +68,7 @@ export async function routeWalkingTour(maxHikingDifficulty = TOURS_MAX_HIKING_DIFFICULTY,preferences: HikingPreferences | null = null,): Promise<TourRouteResult | TourRouteUnreachable | null> {- return routeOnLand(waypoints, 'walking', {- max_hiking_difficulty: maxHikingDifficulty,- ...hikingCostingOptions(preferences),- }, signal)+ return routeOnLand(waypoints, 'walking', hikingCosting(maxHikingDifficulty, preferences), signal)}/**diff --git a/client/src/components/Tours/planner/useAppliedWayHint.test.ts b/client/src/components/Tours/planner/useAppliedWayHint.test.tsnew file mode 100644index 000000000..066412d1e--- /dev/null+++ b/client/src/components/Tours/planner/useAppliedWayHint.test.ts@@ -0,0 +1,70 @@+// FE-TOUR-APPLIED-WAY-HINT-001 to FE-TOUR-APPLIED-WAY-HINT-004: the "way taken" note over the map+// and its undo, which only ever means the way (RTE-02).+import { act, renderHook } from '@testing-library/react';+import { afterEach, describe, expect, it, vi } from 'vitest';+import { APPLIED_HINT_MS, useAppliedWayHint } from './useAppliedWayHint';++const BEFORE = [{ id: 'a' }, { id: 'b' }];+const AFTER = [{ id: 'a' }, { id: 's' }, { id: 'b' }];++function setup(undo = vi.fn()) {+ const view = renderHook(({ points }: { points: readonly unknown[] }) => useAppliedWayHint(points, undo), {+ initialProps: { points: BEFORE as readonly unknown[] },+ });+ return { view, undo };+}++afterEach(() => {+ vi.useRealTimers();+});++describe('useAppliedWayHint', () => {+ it('FE-TOUR-APPLIED-WAY-HINT-001: shows once the way is written, and its undo takes exactly that back', () => {+ const { view, undo } = setup();+ expect(view.result.current.view.shown).toBe(false);+ act(() => view.result.current.note(BEFORE));+ // Noted, but nothing written yet: nothing to take back.+ expect(view.result.current.view.shown).toBe(false);+ view.rerender({ points: AFTER });+ expect(view.result.current.view.shown).toBe(true);+ expect(view.result.current.view.key).toBe(1);++ act(() => view.result.current.view.undo());+ expect(undo).toHaveBeenCalledTimes(1);+ expect(view.result.current.view.shown).toBe(false);+ // Gone, it takes nothing back a second time.+ act(() => view.result.current.view.undo());+ expect(undo).toHaveBeenCalledTimes(1);+ });++ it('FE-TOUR-APPLIED-WAY-HINT-002: goes as soon as anything else changes the points', () => {+ const { view } = setup();+ act(() => view.result.current.note(BEFORE));+ view.rerender({ points: AFTER });+ view.rerender({ points: [...AFTER, { id: 'c' }] });+ expect(view.result.current.view.shown).toBe(false);+ });++ it('FE-TOUR-APPLIED-WAY-HINT-003: goes by itself after a while, unless the pointer rests on it', () => {+ vi.useFakeTimers();+ const { view } = setup();+ act(() => view.result.current.note(BEFORE));+ view.rerender({ points: AFTER });+ act(() => view.result.current.view.hold(true));+ act(() => vi.advanceTimersByTime(APPLIED_HINT_MS * 2));+ expect(view.result.current.view.shown).toBe(true);+ act(() => view.result.current.view.hold(false));+ act(() => vi.advanceTimersByTime(APPLIED_HINT_MS));+ expect(view.result.current.view.shown).toBe(false);+ });++ it('FE-TOUR-APPLIED-WAY-HINT-004: a second way taken gets a note of its own', () => {+ const { view } = setup();+ act(() => view.result.current.note(BEFORE));+ view.rerender({ points: AFTER });+ const later = [...AFTER, { id: 't' }];+ act(() => view.result.current.note(AFTER));+ view.rerender({ points: later });+ expect(view.result.current.view).toMatchObject({ shown: true, key: 2 });+ });+});diff --git a/client/src/components/Tours/planner/useAppliedWayHint.ts b/client/src/components/Tours/planner/useAppliedWayHint.tsnew file mode 100644index 000000000..15ad4b504--- /dev/null+++ b/client/src/components/Tours/planner/useAppliedWayHint.ts@@ -0,0 +1,58 @@+import { useCallback, useEffect, useState } from 'react';++/** How long the note stays up after a way was taken, unless the pointer rests on it. */+export const APPLIED_HINT_MS = 4000;++interface Applied {+ id: number;+ /** The points before the way was written, to spot the list the write produced. */+ before: readonly unknown[];+ /** The list right after the write; any other list means something came after it. */+ after: readonly unknown[] | null;+}++/**+ * RTE-02: the "way taken" note over the map after a section took another way,+ * with the undo that takes exactly that back. It goes as soon as anything else+ * changes the points, so the editor's undo, which reverts the latest step,+ * always means the way.+ */+export function useAppliedWayHint(waypoints: readonly unknown[], undo: () => void) {+ const [applied, setApplied] = useState<Applied | null>(null);+ const [count, setCount] = useState(0);+ const [held, setHeld] = useState(false);++ // Adjusted while rendering: the write lands in a render of its own after the note.+ if (applied && applied.after === null && waypoints !== applied.before) {+ setApplied({ ...applied, after: waypoints });+ } else if (applied?.after && waypoints !== applied.after) {+ setApplied(null);+ }++ const shown = !!applied?.after && applied.after === waypoints;+ const shownId = shown ? applied.id : null;++ useEffect(() => {+ if (shownId === null || held) return;+ const timer = window.setTimeout(() => setApplied(null), APPLIED_HINT_MS);+ return () => window.clearTimeout(timer);+ }, [held, shownId]);++ /** Called with the points as they were right before the way is written. */+ const note = useCallback(+ (before: readonly unknown[]) => {+ setHeld(false);+ setCount(count + 1);+ setApplied({ id: count + 1, before, after: null });+ },+ [count]+ );++ const undoApplied = useCallback(() => {+ if (!shown) return;+ setApplied(null);+ undo();+ }, [shown, undo]);++ return { note, view: { shown, key: shownId, undo: undoApplied, hold: setHeld } };+}diff --git a/client/src/components/Tours/planner/useLegVariants.test.tsx b/client/src/components/Tours/planner/useLegVariants.test.tsxnew file mode 100644index 000000000..3bc39774d--- /dev/null+++ b/client/src/components/Tours/planner/useLegVariants.test.tsx@@ -0,0 +1,263 @@+// FE-TOUR-USE-LEG-VARIANTS-001 to FE-TOUR-USE-LEG-VARIANTS-010: comparing the ways of a hike's+// section, choosing one on purpose and holding it by shaping points as one step (RTE-02).+import { act, renderHook, waitFor } from '@testing-library/react';+import { beforeEach, describe, expect, it, vi } from 'vitest';+import type { OtherWaysAnswer } from './legVariantRouting';+import type { LegVariant } from './legVariants';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';++const { askOtherWays, routeSection, pinAlternative } = vi.hoisted(() => ({+ askOtherWays: vi.fn(),+ routeSection: vi.fn(),+ pinAlternative: vi.fn(),+}));++vi.mock('./legVariantRouting', () => ({ askOtherWays, routeSection }));+vi.mock('../../Roadtrip/alternativePins', () => ({ pinAlternative }));++import { useLegVariants, type LegVariantsOptions } from './useLegVariants';++const A: TourPlannerWaypoint = { id: 'a', lat: 47.0, lng: 11.0, role: 'start' };+const B: TourPlannerWaypoint = { id: 'b', lat: 47.0, lng: 11.02, role: 'via' };+const C: TourPlannerWaypoint = { id: 'c', lat: 47.01, lng: 11.02, role: 'end' };+const ROUTE: [number, number][] = [+ [47.0, 11.0],+ [47.001, 11.01],+ [47.0, 11.02],+ [47.005, 11.021],+ [47.01, 11.02],+];+const OTHER: LegVariant = {+ key: 'a',+ current: false,+ direct: false,+ coordinates: [+ [47.0, 11.0],+ [47.03, 11.01],+ [47.0, 11.02],+ ],+ distanceM: 6800,+ gainM: null,+ lossM: null,+ minutes: null,+ heights: 'pending',+};++/** What a test answers for the comparison it opens: the router's reports, sent in order. */+let answers: OtherWaysAnswer[] = [];++function options(overrides: Partial<LegVariantsOptions> = {}): LegVariantsOptions {+ return {+ waypoints: [A, B, C],+ route: ROUTE,+ enrichedGeometry: null,+ routeCurrent: true,+ tourType: 'hike',+ maxHikingDifficulty: 2,+ hikingPreferences: null,+ insertShapingPoints: vi.fn(() => ['s1']),+ recomputeLeg: vi.fn(),+ undo: vi.fn(),+ mayEdit: () => true,+ ...overrides,+ };+}++function setup(initial: LegVariantsOptions = options()) {+ return renderHook((props: LegVariantsOptions) => useLegVariants(props), { initialProps: initial });+}++/** Opens the comparison of the leg after `a` and lets the router's answers arrive. */+async function compared(view: ReturnType<typeof setup>) {+ act(() => view.result.current.compare('a'));+ await waitFor(() => expect(view.result.current.comparison?.phase).not.toBe('loading'));+}++beforeEach(() => {+ vi.clearAllMocks();+ answers = [];+ askOtherWays.mockImplementation(+ async (_leg: unknown, current: LegVariant, _signal: AbortSignal, report: (answer: OtherWaysAnswer) => void) => {+ // The router answers later, never inside the render that asked.+ await Promise.resolve();+ for (const answer of answers) {+ report({ ...answer, variants: answer.variants.map((variant) => (variant.current ? current : variant)) });+ }+ }+ );+});++describe('useLegVariants', () => {+ it('FE-TOUR-USE-LEG-VARIANTS-001: only a routed leg of a hike whose route is planned for the points can be compared', () => {+ const view = setup();+ expect(view.result.current.canCompare('a')).toBe(true);+ expect(view.result.current.canCompare('c')).toBe(false);+ view.rerender(options({ routeCurrent: false }));+ expect(view.result.current.canCompare('a')).toBe(false);+ view.rerender(options({ tourType: 'bike' }));+ expect(view.result.current.canCompare('a')).toBe(false);+ view.rerender(options({ route: null }));+ expect(view.result.current.canCompare('a')).toBe(false);+ });++ it('FE-TOUR-USE-LEG-VARIANTS-002: opens on the section with the way taken now, asked under the hike’s rules', async () => {+ answers = [{ phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, OTHER] }];+ const view = setup(options({ maxHikingDifficulty: 4, hikingPreferences: { avoid_steps: true } }));+ act(() => view.result.current.compare('a'));+ expect(view.result.current.comparison).toMatchObject({ phase: 'loading', selected: null, proving: false });+ expect(view.result.current.comparison?.variants.map((v) => v.key)).toEqual(['current']);+ await waitFor(() => expect(view.result.current.comparison?.phase).toBe('choose'));++ const [leg] = askOtherWays.mock.calls[0];+ expect(leg).toMatchObject({ fromId: 'a', toId: 'b', costing: { max_hiking_difficulty: 4, step_penalty: 600 } });+ expect(view.result.current.comparison?.variants.map((v) => v.key)).toEqual(['current', 'a']);+ // The way taken now is the route's own stretch between the two points.+ expect(view.result.current.comparison?.variants[0].coordinates).toEqual(ROUTE.slice(0, 3));+ });++ it('FE-TOUR-USE-LEG-VARIANTS-003: hovering and choosing light a way up; closing changes nothing', async () => {+ answers = [{ phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, OTHER] }];+ const insertShapingPoints = vi.fn(() => ['s1']);+ const view = setup(options({ insertShapingPoints }));+ await compared(view);+ act(() => view.result.current.select('a'));+ expect(view.result.current.comparison?.selected).toBe('a');+ expect(view.result.current.focus).toBe('a');+ act(() => view.result.current.hover('current'));+ expect(view.result.current.focus).toBe('current');+ act(() => view.result.current.hover(null));+ act(() => view.result.current.close());+ expect(view.result.current.comparison).toBeNull();+ expect(view.result.current.focus).toBeNull();+ expect(insertShapingPoints).not.toHaveBeenCalled();+ expect(pinAlternative).not.toHaveBeenCalled();+ });++ it('FE-TOUR-USE-LEG-VARIANTS-004: a chosen way the router keeps to is held by its pins as one step, and the card closes', async () => {+ answers = [{ phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, OTHER] }];+ pinAlternative.mockResolvedValue({ held: true, pins: [{ lat: 47.03, lng: 11.01 }], fellBack: false, last: {} });+ routeSection.mockResolvedValue({ coordinates: OTHER.coordinates, distance: 6800, duration: 0 });+ const insertShapingPoints = vi.fn(() => ['s1']);+ const view = setup(options({ insertShapingPoints }));+ await compared(view);+ act(() => view.result.current.select('a'));+ await act(async () => view.result.current.apply());++ const [{ offer, current, route }] = pinAlternative.mock.calls[0];+ expect(offer).toMatchObject({ coordinates: OTHER.coordinates, direct: false });+ expect(current.coordinates).toEqual(ROUTE.slice(0, 3));+ await route([{ lat: 1, lng: 2 }], new AbortController().signal);+ expect(routeSection).toHaveBeenCalledWith(+ expect.objectContaining({ fromId: 'a', toId: 'b' }),+ [{ lat: 1, lng: 2 }],+ expect.any(AbortSignal)+ );+ expect(insertShapingPoints).toHaveBeenCalledWith('a', 'b', [{ lat: 47.03, lng: 11.01 }]);+ expect(view.result.current.comparison).toBeNull();+ });++ it('FE-TOUR-USE-LEG-VARIANTS-005: a way the router does not keep to changes nothing and says so', async () => {+ answers = [{ phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, OTHER] }];+ pinAlternative.mockResolvedValue({ held: false, pins: [], fellBack: false, last: {} });+ const insertShapingPoints = vi.fn(() => ['s1']);+ const view = setup(options({ insertShapingPoints }));+ await compared(view);+ act(() => view.result.current.select('a'));+ await act(async () => view.result.current.apply());+ expect(view.result.current.comparison).toMatchObject({ notice: 'notHeld', proving: false, selected: 'a' });+ expect(insertShapingPoints).not.toHaveBeenCalled();+ });++ it('FE-TOUR-USE-LEG-VARIANTS-006: a router that fails the check changes nothing; the way taken now is no choice to apply', async () => {+ answers = [{ phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, OTHER] }];+ pinAlternative.mockRejectedValue(new Error('No route found'));+ const view = setup();+ await compared(view);+ act(() => view.result.current.select('current'));+ await act(async () => view.result.current.apply());+ expect(pinAlternative).not.toHaveBeenCalled();++ act(() => view.result.current.select('a'));+ await act(async () => view.result.current.apply());+ expect(view.result.current.comparison?.notice).toBe('failed');+ });++ it("FE-TOUR-USE-LEG-VARIANTS-007: the router's own way needs no pin: the leg is only planned again", async () => {+ answers = [+ { phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, { ...OTHER, direct: true }] },+ ];+ pinAlternative.mockResolvedValue({ held: true, pins: [], fellBack: false, last: {} });+ const recomputeLeg = vi.fn();+ const insertShapingPoints = vi.fn(() => ['s1']);+ const view = setup(options({ recomputeLeg, insertShapingPoints }));+ await compared(view);+ act(() => view.result.current.select('a'));+ await act(async () => view.result.current.apply());+ expect(recomputeLeg).toHaveBeenCalledWith('a');+ expect(insertShapingPoints).not.toHaveBeenCalled();+ expect(view.result.current.comparison).toBeNull();+ });++ it('FE-TOUR-USE-LEG-VARIANTS-008: a choice checked while the section changed is not written; a refused write says stale too', async () => {+ answers = [{ phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, OTHER] }];+ let release: (value: unknown) => void = () => undefined;+ pinAlternative.mockImplementation(() => new Promise((resolve) => (release = resolve)));+ const insertShapingPoints = vi.fn(() => null);+ const view = setup(options({ insertShapingPoints }));+ await compared(view);+ act(() => view.result.current.select('a'));+ let applying: Promise<void> = Promise.resolve();+ act(() => {+ applying = view.result.current.apply();+ });+ expect(view.result.current.comparison?.proving).toBe(true);+ // The limit changes while the router is asked: the answer is for another section now.+ view.rerender(options({ insertShapingPoints, maxHikingDifficulty: 5 }));+ await act(async () => {+ release({ held: true, pins: [{ lat: 47.03, lng: 11.01 }], fellBack: false, last: {} });+ await applying;+ });+ expect(view.result.current.comparison).toBeNull();+ expect(insertShapingPoints).not.toHaveBeenCalled();++ pinAlternative.mockResolvedValue({ held: true, pins: [{ lat: 47.03, lng: 11.01 }], fellBack: false, last: {} });+ await compared(view);+ act(() => view.result.current.select('a'));+ await act(async () => view.result.current.apply());+ expect(insertShapingPoints).toHaveBeenCalledTimes(1);+ expect(view.result.current.comparison?.notice).toBe('stale');+ });++ it('FE-TOUR-USE-LEG-VARIANTS-009: a moved point closes the comparison; an answer arriving after it is dropped', async () => {+ let late: ((answer: OtherWaysAnswer) => void) | null = null;+ askOtherWays.mockImplementationOnce(+ async (_leg: unknown, _current: unknown, _signal: unknown, report: (answer: OtherWaysAnswer) => void) => {+ late = report;+ }+ );+ const view = setup();+ act(() => view.result.current.compare('a'));+ view.rerender(options({ waypoints: [A, { ...B, lat: 47.002 }, C] }));+ expect(view.result.current.comparison).toBeNull();+ act(() => late?.({ phase: 'choose', variants: [OTHER] }));+ expect(view.result.current.comparison).toBeNull();+ // Nothing to compare without a planned stretch for the leg.+ view.rerender(options({ route: null }));+ act(() => view.result.current.compare('a'));+ expect(view.result.current.comparison).toBeNull();+ });++ it('FE-TOUR-USE-LEG-VARIANTS-010: nothing is checked while the tour may not change; the way taken now follows its heights', async () => {+ answers = [{ phase: 'choose', variants: [{ ...OTHER, key: 'current', current: true }, OTHER] }];+ const view = setup(options({ mayEdit: () => false }));+ await compared(view);+ act(() => view.result.current.select('a'));+ await act(async () => view.result.current.apply());+ expect(pinAlternative).not.toHaveBeenCalled();+ expect(view.result.current.comparison?.variants[0].heights).toBe('unknown');++ const heights = ROUTE.map(([lat, lng], i): [number, number, number] => [lat, lng, 1000 + i * 10]);+ view.rerender(options({ mayEdit: () => false, enrichedGeometry: heights }));+ expect(view.result.current.comparison?.variants[0]).toMatchObject({ heights: 'known', gainM: 20 });+ });+});diff --git a/client/src/components/Tours/planner/useLegVariants.ts b/client/src/components/Tours/planner/useLegVariants.tsnew file mode 100644index 000000000..68814fb0e--- /dev/null+++ b/client/src/components/Tours/planner/useLegVariants.ts@@ -0,0 +1,219 @@+import type { HikingPreferences, PlannableTourType, TourMaxHikingDifficulty } from '@trek/shared';+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';+import type { CostingOptions } from '../../Map/valhallaRoute';+import { pinAlternative } from '../../Roadtrip/alternativePins';+import { hikingCosting } from './hikingCosting';+import { askOtherWays, routeSection, type OtherWaysAnswer } from './legVariantRouting';+import {+ comparedLegOf,+ currentVariantOf,+ isComparableLeg,+ type ComparedLeg,+ type LegVariant,+ type LegVariantKey,+} from './legVariants';+import type { TourPlannerWaypoint } from './tourPlannerWaypoints';+import type { TourElevationPoint } from './tourRouting';+import { useAppliedWayHint } from './useAppliedWayHint';++/** Why the last choice changed nothing: the router does not keep to it, it did not answer, or the section changed meanwhile. */+type LegVariantNotice = 'notHeld' | 'failed' | 'stale';++/** One comparison asked: its section as it stood, and the way it took then. */+interface Request {+ token: number;+ leg: ComparedLeg;+ current: LegVariant;+}++/** What the open comparison shows: its section, where the answer stands, the ways and the choice. */+export interface LegComparison {+ leg: ComparedLeg;+ phase: 'loading' | OtherWaysAnswer['phase'];+ variants: LegVariant[];+ selected: LegVariantKey | null;+ /** True while a choice is checked against the router before it is written. */+ proving: boolean;+ notice: LegVariantNotice | null;+}++export interface LegVariantsOptions {+ waypoints: TourPlannerWaypoint[];+ route: [number, number][] | null;+ enrichedGeometry: TourElevationPoint[] | null;+ /** The route drawn was planned for these points and choices. */+ routeCurrent: boolean;+ tourType: PlannableTourType;+ maxHikingDifficulty: TourMaxHikingDifficulty;+ hikingPreferences: HikingPreferences | null;+ /** Sets the shaping points that hold a way, as one step of the history; their ids, or null when refused. */+ insertShapingPoints: (+ afterId: string,+ beforeId: string,+ spots: ReadonlyArray<{ lat: number; lng: number }>+ ) => string[] | null;+ /** Plans the leg after a point afresh, for the router's own way, which needs no shaping point. */+ recomputeLeg: (id: string) => void;+ undo: () => void;+ /** Whether the route may change now: the permission held and no save under way. */+ mayEdit: () => boolean;+}++/**+ * A checked choice written into the tour: held by its pins as one step of the+ * history, or, for the router's own way, the leg planned again. `stale` when+ * the section is another one by now, so nothing lands where it was not asked.+ */+function writeChoice(+ leg: ComparedLeg,+ pins: ReadonlyArray<{ lat: number; lng: number }>,+ { options, costing }: { options: LegVariantsOptions; costing: CostingOptions }+): 'written' | 'replanned' | 'stale' {+ if (comparedLegOf(options.waypoints, leg.fromId, options.tourType, costing)?.key !== leg.key) return 'stale';+ if (pins.length === 0) {+ options.recomputeLeg(leg.fromId);+ return 'replanned';+ }+ return options.insertShapingPoints(leg.fromId, leg.toId, pins) ? 'written' : 'stale';+}++const sameRequest = <T extends { token: number }>(value: T | null, request: Request | null): value is T =>+ !!value && !!request && value.token === request.token;++/**+ * RTE-02: other ways for one routed section of a hike, compared and taken on+ * purpose. The section and the rules it is routed under are fixed when it is+ * asked; once the tour makes it another section (a point moved, one set in+ * between, another limit), the comparison closes, so an answer worked out for+ * one section never lands in another. Showing and closing change nothing; a+ * choice is checked against the router and held by shaping points as one step+ * of the history, or the section stays as it was and the card says why.+ */+export function useLegVariants(options: LegVariantsOptions) {+ const { waypoints, route, enrichedGeometry, routeCurrent, tourType, maxHikingDifficulty, hikingPreferences } =+ options;+ const costing = useMemo(+ () => hikingCosting(maxHikingDifficulty, hikingPreferences),+ [hikingPreferences, maxHikingDifficulty]+ );+ const [request, setRequest] = useState<Request | null>(null);+ const [answer, setAnswer] = useState<(OtherWaysAnswer & { token: number }) | null>(null);+ const [choice, setChoice] = useState<{ token: number; key: LegVariantKey } | null>(null);+ const [proof, setProof] = useState<{ token: number; state: 'proving' | LegVariantNotice } | null>(null);+ const [hovered, setHovered] = useState<LegVariantKey | null>(null);+ const tokenRef = useRef(0);+ // The open comparison's own signal: it ends the questions and a check of a choice alike.+ const askRef = useRef<AbortController | null>(null);+ // The latest of what a choice is written into, read after the router answered.+ const latest = useRef({ options, costing });+ useLayoutEffect(() => {+ latest.current = { options, costing };+ });+ const { note: noteApplied, view: appliedHint } = useAppliedWayHint(waypoints, options.undo);++ // The section changed under the comparison: it is another one now, so the comparison goes.+ const legNow = request ? comparedLegOf(waypoints, request.leg.fromId, tourType, costing) : null;+ if (request && legNow?.key !== request.leg.key) setRequest(null);++ useEffect(() => {+ if (!request) return;+ const controller = new AbortController();+ askRef.current = controller;+ void askOtherWays(request.leg, request.current, controller.signal, (found) =>+ setAnswer({ ...found, token: request.token })+ );+ return () => controller.abort();+ }, [request]);++ const canCompare = useCallback(+ (id: string) => {+ const index = waypoints.findIndex((point) => point.id === id);+ return routeCurrent && !!route && isComparableLeg(waypoints, index, tourType);+ },+ [route, routeCurrent, tourType, waypoints]+ );++ const compare = useCallback(+ (id: string) => {+ const leg = comparedLegOf(waypoints, id, tourType, costing);+ const index = waypoints.findIndex((point) => point.id === id);+ const current = routeCurrent ? currentVariantOf(waypoints, index, route, enrichedGeometry) : null;+ if (!leg || !current) return;+ tokenRef.current += 1;+ setHovered(null);+ setRequest({ token: tokenRef.current, leg, current });+ },+ [costing, enrichedGeometry, route, routeCurrent, tourType, waypoints]+ );++ const close = useCallback(() => {+ setRequest(null);+ setHovered(null);+ }, []);++ const select = useCallback(+ (key: LegVariantKey) => {+ if (request) setChoice({ token: request.token, key });+ },+ [request]+ );++ // The way taken now as the route has it at this moment, its heights included once they are in.+ const liveCurrent = useMemo(() => {+ if (!request) return null;+ const index = waypoints.findIndex((point) => point.id === request.leg.fromId);+ return currentVariantOf(waypoints, index, route, enrichedGeometry);+ }, [enrichedGeometry, request, route, waypoints]);++ const comparison = useMemo((): LegComparison | null => {+ if (!request) return null;+ const found = sameRequest(answer, request) ? answer : null;+ const current = liveCurrent ?? request.current;+ const checked = sameRequest(proof, request) ? proof.state : null;+ return {+ leg: request.leg,+ phase: found?.phase ?? 'loading',+ variants: (found?.variants ?? [request.current]).map((variant) => (variant.current ? current : variant)),+ selected: sameRequest(choice, request) ? choice.key : null,+ proving: checked === 'proving',+ notice: checked === 'proving' ? null : checked,+ };+ }, [answer, choice, liveCurrent, proof, request]);++ const apply = useCallback(async () => {+ const selected = comparison?.selected;+ const chosen = comparison?.variants.find((variant) => variant.key === selected);+ const signal = askRef.current?.signal;+ if (!request || !comparison || comparison.proving || !chosen || chosen.current || !signal) return;+ if (!latest.current.options.mayEdit()) return;+ const settle = (state: 'proving' | LegVariantNotice) => setProof({ token: request.token, state });+ settle('proving');+ try {+ const pinned = await pinAlternative({+ offer: {+ coordinates: chosen.coordinates,+ distance: chosen.distanceM,+ duration: 0,+ divergence: null,+ direct: chosen.direct,+ },+ current: { coordinates: request.current.coordinates, distance: request.current.distanceM, duration: 0 },+ route: (pins, routeSignal) => routeSection(request.leg, pins, routeSignal),+ signal,+ });+ if (signal.aborted) return;+ const before = latest.current.options.waypoints;+ const outcome = pinned.held ? writeChoice(request.leg, pinned.pins, latest.current) : 'notHeld';+ if (outcome === 'written') noteApplied(before);+ if (outcome === 'written' || outcome === 'replanned') close();+ else settle(outcome);+ } catch {+ if (!signal.aborted) settle('failed');+ }+ }, [close, comparison, noteApplied, request]);++ const variantKeys = comparison?.variants.map((variant) => variant.key) ?? [];+ const focus = hovered && variantKeys.includes(hovered) ? hovered : (comparison?.selected ?? null);++ return { comparison, focus, canCompare, compare, select, hover: setHovered, apply, close, appliedHint };+}diff --git a/client/src/components/Tours/planner/useRouteShaping.ts b/client/src/components/Tours/planner/useRouteShaping.tsindex 218d1b305..ba4f3b29d 100644--- a/client/src/components/Tours/planner/useRouteShaping.ts+++ b/client/src/components/Tours/planner/useRouteShaping.ts@@ -1,14 +1,21 @@import { useCallback, type RefObject } from 'react';import { randomId } from '../../../utils/randomId';-import { withDrawnLegsRouted, withShaping, withShapingPoint, type TourPlannerWaypoint } from './tourPlannerWaypoints';+import {+ withDrawnLegsRouted,+ withShaping,+ withShapingPoint,+ withShapingPoints,+ type TourPlannerWaypoint,+} from './tourPlannerWaypoints';type Commit = (change: (current: TourPlannerWaypoint[]) => TourPlannerWaypoint[]) => void;/**- * P2A-03, P2A-05 and PAD-11: the editor's tools for the line between the- * stops. A shaping point steers the route without being a stop, a routed leg- * can be planned afresh, and a paddle tour's legs drawn by hand go back to the- * router in one step. Each change is one step of the history, through the+ * P2A-03, P2A-05, PAD-11 and RTE-02: the editor's tools for the line between+ * the stops. A shaping point steers the route without being a stop, a way+ * chosen for a leg is held by a few of them, a routed leg can be planned+ * afresh, and a paddle tour's legs drawn by hand go back to the router in one+ * step. Each change is one step of the history, through the* planner's own commit; nothing here plans a route itself.*/export function useRouteShaping({@@ -42,6 +49,24 @@ export function useRouteShaping({[commit, mayEdit, waypointsRef]);+ /**+ * RTE-02: the shaping points that hold a chosen way between two neighbouring+ * points, set as one step of the history; their ids, or null when the two+ * are no longer neighbours, so nothing is written into a leg the choice was+ * not made for.+ */+ const insertShapingPoints = useCallback(+ (afterId: string, beforeId: string, spots: ReadonlyArray<{ lat: number; lng: number }>) => {+ if (!mayEdit() || spots.some((spot) => !Number.isFinite(spot.lat) || !Number.isFinite(spot.lng))) return null;+ const shapes = spots.map(({ lat, lng }) => ({ id: randomId(), lat, lng }));+ const points = waypointsRef.current;+ if (withShapingPoints(points, afterId, beforeId, shapes) === points) return null;+ commit((current) => withShapingPoints(current, afterId, beforeId, shapes));+ return shapes.map((shape) => shape.id);+ },+ [commit, mayEdit, waypointsRef]+ );+const setWaypointShaping = useCallback((id: string, shaping: boolean) => {if (mayEdit()) commit((current) => withShaping(current, id, shaping));@@ -67,5 +92,5 @@ export function useRouteShaping({[forgetLeg, isPaddle, retry, waypointsRef]);- return { insertShapingPoint, setWaypointShaping, routeDrawnLegsOnWater, recomputeLeg };+ return { insertShapingPoint, insertShapingPoints, setWaypointShaping, routeDrawnLegsOnWater, recomputeLeg };}diff --git a/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsx b/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsxindex f6ca6f217..b1485434e 100644--- a/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsx+++ b/client/src/components/Tours/planner/useTourPlanner.routeTools.test.tsx@@ -442,6 +442,37 @@ describe('useTourPlanner route tools', () => {);});+ it('holds a way chosen for a leg by its shaping points as one step, which one undo takes back (RTE-02)', () => {+ const { result } = plannerWith([+ [48, 11],+ [48.02, 11.02],+ [48.04, 11],+ ]);+ const [start, middle] = result.current.waypoints;+ const pins = [+ { lat: 48.005, lng: 11.01 },+ { lat: 48.012, lng: 11.015 },+ ];+ let ids: string[] | null = null;+ act(() => {+ ids = result.current.insertShapingPoints(must(start).id, must(middle).id, pins);+ });+ expect(result.current.waypoints.map((point) => !!point.shaping)).toEqual([false, true, true, false, false]);+ expect(result.current.waypoints.slice(1, 3).map((point) => point.id)).toEqual(ids);+ expect(coordinatesOf(result.current.waypoints.slice(1, 3))).toEqual(pins.map((pin) => [pin.lat, pin.lng]));+ act(() => {+ // No longer neighbours, or a spot that is none: nothing is written.+ expect(result.current.insertShapingPoints(must(start).id, must(middle).id, pins)).toBeNull();+ expect(result.current.insertShapingPoints(must(middle).id, 'gone', pins)).toBeNull();+ expect(+ result.current.insertShapingPoints(must(start).id, must(ids)[0], [{ lat: Number.NaN, lng: 11 }])+ ).toBeNull();+ });+ expect(result.current.legVariants.comparison).toBeNull();+ act(() => result.current.undo());+ expect(result.current.waypoints).toHaveLength(3);+ });+it('plans a leg afresh: a paddle leg is forgotten and asked again, a fixed leg is left alone', async () => {const { result } = plannerWith([[48, 11],diff --git a/client/src/components/Tours/planner/useTourPlanner.ts b/client/src/components/Tours/planner/useTourPlanner.tsindex 95091f352..a79d2d365 100644--- a/client/src/components/Tours/planner/useTourPlanner.ts+++ b/client/src/components/Tours/planner/useTourPlanner.ts@@ -14,6 +14,7 @@ import { usePlannerHistory } from './usePlannerHistory'import { useTourDraftStorage } from './useTourDraftStorage'import { useTourRevisionGuard } from './useTourRevisionGuard'import { useRouteShaping } from './useRouteShaping'+import { useLegVariants } from './useLegVariants'import { useTourMapView } from './useTourMapView'import type { DraftPayload, DraftSource } from './tourPlannerDraft'import { paddleEstimateOf } from './paddlePlanOf'@@ -792,13 +793,18 @@ export function useTourPlanner({ tripId, active = true, onSaved, canEdit: editPe}, [interruptRouting])// P2A-03/P2A-05/PAD-11: shaping points, a leg planned afresh, drawn legs handed back to the router.+ const mayEditRoute = useCallback(() => editPermissionRef.current && !saveInFlightRef.current, [])const shaping = useRouteShaping({- commit: commitWaypoints, waypointsRef, retry,- mayEdit: useCallback(() => editPermissionRef.current && !saveInFlightRef.current, []),+ commit: commitWaypoints, waypointsRef, retry, mayEdit: mayEditRoute,isPaddle: useCallback(() => tourTypeRef.current === 'kayak', []),forgetLeg: useCallback((from: TourPlannerWaypoint, to: TourPlannerWaypoint) =>paddleRouteRepo.forget(tripId, from, to, { boat: paddleBoat ?? 'kayak', lakeStyle: paddleLakeStyle }), [paddleBoat, paddleLakeStyle, tripId]),})+ // RTE-02: other ways for one routed section of a hike, compared and taken on purpose.+ const legVariants = useLegVariants({+ waypoints, route, enrichedGeometry, routeCurrent, tourType, maxHikingDifficulty, hikingPreferences, undo, mayEdit: mayEditRoute,+ insertShapingPoints: shaping.insertShapingPoints, recomputeLeg: shaping.recomputeLeg,+ })const readOnlyGpxAnalysis = useMemo(() => analyzeRouteGeometry(readOnlyGpxTour?.routeGeometry),@@ -930,7 +936,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, paddleRoute, routeCurrent,+ ...shaping, legVariants, 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/components/Tours/terrain/TourTerrainMap.tsx b/client/src/components/Tours/terrain/TourTerrainMap.tsxindex 6a37c5a55..292f45a13 100644--- a/client/src/components/Tours/terrain/TourTerrainMap.tsx+++ b/client/src/components/Tours/terrain/TourTerrainMap.tsx@@ -18,6 +18,7 @@ import { tourRasterBaseOf } from '../../Map/tourRasterBases';import { SoftPill } from '../../Planner/planParts';import { fs } from '../../shared/DialogShell';import { Tooltip } from '../../shared/Tooltip';+import type { TrackOverlay } from './terrainLayers';import { GRADE_BANDS, terrainStats, type GradeBandKey, type TerrainStats } from './tourTerrainModel';import { useControlRowFit } from './useControlRowFit';import type { TerrainWaypoints } from './useTerrainPins';@@ -52,6 +53,8 @@ export interface TourTerrainMapProps {placeTool?: MapPlaceTool;/** The grade legend's width and how far its open bands reach above it, for a card that sits on it; null while there is none. */onLegendLayout?: (layout: TerrainLegendLayout | null) => void;+ /** RTE-02: the ways of a section being compared, laid over the track in their own colours. */+ overlays?: readonly TrackOverlay[];}export interface TerrainLegendLayout {diff --git a/client/src/components/Tours/terrain/terrainLayers.test.ts b/client/src/components/Tours/terrain/terrainLayers.test.tsindex c5b90d59b..f1e58dbf0 100644--- a/client/src/components/Tours/terrain/terrainLayers.test.ts+++ b/client/src/components/Tours/terrain/terrainLayers.test.ts@@ -100,6 +100,23 @@ describe('trackData', () => {]);expect(trackData([], null, 'grade', '#0a84ff').features).toEqual([]);});++ it('lays the ways of a compared section over the track, each in its own colour, a line too short left out (RTE-02)', () => {+ const north: [number, number][] = [+ [46, 7],+ [46.01, 7.002],+ ];+ const data = trackData(climb, null, 'grade', '#0a84ff', [+ { coordinates: north, color: '#f97316' },+ { coordinates: [[46, 7]], color: '#d946ef' },+ ]);+ expect(data.features).toHaveLength(4);+ expect(data.features[3].properties.color).toBe('#f97316');+ expect(data.features[3].geometry.coordinates).toEqual([+ [7, 46],+ [7.002, 46.01],+ ]);+ });});describe('frameBounds', () => {diff --git a/client/src/components/Tours/terrain/terrainLayers.ts b/client/src/components/Tours/terrain/terrainLayers.tsindex cb986c82a..1fcf139be 100644--- a/client/src/components/Tours/terrain/terrainLayers.ts+++ b/client/src/components/Tours/terrain/terrainLayers.ts@@ -79,32 +79,39 @@ function line(color: string, coordinates: [number, number][]): TrackData['featurreturn { type: 'Feature', properties: { color }, geometry: { type: 'LineString', coordinates } };}-/** The open tour piece by piece in its grade colours, else every planner route in the tour colour. */+/** A line of the planner, [lat, lng] each, as the terrain's [lng, lat]; null for one too short to draw. */+function plannerLine(color: string, route: [number, number][]): TrackData['features'][number] | null {+ return route.length > 1 ? line(color, route.map(([lat, lng]) => [lng, lat] as [number, number])) : null;+}++/** A line laid over the track in its own colour, [lat, lng] each. */+export interface TrackOverlay {+ coordinates: [number, number][];+ color: string;+}++/**+ * The open tour piece by piece in its grade colours, else every planner route+ * in the tour colour; then the `overlays` over it, each in its own colour, as+ * the ways of a section being compared (RTE-02).+ */export function trackData(samples: DistanceIndexedProfileSample[],routes: [number, number][][] | null,mode: TrackColorMode,- trackColor: string+ trackColor: string,+ overlays: readonly TrackOverlay[] = []): TrackData {const segments = gradeSegments(samples);- if (segments.length) {- return {- type: 'FeatureCollection',- features: segments.map((segment) =>+ const track = segments.length+ ? segments.map((segment) =>line(mode === 'grade' ? gradeBand(segment.grade).paint : trackColor, [segment.from, segment.to])- ),- };- }+ )+ : (routes ?? []).map((route) => plannerLine(trackColor, route));+ const laid = overlays.map((overlay) => plannerLine(overlay.color, overlay.coordinates));return {type: 'FeatureCollection',- features: (routes ?? [])- .filter((route) => route.length > 1)- .map((route) =>- line(- trackColor,- route.map(([lat, lng]) => [lng, lat] as [number, number])- )- ),+ features: [...track, ...laid].filter((feature): feature is TrackData['features'][number] => feature !== null),};}diff --git a/client/src/components/Tours/terrain/useTourTerrain.ts b/client/src/components/Tours/terrain/useTourTerrain.tsindex e7bd0e070..1b1667dfb 100644--- a/client/src/components/Tours/terrain/useTourTerrain.ts+++ b/client/src/components/Tours/terrain/useTourTerrain.ts@@ -5,7 +5,7 @@ import type { FerrataMapLayer } from '../../Ferratas/useFerrataMapLayer';import type { TourBaseLayer, TourLayerOffer } from '../../Map/MapLayerSwitcher';import { useRasterOverlaysGL, type RasterOverlayGlMap } from '../../Map/mapRasterOverlay';import { usePaddleLayerGL, type PaddleGlMap } from '../paddle/usePaddleLayerGL';-import { trackData, type PanelWidths, type TrackColorMode } from './terrainLayers';+import { trackData, type PanelWidths, type TrackColorMode, type TrackOverlay } from './terrainLayers';import { useTerrainFerratas } from './useTerrainFerratas';import { frameCamera, useTerrainMap, type TerrainScene } from './useTerrainMap';import { useTerrainPins, type TerrainWaypoints } from './useTerrainPins';@@ -32,6 +32,8 @@ interface Options {onViewportChange?: (bbox: FerrataBbox, zoom: number) => void;/** A paddle tour: the route is never coloured by grade. */water?: boolean;+ /** RTE-02: the ways of a section being compared, over the track in their own colours. */+ overlays?: readonly TrackOverlay[];}/** The planner map's 3D mode: map, pins, corridor preload and the flyover sharing the rail's focus. */@@ -41,9 +43,10 @@ export function useTourTerrain(options: Options) {const [chosenColorMode, setColorMode] = useState<TrackColorMode>('grade');// Water is flat: a paddle tour keeps its tour colour, whatever was picked for a hike.const colorMode: TrackColorMode = options.water ? 'tour' : chosenColorMode;+ const { overlays } = options;const data = useMemo(- () => trackData(samples, routes, colorMode, trackColor),- [samples, routes, colorMode, trackColor]+ () => trackData(samples, routes, colorMode, trackColor, overlays),+ [samples, routes, colorMode, trackColor, overlays]);// The map's own handlers fire long after they were bound, so they read the latest props here.diff --git a/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx b/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsxindex c1971f4ab..39b6f97a8 100644--- a/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx+++ b/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx@@ -1,7 +1,8 @@-// FE-PAGE-TOURSTAGE-001 to FE-PAGE-TOURSTAGE-024+// FE-PAGE-TOURSTAGE-001 to FE-PAGE-TOURSTAGE-031import 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 { useTripFerratas } from '../../components/Ferratas/useTripFerratas';import type { MapViewProps } from '../../components/Map/mapViewContract';import { useTourMapView } from '../../components/Tours/planner/useTourMapView';@@ -135,6 +136,7 @@ function planner(toggleMapOverlay: vi.fn(),routeProfileFocus: null,setRouteProfileFocus: vi.fn(),+ legVariants: idleLegVariants(),...overrides,} as unknown as Planner;}@@ -537,7 +539,7 @@ describe('TourPlannerMapStage', () => {expect(stage.flatMap.props?.onRouteClick).toBeUndefined();});- it('FE-PAGE-TOURSTAGE-019: a run opens in 3D as any tour does, with its own maps, and back in 2D nothing of it changed (RUN-01)', async () => {+ it('FE-PAGE-TOURSTAGE-026: a run opens in 3D as any tour does, with its own maps, and back in 2D nothing of it changed (RUN-01)', async () => {const tourPlanner = planner('edit-saved', { tourType: 'run' });renderStage(tourPlanner);expect(stage.flatMap.props?.tourLayers?.bases).toEqual(['default', 'topo', 'satellite']);@@ -550,7 +552,7 @@ describe('TourPlannerMapStage', () => {expect(tourPlanner.undo).not.toHaveBeenCalled();});- it('FE-PAGE-TOURSTAGE-020: an imported ski track flies in 3D with its grade colours and its own maps, and the switch changes nothing of it (SKI-02)', async () => {+ it('FE-PAGE-TOURSTAGE-027: an imported ski track flies in 3D with its grade colours and its own maps, and the switch changes nothing of it (SKI-02)', async () => {const samples = [0, 1, 2].map((i) => ({distanceMeters: i * 100,elevationMeters: 1200 + i * 40,@@ -571,6 +573,45 @@ describe('TourPlannerMapStage', () => {expect(tourPlanner.undo).not.toHaveBeenCalled();});+ it('FE-PAGE-TOURSTAGE-019: while a section is compared its card is up, and a click on the route sets no shaping point (RTE-02)', () => {+ const route = [+ [46, 7],+ [46.2, 7.2],+ ];+ const 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 waypoints = [+ { id: 'w1', lat: 46, lng: 7 },+ { id: 'w2', lat: 46.2, lng: 7.2 },+ ];+ renderStage(planner('new-draft', { waypoints, route, canEdit: true }));+ expect(stage.flatMap.props?.onRouteClick).toBeDefined();+ expect(screen.queryByTestId('leg-variants-card')).not.toBeInTheDocument();++ const legVariants = { ...idleLegVariants(), comparison };+ renderStage(planner('new-draft', { waypoints, route, canEdit: true, legVariants }));+ expect(stage.flatMap.props?.onRouteClick).toBeUndefined();+ expect(screen.getByTestId('leg-variants-card')).toBeInTheDocument();+ });++ it('FE-PAGE-TOURSTAGE-020: "way taken" shows above the bottom row, and its undo takes the way back (RTE-02)', () => {+ const appliedHint = { shown: true, key: 1, undo: vi.fn(), hold: vi.fn() };+ renderStage(planner('new-draft', { legVariants: { ...idleLegVariants(), appliedHint } }));+ const hint = screen.getByTestId('map-undo-hint');+ expect(hint).toHaveTextContent('tours.variants.applied');+ expect(hint.parentElement?.parentElement?.style.bottom).toBe('66px');+ fireEvent.click(screen.getByRole('button', { name: 'undo.button' }));+ expect(appliedHint.undo).toHaveBeenCalledTimes(1);+ fireEvent.mouseEnter(hint);+ expect(appliedHint.hold).toHaveBeenCalledWith(true);+ });+describe('map layers per tour type (P2B-06/07, PAD-04, PAD-10)', () => {const flat = () => stage.flatMap.props as MapViewProps;@@ -650,7 +691,7 @@ describe('TourPlannerMapStage', () => {expect(overlay()).toMatchObject({ status: 'off', active: false });});- it('FE-PAGE-TOURSTAGE-021: the pistes switch on over the map with no tour open and stay on when a hike opens (SKI-01)', () => {+ it('FE-PAGE-TOURSTAGE-028: the pistes switch on over the map with no tour open and stay on when a hike opens (SKI-01)', () => {function NeutralStage({ mode }: { mode: 'neutral' | 'new-draft' }) {const view = useTourMapView();return <TourPlannerMapStage {...stageProps(planner(mode, view))} />;@@ -672,7 +713,7 @@ describe('TourPlannerMapStage', () => {expect(pistes()?.status).toBe('on');});- it('FE-PAGE-TOURSTAGE-022: switching the pistes changes no point and no step, and a source that stopped answering keeps the map (SKI-01)', () => {+ it('FE-PAGE-TOURSTAGE-029: switching the pistes changes no point and no step, and a source that stopped answering keeps the map (SKI-01)', () => {const tourPlanner = planner('edit-saved', { mapOverlays: new Set(['pistes']) });renderStage(tourPlanner);const pistes = () => flat().tourLayers?.overlays?.find((overlay) => overlay.id === 'pistes');@@ -691,7 +732,7 @@ describe('TourPlannerMapStage', () => {expect(tourPlanner.undo).not.toHaveBeenCalled();});- it('FE-PAGE-TOURSTAGE-023: an imported ski track offers the pistes; a bike tour, a run and a paddle tour do not (SKI-01)', () => {+ it('FE-PAGE-TOURSTAGE-030: an imported ski track offers the pistes; a bike tour, a run and a paddle tour do not (SKI-01)', () => {const viewed = (tour: Record<string, unknown>) =>planner('view-gpx', { mode: { type: 'view-gpx', placeId: 9, tour: { place_id: 9, ...tour } } });const ski = renderStage(viewed({ tour_type: 'ski', ski_discipline: 'alpine' }));@@ -704,7 +745,7 @@ describe('TourPlannerMapStage', () => {}});- it('FE-PAGE-TOURSTAGE-024: the pistes know the zoom the map reported, so switched on far out they say to zoom in (SKI-01)', () => {+ it('FE-PAGE-TOURSTAGE-031: the pistes know the zoom the map reported, so switched on far out they say to zoom in (SKI-01)', () => {renderStage(planner('neutral', { mapOverlays: new Set(['pistes']) }));const pistes = () => flat().tourLayers?.overlays?.find((overlay) => overlay.id === 'pistes');const area = { south: 46, west: 7, north: 48, east: 12 };diff --git a/client/src/pages/tripPlanner/TourPlannerMapStage.tsx b/client/src/pages/tripPlanner/TourPlannerMapStage.tsxindex 38589db11..a0d943702 100644--- a/client/src/pages/tripPlanner/TourPlannerMapStage.tsx+++ b/client/src/pages/tripPlanner/TourPlannerMapStage.tsx@@ -12,6 +12,7 @@ import LocationSelect from '../../components/Planner/LocationSelect';import { ChecklistObstaclePanel } from '../../components/Tours/paddle/ObstacleDecisionPanel';import PaddleObstacleOverlay from '../../components/Tours/paddle/PaddleObstacleOverlay';import { PaddleObstaclePlaceButton } from '../../components/Tours/paddle/PaddleObstaclePlaceButton';+import LegVariantsOverlay from '../../components/Tours/planner/LegVariantsCard';import { useShapingClick } from '../../components/Tours/planner/useShapingClick';import TourPoiOverlay from '../../components/Tours/poi/TourPoiCard';import { useTourPoiMarkers } from '../../components/Tours/poi/useTourPoiMarkers';@@ -166,13 +167,16 @@ export function TourPlannerMapStage({// P2A-03: a click on the route being edited sets a shaping point there.// PLN-02: the places found along the tour, drawn on the map and picked from it.const poiMarkers = useTourPoiMarkers();- const shapeAt = useShapingClick(tourPlanner, { editable: !!waypoints.onMove, picking: pickOnLine });+ // RTE-02: while other ways of a section are compared, a click on the line sets nothing on it.+ const comparing = tourPlanner.legVariants.comparison !== null;+ const shapeAt = useShapingClick(tourPlanner, { editable: !!waypoints.onMove, picking: pickOnLine || comparing });// 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);return (<>{/* Around either map, to follow its presses and show the crosshair while placing. */}@@ -205,6 +209,7 @@ export function TourPlannerMapStage({onControlsHeightChange={setTerrainControlsPx}onLegendLayout={setTerrainLegend}placeTool={placeTool}+ overlays={tourMap.variantLines}/></Suspense>) : (@@ -277,8 +282,14 @@ export function TourPlannerMapStage({insetEnd={cardInsetEnd}{...ferrataCardPlacement(terrain3d, bottomRowTop, terrainLegend)}/>- {/* "Point set", with the way back, above the bottom row and between the panels. */}- {placedHint.shown && (+ {/* RTE-02: the ways of one section compared, in the same corner as the other cards. */}+ <LegVariantsOverlay+ planner={tourPlanner}+ insetEnd={cardInsetEnd}+ {...ferrataCardPlacement(terrain3d, bottomRowTop, terrainLegend)}+ />+ {/* "Point set" or "Way 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"style={{ bottom: bottomRowTop }}@@ -291,11 +302,11 @@ export function TourPlannerMapStage({}}><MapUndoHint- key={placedHint.key}- message={t('tours.planner.pointPlaced')}+ key={mapHint.key}+ message={mapHint.message}undoLabel={t('undo.button')}- onUndo={placedHint.undoPlacement}- onHold={placedHint.hold}+ onUndo={mapHint.undo}+ onHold={mapHint.hold}/></div></div>@@ -351,3 +362,22 @@ function paddlePlaceFromCard(selectPaddleObstacle(null);};}++type HintState = { key: number | null; undo: () => void; hold: (held: boolean) => void };++/**+ * 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.+ */+function undoHintOf(+ placed: { shown: boolean; key: number | null; undoPlacement: () => void; hold: (held: boolean) => void },+ applied: HintState & { shown: boolean },+ t: Planner['t']+): (HintState & { message: string }) | 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;+}diff --git a/client/src/pages/tripPlanner/useTripPlannerPage.ts b/client/src/pages/tripPlanner/useTripPlannerPage.tsindex 6a0484412..6155bd281 100644--- a/client/src/pages/tripPlanner/useTripPlannerPage.ts+++ b/client/src/pages/tripPlanner/useTripPlannerPage.ts@@ -9,6 +9,7 @@ import { tourPlannedTimes as projectTourPlannedTimes } from '../../components/Toimport { usePlanMapViewport } from '../../hooks/usePlanMapViewport'import { usePaddleObstacleStore } from '../../store/paddleObstacleStore'import { useHighlightedRoute } from '../../components/Tours/bike/useHighlightedRoute'+import { useLegVariantLines } from '../../components/Tours/planner/legVariantPaint'import { useMapLocationSearch } from './useMapLocationSearch'import { usePlannerFocusPoints } from './usePlannerFocusPoints'import { useTripPlanner } from './useTripPlanner'@@ -79,7 +80,11 @@ export function useTripPlannerPage() {// BIK-01 to BIK-05 and MAP-03: the stretches a tour's card points at, over the tour's own line,// 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 drawn = useHighlightedRoute(ownLine && !wandererBrowser.open, route, routeWalking, partStyle.colors)+ const highlighted = useHighlightedRoute(ownLine && !wandererBrowser.open, route, routeWalking, partStyle.colors)+ // RTE-02: the ways of a section being compared, 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 { closeGpxTour } = tourPlanneruseEffect(() => {@@ -125,6 +130,7 @@ export function useTripPlannerPage() {tourMap: { route: drawn.route,routeWalking: drawn.walking,routeColors: drawn.colors,+ variantLines: drawn.overlays,previewPoints: tourConversion.status === 'idle' ? null : tourConversion.points,focusPoints: mapFocusPoints,// A picked wanderer trail frames itself; the rest follows the planner.diff --git a/client/src/styles/hike.css b/client/src/styles/hike.cssindex 8b246ff74..7023d342d 100644--- a/client/src/styles/hike.css+++ b/client/src/styles/hike.css@@ -82,3 +82,20 @@--hike-way-via-ferrata: #f0abfc;--hike-way-other: #67e8f9;}++/* RTE-02: the ways offered for one section of a hike, on the map and in their+ card. The way the section takes now keeps the planner's route blue; the+ others take three hues far from it and from each other, so each line is+ found by its letter. A colour names a way, it never ranks one. */+:root {+ --hike-variant-current: #0a84ff;+ --hike-variant-a: #f97316;+ --hike-variant-b: #d946ef;+ --hike-variant-c: #14b8a6;+}++.dark {+ --hike-variant-a: #fb923c;+ --hike-variant-b: #e879f9;+ --hike-variant-c: #2dd4bf;+}diff --git a/client/tests/helpers/tourPlannerStub.ts b/client/tests/helpers/tourPlannerStub.tsindex a6360c0ec..525eb0c82 100644--- a/client/tests/helpers/tourPlannerStub.ts+++ b/client/tests/helpers/tourPlannerStub.ts@@ -52,9 +52,11 @@ export function hikePlannerDefaults() {returnToStart: vi.fn(),toggleWaypointFreeLeg: vi.fn(),insertShapingPoint: vi.fn(() => null),+ insertShapingPoints: vi.fn(() => null),setWaypointShaping: vi.fn(),recomputeLeg: vi.fn(),routeDrawnLegsOnWater: vi.fn(),+ legVariants: idleLegVariants(),paddleRoute: null,routeCurrent: false,routeParts: null,@@ -79,3 +81,18 @@ export function hikePlannerDefaults() {},};}++/** RTE-02: a planner comparing no section, with its actions as spies. */+export function idleLegVariants() {+ return {+ comparison: null,+ focus: null,+ canCompare: vi.fn(() => false),+ compare: vi.fn(),+ select: vi.fn(),+ hover: vi.fn(),+ apply: 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 95f9a530b..20d9d6afb 100644--- a/shared/src/i18n/ar/tours.ts+++ b/shared/src/i18n/ar/tours.ts@@ -1053,6 +1053,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'اجعلها محطة','tours.planner.makeShaping': 'اجعلها نقطة تشكيل','tours.planner.recomputeLeg': 'أعد حساب المقطع التالي',+ 'tours.planner.compareLeg': 'قارن طرق المقطع التالي',+ 'tours.variants.title': 'طرق أخرى لهذا المقطع',+ 'tours.variants.section': 'المقطع من {from} إلى {to}',+ 'tours.variants.current': 'الطريق الحالي',+ 'tours.variants.option': 'الطريق {letter}',+ 'tours.variants.heightsPending': 'جارٍ جلب الارتفاعات',+ 'tours.variants.heightsUnknown': 'لا توجد ارتفاعات لهذا الطريق، لذلك يبقى الصعود والنزول والوقت غير معروفة.',+ 'tours.variants.deltaHint': 'مقارنةً بالطريق الحالي',+ 'tours.variants.loading': 'جارٍ البحث عن طرق أخرى',+ 'tours.variants.failed': 'لم يستجب محرك التوجيه. يحتفظ المقطع بطريقه.',+ 'tours.variants.none': 'لا يعرف محرك التوجيه طريقًا آخر لهذا المقطع بالإعدادات الحالية.',+ 'tours.variants.notice.notHeld': 'لا يلتزم محرك التوجيه بهذا الطريق. يبقى المقطع كما هو.',+ 'tours.variants.notice.stale': 'تغيّرت الجولة في هذه الأثناء. يبقى المقطع كما هو.',+ 'tours.variants.notice.failed': 'تعذّر التحقق من هذا الطريق. يبقى المقطع كما هو.',+ 'tours.variants.checking': 'جارٍ التحقق من الطريق',+ 'tours.variants.apply': 'اعتمد هذا الطريق',+ 'tours.variants.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 9cdc5edf2..a582e17c7 100644--- a/shared/src/i18n/az/tours.ts+++ b/shared/src/i18n/az/tours.ts@@ -1020,6 +1020,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Dayanacaq et','tours.planner.makeShaping': 'Forma nöqtəsi et','tours.planner.recomputeLeg': 'Növbəti hissəni yenidən hesabla',+ 'tours.planner.compareLeg': 'Növbəti hissə üçün yolları müqayisə et',+ 'tours.variants.title': 'Bu hissə üçün digər yollar',+ 'tours.variants.section': '{from} ilə {to} arasındakı hissə',+ 'tours.variants.current': 'Cari yol',+ 'tours.variants.option': 'Yol {letter}',+ 'tours.variants.heightsPending': 'Hündürlüklər sorğulanır',+ 'tours.variants.heightsUnknown': 'Bu yol üçün hündürlük yoxdur, ona görə qalxma, enmə və vaxt naməlum qalır.',+ 'tours.variants.deltaHint': 'Cari yolla müqayisədə',+ 'tours.variants.loading': 'Digər yollar axtarılır',+ 'tours.variants.failed': 'Marşrutlaşdırıcı cavab vermədi. Hissə öz yolunu saxlayır.',+ 'tours.variants.none': 'Marşrutlaşdırıcı cari ayarlarla bu hissə üçün başqa yol bilmir.',+ 'tours.variants.notice.notHeld': 'Marşrutlaşdırıcı bu yola əməl etmir. Hissə olduğu kimi qalır.',+ 'tours.variants.notice.stale': 'Tur bu arada dəyişdi. Hissə olduğu kimi qalır.',+ 'tours.variants.notice.failed': 'Bu yolu yoxlamaq mümkün olmadı. Hissə olduğu kimi qalır.',+ 'tours.variants.checking': 'Yol yoxlanılır',+ 'tours.variants.apply': 'Bu yolu seç',+ 'tours.variants.applied': 'Yol 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 fdd6c316d..616c7c780 100644--- a/shared/src/i18n/br/tours.ts+++ b/shared/src/i18n/br/tours.ts@@ -1026,6 +1026,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Tornar uma parada','tours.planner.makeShaping': 'Tornar um ponto de forma','tours.planner.recomputeLeg': 'Recalcular o próximo trecho',+ 'tours.planner.compareLeg': 'Comparar caminhos do próximo trecho',+ 'tours.variants.title': 'Outros caminhos para este trecho',+ 'tours.variants.section': 'Trecho de {from} até {to}',+ 'tours.variants.current': 'Caminho atual',+ 'tours.variants.option': 'Caminho {letter}',+ 'tours.variants.heightsPending': 'Buscando as altitudes',+ 'tours.variants.heightsUnknown':+ 'Sem altitudes para este caminho, então subida, descida e tempo ficam desconhecidos.',+ 'tours.variants.deltaHint': 'Em comparação com o caminho atual',+ 'tours.variants.loading': 'Procurando outros caminhos',+ 'tours.variants.failed': 'O roteador não respondeu. O trecho mantém seu caminho.',+ 'tours.variants.none': 'O roteador não conhece outro caminho para este trecho com as configurações atuais.',+ 'tours.variants.notice.notHeld': 'O roteador não segue este caminho. O trecho fica como está.',+ 'tours.variants.notice.stale': 'O passeio mudou nesse meio tempo. O trecho fica como está.',+ 'tours.variants.notice.failed': 'Não foi possível verificar este caminho. O trecho fica como está.',+ 'tours.variants.checking': 'Verificando o caminho',+ 'tours.variants.apply': 'Usar este caminho',+ 'tours.variants.applied': 'Caminho adotado','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 b9cb98ee0..7d975c72c 100644--- a/shared/src/i18n/ca/tours.ts+++ b/shared/src/i18n/ca/tours.ts@@ -1028,6 +1028,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Converteix-lo en parada','tours.planner.makeShaping': 'Converteix-lo en punt de forma','tours.planner.recomputeLeg': 'Torna a calcular el tram següent',+ 'tours.planner.compareLeg': 'Compara camins del tram següent',+ 'tours.variants.title': 'Altres camins per a aquest tram',+ 'tours.variants.section': 'Tram de {from} a {to}',+ 'tours.variants.current': 'Camí actual',+ 'tours.variants.option': 'Camí {letter}',+ 'tours.variants.heightsPending': 'S’estan consultant les altituds',+ 'tours.variants.heightsUnknown':+ 'Aquest camí no té altituds, així que la pujada, la baixada i el temps queden desconeguts.',+ 'tours.variants.deltaHint': 'Comparat amb el camí actual',+ 'tours.variants.loading': 'S’estan cercant altres camins',+ 'tours.variants.failed': 'L’enrutador no ha respost. El tram conserva el seu camí.',+ 'tours.variants.none': 'L’enrutador no coneix cap altre camí per a aquest tram amb la configuració actual.',+ 'tours.variants.notice.notHeld': 'L’enrutador no segueix aquest camí. El tram es queda com està.',+ 'tours.variants.notice.stale': 'L’excursió ha canviat mentrestant. El tram es queda com està.',+ 'tours.variants.notice.failed': 'No s’ha pogut comprovar aquest camí. El tram es queda com està.',+ 'tours.variants.checking': 'S’està comprovant el camí',+ 'tours.variants.apply': 'Fes servir aquest camí',+ 'tours.variants.applied': 'Camí adoptat','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 64afdae9d..40c4c4dfd 100644--- a/shared/src/i18n/cs/tours.ts+++ b/shared/src/i18n/cs/tours.ts@@ -1019,6 +1019,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Udělat zastávkou','tours.planner.makeShaping': 'Udělat tvarovým bodem','tours.planner.recomputeLeg': 'Znovu vypočítat další úsek',+ 'tours.planner.compareLeg': 'Porovnat cesty pro další úsek',+ 'tours.variants.title': 'Jiné cesty pro tento úsek',+ 'tours.variants.section': 'Úsek od {from} do {to}',+ 'tours.variants.current': 'Aktuální cesta',+ 'tours.variants.option': 'Cesta {letter}',+ 'tours.variants.heightsPending': 'Výšky se zjišťují',+ 'tours.variants.heightsUnknown': 'Pro tuto cestu nejsou výšky, takže stoupání, klesání a čas zůstávají neznámé.',+ 'tours.variants.deltaHint': 'Ve srovnání s aktuální cestou',+ 'tours.variants.loading': 'Hledají se jiné cesty',+ 'tours.variants.failed': 'Router neodpověděl. Úsek si ponechává svou cestu.',+ 'tours.variants.none': 'Router s aktuálním nastavením nezná pro tento úsek jinou cestu.',+ 'tours.variants.notice.notHeld': 'Router se této cesty nedrží. Úsek zůstává, jak je.',+ 'tours.variants.notice.stale': 'Výlet se mezitím změnil. Úsek zůstává, jak je.',+ 'tours.variants.notice.failed': 'Tuto cestu se nepodařilo ověřit. Úsek zůstává, jak je.',+ 'tours.variants.checking': 'Cesta se ověřuje',+ 'tours.variants.apply': 'Použít tuto cestu',+ 'tours.variants.applied': 'Cesta převzata','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 c26730fcc..80bef76e7 100644--- a/shared/src/i18n/de/tours.ts+++ b/shared/src/i18n/de/tours.ts@@ -1033,6 +1033,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Zum Halt machen','tours.planner.makeShaping': 'Zum Formpunkt machen','tours.planner.recomputeLeg': 'Nächsten Abschnitt neu berechnen',+ 'tours.planner.compareLeg': 'Wege für den nächsten Abschnitt vergleichen',+ 'tours.variants.title': 'Andere Wege für diesen Abschnitt',+ 'tours.variants.section': 'Abschnitt von {from} bis {to}',+ 'tours.variants.current': 'Aktueller Weg',+ 'tours.variants.option': 'Weg {letter}',+ 'tours.variants.heightsPending': 'Höhen werden abgefragt',+ 'tours.variants.heightsUnknown':+ 'Für diesen Weg gibt es keine Höhen, daher bleiben Aufstieg, Abstieg und Zeit unbekannt.',+ 'tours.variants.deltaHint': 'Im Vergleich zum aktuellen Weg',+ 'tours.variants.loading': 'Andere Wege werden gesucht',+ 'tours.variants.failed': 'Der Router hat nicht geantwortet. Der Abschnitt behält seinen Weg.',+ 'tours.variants.none': 'Der Router kennt mit den aktuellen Einstellungen keinen anderen Weg für diesen Abschnitt.',+ 'tours.variants.notice.notHeld': 'Der Router hält sich nicht an diesen Weg. Der Abschnitt bleibt, wie er ist.',+ 'tours.variants.notice.stale': 'Die Tour hat sich inzwischen geändert. Der Abschnitt bleibt, wie er ist.',+ 'tours.variants.notice.failed': 'Dieser Weg konnte nicht geprüft werden. Der Abschnitt bleibt, wie er ist.',+ 'tours.variants.checking': 'Weg wird geprüft',+ 'tours.variants.apply': 'Diesen Weg nehmen',+ 'tours.variants.applied': 'Weg ü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 2066b4de0..8121bb3ce 100644--- a/shared/src/i18n/en/tours.ts+++ b/shared/src/i18n/en/tours.ts@@ -1008,6 +1008,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Make it a stop','tours.planner.makeShaping': 'Make it a shaping point','tours.planner.recomputeLeg': 'Plan the next leg again',+ 'tours.planner.compareLeg': 'Compare ways for the next leg',+ 'tours.variants.title': 'Other ways for this section',+ 'tours.variants.section': 'Section from {from} to {to}',+ 'tours.variants.current': 'Current way',+ 'tours.variants.option': 'Way {letter}',+ 'tours.variants.heightsPending': 'Heights are being looked up',+ 'tours.variants.heightsUnknown': 'No heights for this way, so climb, descent and time stay unknown.',+ 'tours.variants.deltaHint': 'Compared with the current way',+ 'tours.variants.loading': 'Looking for other ways',+ 'tours.variants.failed': 'The router did not answer. The section keeps its way.',+ 'tours.variants.none': 'The router knows no other way for this section with the current settings.',+ 'tours.variants.notice.notHeld': 'The router does not keep to this way. The section stays as it is.',+ 'tours.variants.notice.stale': 'The tour changed in the meantime. The section stays as it is.',+ 'tours.variants.notice.failed': 'This way could not be checked. The section stays as it is.',+ 'tours.variants.checking': 'Checking the way',+ 'tours.variants.apply': 'Take this way',+ 'tours.variants.applied': 'Way 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 e5ec6afc4..936b10bad 100644--- a/shared/src/i18n/es/tours.ts+++ b/shared/src/i18n/es/tours.ts@@ -1025,6 +1025,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Convertir en parada','tours.planner.makeShaping': 'Convertir en punto de forma','tours.planner.recomputeLeg': 'Volver a calcular el siguiente tramo',+ 'tours.planner.compareLeg': 'Comparar caminos del siguiente tramo',+ 'tours.variants.title': 'Otros caminos para este tramo',+ 'tours.variants.section': 'Tramo de {from} a {to}',+ 'tours.variants.current': 'Camino actual',+ 'tours.variants.option': 'Camino {letter}',+ 'tours.variants.heightsPending': 'Consultando las altitudes',+ 'tours.variants.heightsUnknown':+ 'Este camino no tiene altitudes, así que la subida, la bajada y el tiempo quedan desconocidos.',+ 'tours.variants.deltaHint': 'En comparación con el camino actual',+ 'tours.variants.loading': 'Buscando otros caminos',+ 'tours.variants.failed': 'El enrutador no respondió. El tramo conserva su camino.',+ 'tours.variants.none': 'El enrutador no conoce otro camino para este tramo con la configuración actual.',+ 'tours.variants.notice.notHeld': 'El enrutador no se ciñe a este camino. El tramo se queda como está.',+ 'tours.variants.notice.stale': 'La excursión cambió mientras tanto. El tramo se queda como está.',+ 'tours.variants.notice.failed': 'No se pudo comprobar este camino. El tramo se queda como está.',+ 'tours.variants.checking': 'Comprobando el camino',+ 'tours.variants.apply': 'Usar este camino',+ 'tours.variants.applied': 'Camino adoptado','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 4d1083357..e7d86ef7c 100644--- a/shared/src/i18n/et/tours.ts+++ b/shared/src/i18n/et/tours.ts@@ -1013,6 +1013,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Tee peatuseks','tours.planner.makeShaping': 'Tee kujunduspunktiks','tours.planner.recomputeLeg': 'Arvuta järgmine lõik uuesti',+ 'tours.planner.compareLeg': 'Võrdle järgmise lõigu teid',+ 'tours.variants.title': 'Teised teed selle lõigu jaoks',+ 'tours.variants.section': 'Lõik punktist {from} punktini {to}',+ 'tours.variants.current': 'Praegune tee',+ 'tours.variants.option': 'Tee {letter}',+ 'tours.variants.heightsPending': 'Kõrgusi küsitakse',+ 'tours.variants.heightsUnknown': 'Selle tee kohta pole kõrgusi, seega jäävad tõus, laskumine ja aeg teadmata.',+ 'tours.variants.deltaHint': 'Võrreldes praeguse teega',+ 'tours.variants.loading': 'Otsitakse teisi teid',+ 'tours.variants.failed': 'Marsruutija ei vastanud. Lõik jääb oma teele.',+ 'tours.variants.none': 'Marsruutija ei tea praeguste seadetega selle lõigu jaoks teist teed.',+ 'tours.variants.notice.notHeld': 'Marsruutija ei pea sellest teest kinni. Lõik jääb, nagu on.',+ 'tours.variants.notice.stale': 'Retk on vahepeal muutunud. Lõik jääb, nagu on.',+ 'tours.variants.notice.failed': 'Seda teed ei õnnestunud kontrollida. Lõik jääb, nagu on.',+ 'tours.variants.checking': 'Teed kontrollitakse',+ 'tours.variants.apply': 'Vali see tee',+ 'tours.variants.applied': 'Tee 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 53292162a..1ffc98ea9 100644--- a/shared/src/i18n/fr/tours.ts+++ b/shared/src/i18n/fr/tours.ts@@ -1043,6 +1043,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'En faire une étape','tours.planner.makeShaping': 'En faire un point de guidage','tours.planner.recomputeLeg': 'Recalculer le tronçon suivant',+ 'tours.planner.compareLeg': 'Comparer les chemins du tronçon suivant',+ 'tours.variants.title': 'Autres chemins pour ce tronçon',+ 'tours.variants.section': 'Tronçon de {from} à {to}',+ 'tours.variants.current': 'Chemin actuel',+ 'tours.variants.option': 'Chemin {letter}',+ 'tours.variants.heightsPending': 'Altitudes en cours de recherche',+ 'tours.variants.heightsUnknown':+ "Pas d'altitudes pour ce chemin : la montée, la descente et la durée restent inconnues.",+ 'tours.variants.deltaHint': 'Par rapport au chemin actuel',+ 'tours.variants.loading': "Recherche d'autres chemins",+ 'tours.variants.failed': "Le routeur n'a pas répondu. Le tronçon garde son chemin.",+ 'tours.variants.none': "Le routeur ne connaît pas d'autre chemin pour ce tronçon avec les réglages actuels.",+ 'tours.variants.notice.notHeld': 'Le routeur ne suit pas ce chemin. Le tronçon reste tel quel.',+ 'tours.variants.notice.stale': "L'excursion a changé entre-temps. Le tronçon reste tel quel.",+ 'tours.variants.notice.failed': "Ce chemin n'a pas pu être vérifié. Le tronçon reste tel quel.",+ 'tours.variants.checking': 'Vérification du chemin',+ 'tours.variants.apply': 'Prendre ce chemin',+ 'tours.variants.applied': 'Chemin adopté','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 c95a0b743..52a791ad2 100644--- a/shared/src/i18n/gr/tours.ts+++ b/shared/src/i18n/gr/tours.ts@@ -1046,6 +1046,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Κάνε το στάση','tours.planner.makeShaping': 'Κάνε το σημείο διαμόρφωσης','tours.planner.recomputeLeg': 'Επανυπολογισμός επόμενου τμήματος',+ 'tours.planner.compareLeg': 'Σύγκριση διαδρομών για το επόμενο τμήμα',+ 'tours.variants.title': 'Άλλες διαδρομές για αυτό το τμήμα',+ 'tours.variants.section': 'Τμήμα από {from} έως {to}',+ 'tours.variants.current': 'Τρέχουσα διαδρομή',+ 'tours.variants.option': 'Διαδρομή {letter}',+ 'tours.variants.heightsPending': 'Αναζήτηση υψομέτρων',+ 'tours.variants.heightsUnknown':+ 'Δεν υπάρχουν υψόμετρα για αυτή τη διαδρομή, οπότε ανάβαση, κατάβαση και χρόνος μένουν άγνωστα.',+ 'tours.variants.deltaHint': 'Σε σύγκριση με την τρέχουσα διαδρομή',+ 'tours.variants.loading': 'Αναζήτηση άλλων διαδρομών',+ 'tours.variants.failed': 'Ο δρομολογητής δεν απάντησε. Το τμήμα κρατά τη διαδρομή του.',+ 'tours.variants.none': 'Ο δρομολογητής δεν γνωρίζει άλλη διαδρομή για αυτό το τμήμα με τις τρέχουσες ρυθμίσεις.',+ 'tours.variants.notice.notHeld': 'Ο δρομολογητής δεν ακολουθεί αυτή τη διαδρομή. Το τμήμα μένει όπως είναι.',+ 'tours.variants.notice.stale': 'Η εκδρομή άλλαξε στο μεταξύ. Το τμήμα μένει όπως είναι.',+ 'tours.variants.notice.failed': 'Δεν ήταν δυνατός ο έλεγχος αυτής της διαδρομής. Το τμήμα μένει όπως είναι.',+ 'tours.variants.checking': 'Έλεγχος διαδρομής',+ 'tours.variants.apply': 'Χρήση αυτής της διαδρομής',+ 'tours.variants.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 18b5d498d..708db0e28 100644--- a/shared/src/i18n/hu/tours.ts+++ b/shared/src/i18n/hu/tours.ts@@ -1031,6 +1031,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Legyen megálló','tours.planner.makeShaping': 'Legyen alakítópont','tours.planner.recomputeLeg': 'Következő szakasz újratervezése',+ 'tours.planner.compareLeg': 'Utak összehasonlítása a következő szakaszhoz',+ 'tours.variants.title': 'Más utak ehhez a szakaszhoz',+ 'tours.variants.section': 'Szakasz: {from} és {to} között',+ 'tours.variants.current': 'Jelenlegi út',+ 'tours.variants.option': '{letter} út',+ 'tours.variants.heightsPending': 'A magasságok lekérése folyamatban',+ 'tours.variants.heightsUnknown':+ 'Ehhez az úthoz nincsenek magasságok, így az emelkedés, a lejtés és az idő ismeretlen marad.',+ 'tours.variants.deltaHint': 'A jelenlegi úthoz képest',+ 'tours.variants.loading': 'Más utak keresése',+ 'tours.variants.failed': 'Az útvonaltervező nem válaszolt. A szakasz megtartja az útját.',+ 'tours.variants.none': 'Az útvonaltervező a jelenlegi beállításokkal nem ismer más utat ehhez a szakaszhoz.',+ 'tours.variants.notice.notHeld': 'Az útvonaltervező nem tartja ezt az utat. A szakasz marad, ahogy van.',+ 'tours.variants.notice.stale': 'A túra időközben megváltozott. A szakasz marad, ahogy van.',+ 'tours.variants.notice.failed': 'Ezt az utat nem sikerült ellenőrizni. A szakasz marad, ahogy van.',+ 'tours.variants.checking': 'Az út ellenőrzése',+ 'tours.variants.apply': 'Ezt az utat választom',+ 'tours.variants.applied': 'Út á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 137e40559..a9a2b4e91 100644--- a/shared/src/i18n/id/tours.ts+++ b/shared/src/i18n/id/tours.ts@@ -1011,6 +1011,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Jadikan perhentian','tours.planner.makeShaping': 'Jadikan titik bentuk','tours.planner.recomputeLeg': 'Hitung ulang bagian berikutnya',+ 'tours.planner.compareLeg': 'Bandingkan jalan untuk bagian berikutnya',+ 'tours.variants.title': 'Jalan lain untuk bagian ini',+ 'tours.variants.section': 'Bagian dari {from} ke {to}',+ 'tours.variants.current': 'Jalan saat ini',+ 'tours.variants.option': 'Jalan {letter}',+ 'tours.variants.heightsPending': 'Sedang mencari ketinggian',+ 'tours.variants.heightsUnknown':+ 'Tidak ada ketinggian untuk jalan ini, jadi tanjakan, turunan, dan waktu tetap tidak diketahui.',+ 'tours.variants.deltaHint': 'Dibandingkan dengan jalan saat ini',+ 'tours.variants.loading': 'Mencari jalan lain',+ 'tours.variants.failed': 'Perute tidak menjawab. Bagian ini tetap memakai jalannya.',+ 'tours.variants.none': 'Perute tidak mengenal jalan lain untuk bagian ini dengan pengaturan saat ini.',+ 'tours.variants.notice.notHeld': 'Perute tidak mengikuti jalan ini. Bagian ini tetap seperti semula.',+ 'tours.variants.notice.stale': 'Tur berubah sementara itu. Bagian ini tetap seperti semula.',+ 'tours.variants.notice.failed': 'Jalan ini tidak dapat diperiksa. Bagian ini tetap seperti semula.',+ 'tours.variants.checking': 'Memeriksa jalan',+ 'tours.variants.apply': 'Pakai jalan ini',+ 'tours.variants.applied': 'Jalan dipakai','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 cccdb5545..ab2921f56 100644--- a/shared/src/i18n/it/tours.ts+++ b/shared/src/i18n/it/tours.ts@@ -1033,6 +1033,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Rendilo una tappa','tours.planner.makeShaping': 'Rendilo un punto di forma','tours.planner.recomputeLeg': 'Ricalcola il tratto successivo',+ 'tours.planner.compareLeg': 'Confronta i percorsi del tratto successivo',+ 'tours.variants.title': 'Altri percorsi per questo tratto',+ 'tours.variants.section': 'Tratto da {from} a {to}',+ 'tours.variants.current': 'Percorso attuale',+ 'tours.variants.option': 'Percorso {letter}',+ 'tours.variants.heightsPending': 'Ricerca delle altitudini in corso',+ 'tours.variants.heightsUnknown':+ 'Nessuna altitudine per questo percorso, quindi salita, discesa e tempo restano sconosciuti.',+ 'tours.variants.deltaHint': 'Rispetto al percorso attuale',+ 'tours.variants.loading': 'Ricerca di altri percorsi',+ 'tours.variants.failed': 'Il router non ha risposto. Il tratto mantiene il suo percorso.',+ 'tours.variants.none': 'Il router non conosce altri percorsi per questo tratto con le impostazioni attuali.',+ 'tours.variants.notice.notHeld': 'Il router non segue questo percorso. Il tratto resta com’è.',+ 'tours.variants.notice.stale': "L'escursione è cambiata nel frattempo. Il tratto resta com’è.",+ 'tours.variants.notice.failed': 'Non è stato possibile verificare questo percorso. Il tratto resta com’è.',+ 'tours.variants.checking': 'Verifica del percorso',+ 'tours.variants.apply': 'Usa questo percorso',+ 'tours.variants.applied': 'Percorso adottato','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 c6dfa31ce..61a122ac9 100644--- a/shared/src/i18n/ja/tours.ts+++ b/shared/src/i18n/ja/tours.ts@@ -988,6 +988,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': '停留地点にする','tours.planner.makeShaping': '形状ポイントにする','tours.planner.recomputeLeg': '次の区間を再計算',+ 'tours.planner.compareLeg': '次の区間の道を比較',+ 'tours.variants.title': 'この区間のほかの道',+ 'tours.variants.section': '{from}から{to}までの区間',+ 'tours.variants.current': '現在の道',+ 'tours.variants.option': '道{letter}',+ 'tours.variants.heightsPending': '標高を取得中',+ 'tours.variants.heightsUnknown': 'この道には標高がないため、登り、下り、時間は不明のままです。',+ 'tours.variants.deltaHint': '現在の道との比較',+ 'tours.variants.loading': 'ほかの道を検索中',+ 'tours.variants.failed': 'ルーターが応答しませんでした。区間は今の道のままです。',+ 'tours.variants.none': '現在の設定では、ルーターはこの区間のほかの道を知りません。',+ 'tours.variants.notice.notHeld': 'ルーターはこの道に沿いません。区間はそのままです。',+ 'tours.variants.notice.stale': 'その間にツアーが変更されました。区間はそのままです。',+ 'tours.variants.notice.failed': 'この道を確認できませんでした。区間はそのままです。',+ 'tours.variants.checking': '道を確認中',+ 'tours.variants.apply': 'この道にする',+ 'tours.variants.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 25f09d4e3..8a6f05e41 100644--- a/shared/src/i18n/ko/tours.ts+++ b/shared/src/i18n/ko/tours.ts@@ -985,6 +985,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': '정류 지점으로 바꾸기','tours.planner.makeShaping': '형태 지점으로 바꾸기','tours.planner.recomputeLeg': '다음 구간 다시 계산',+ 'tours.planner.compareLeg': '다음 구간의 길 비교',+ 'tours.variants.title': '이 구간의 다른 길',+ 'tours.variants.section': '{from}에서 {to}까지의 구간',+ 'tours.variants.current': '현재 길',+ 'tours.variants.option': '길 {letter}',+ 'tours.variants.heightsPending': '고도를 조회하는 중',+ 'tours.variants.heightsUnknown': '이 길에는 고도가 없어 오르막, 내리막, 시간을 알 수 없습니다.',+ 'tours.variants.deltaHint': '현재 길과 비교',+ 'tours.variants.loading': '다른 길을 찾는 중',+ 'tours.variants.failed': '경로 탐색기가 응답하지 않았습니다. 구간은 지금 길을 유지합니다.',+ 'tours.variants.none': '현재 설정으로는 경로 탐색기가 이 구간의 다른 길을 알지 못합니다.',+ 'tours.variants.notice.notHeld': '경로 탐색기가 이 길을 따르지 않습니다. 구간은 그대로입니다.',+ 'tours.variants.notice.stale': '그사이 투어가 바뀌었습니다. 구간은 그대로입니다.',+ 'tours.variants.notice.failed': '이 길을 확인할 수 없었습니다. 구간은 그대로입니다.',+ 'tours.variants.checking': '길을 확인하는 중',+ 'tours.variants.apply': '이 길로 하기',+ 'tours.variants.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 cc82794b2..ccd3f80a8 100644--- a/shared/src/i18n/nl/tours.ts+++ b/shared/src/i18n/nl/tours.ts@@ -1029,6 +1029,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Maak er een stop van','tours.planner.makeShaping': 'Maak er een vormpunt van','tours.planner.recomputeLeg': 'Volgend deel opnieuw berekenen',+ 'tours.planner.compareLeg': 'Wegen voor het volgende deel vergelijken',+ 'tours.variants.title': 'Andere wegen voor dit deel',+ 'tours.variants.section': 'Deel van {from} tot {to}',+ 'tours.variants.current': 'Huidige weg',+ 'tours.variants.option': 'Weg {letter}',+ 'tours.variants.heightsPending': 'Hoogtes worden opgevraagd',+ 'tours.variants.heightsUnknown': 'Geen hoogtes voor deze weg, dus stijging, daling en tijd blijven onbekend.',+ 'tours.variants.deltaHint': 'Vergeleken met de huidige weg',+ 'tours.variants.loading': 'Andere wegen worden gezocht',+ 'tours.variants.failed': 'De router gaf geen antwoord. Het deel houdt zijn weg.',+ 'tours.variants.none': 'De router kent met de huidige instellingen geen andere weg voor dit deel.',+ 'tours.variants.notice.notHeld': 'De router houdt zich niet aan deze weg. Het deel blijft zoals het is.',+ 'tours.variants.notice.stale': 'De tocht is intussen veranderd. Het deel blijft zoals het is.',+ 'tours.variants.notice.failed': 'Deze weg kon niet worden gecontroleerd. Het deel blijft zoals het is.',+ 'tours.variants.checking': 'Weg wordt gecontroleerd',+ 'tours.variants.apply': 'Deze weg nemen',+ 'tours.variants.applied': 'Weg 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 555c1cd2b..3e6a21aea 100644--- a/shared/src/i18n/pl/tours.ts+++ b/shared/src/i18n/pl/tours.ts@@ -1055,6 +1055,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Zrób z niego przystanek','tours.planner.makeShaping': 'Zrób z niego punkt kształtujący','tours.planner.recomputeLeg': 'Przelicz ponownie następny odcinek',+ 'tours.planner.compareLeg': 'Porównaj drogi dla następnego odcinka',+ 'tours.variants.title': 'Inne drogi dla tego odcinka',+ 'tours.variants.section': 'Odcinek od {from} do {to}',+ 'tours.variants.current': 'Obecna droga',+ 'tours.variants.option': 'Droga {letter}',+ 'tours.variants.heightsPending': 'Trwa pobieranie wysokości',+ 'tours.variants.heightsUnknown': 'Brak wysokości dla tej drogi, więc podejście, zejście i czas pozostają nieznane.',+ 'tours.variants.deltaHint': 'W porównaniu z obecną drogą',+ 'tours.variants.loading': 'Trwa szukanie innych dróg',+ 'tours.variants.failed': 'Router nie odpowiedział. Odcinek zachowuje swoją drogę.',+ 'tours.variants.none': 'Router przy obecnych ustawieniach nie zna innej drogi dla tego odcinka.',+ 'tours.variants.notice.notHeld': 'Router nie trzyma się tej drogi. Odcinek zostaje bez zmian.',+ 'tours.variants.notice.stale': 'Wycieczka zmieniła się w międzyczasie. Odcinek zostaje bez zmian.',+ 'tours.variants.notice.failed': 'Nie udało się sprawdzić tej drogi. Odcinek zostaje bez zmian.',+ 'tours.variants.checking': 'Sprawdzanie drogi',+ 'tours.variants.apply': 'Wybierz tę drogę',+ 'tours.variants.applied': 'Droga 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 eda88f20c..7605beb0d 100644--- a/shared/src/i18n/ru/tours.ts+++ b/shared/src/i18n/ru/tours.ts@@ -1059,6 +1059,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Сделать остановкой','tours.planner.makeShaping': 'Сделать точкой формы','tours.planner.recomputeLeg': 'Пересчитать следующий участок',+ 'tours.planner.compareLeg': 'Сравнить пути для следующего участка',+ 'tours.variants.title': 'Другие пути для этого участка',+ 'tours.variants.section': 'Участок от {from} до {to}',+ 'tours.variants.current': 'Текущий путь',+ 'tours.variants.option': 'Путь {letter}',+ 'tours.variants.heightsPending': 'Высоты запрашиваются',+ 'tours.variants.heightsUnknown': 'Для этого пути нет высот, поэтому подъём, спуск и время остаются неизвестными.',+ 'tours.variants.deltaHint': 'По сравнению с текущим путём',+ 'tours.variants.loading': 'Идёт поиск других путей',+ 'tours.variants.failed': 'Маршрутизатор не ответил. Участок сохраняет свой путь.',+ 'tours.variants.none': 'При текущих настройках маршрутизатор не знает другого пути для этого участка.',+ 'tours.variants.notice.notHeld': 'Маршрутизатор не придерживается этого пути. Участок остаётся как есть.',+ 'tours.variants.notice.stale': 'Тем временем тур изменился. Участок остаётся как есть.',+ 'tours.variants.notice.failed': 'Не удалось проверить этот путь. Участок остаётся как есть.',+ 'tours.variants.checking': 'Путь проверяется',+ 'tours.variants.apply': 'Выбрать этот путь',+ 'tours.variants.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 2674c2430..0a4a1bc6e 100644--- a/shared/src/i18n/sk/tours.ts+++ b/shared/src/i18n/sk/tours.ts@@ -1023,6 +1023,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Urobiť zastávkou','tours.planner.makeShaping': 'Urobiť tvarovacím bodom','tours.planner.recomputeLeg': 'Znova vypočítať ďalší úsek',+ 'tours.planner.compareLeg': 'Porovnať cesty pre ďalší úsek',+ 'tours.variants.title': 'Iné cesty pre tento úsek',+ 'tours.variants.section': 'Úsek od {from} po {to}',+ 'tours.variants.current': 'Aktuálna cesta',+ 'tours.variants.option': 'Cesta {letter}',+ 'tours.variants.heightsPending': 'Výšky sa zisťujú',+ 'tours.variants.heightsUnknown': 'Pre túto cestu nie sú výšky, takže stúpanie, klesanie a čas zostávajú neznáme.',+ 'tours.variants.deltaHint': 'V porovnaní s aktuálnou cestou',+ 'tours.variants.loading': 'Hľadajú sa iné cesty',+ 'tours.variants.failed': 'Router neodpovedal. Úsek si ponecháva svoju cestu.',+ 'tours.variants.none': 'Router s aktuálnymi nastaveniami nepozná pre tento úsek inú cestu.',+ 'tours.variants.notice.notHeld': 'Router sa tejto cesty nedrží. Úsek zostáva, ako je.',+ 'tours.variants.notice.stale': 'Túra sa medzitým zmenila. Úsek zostáva, ako je.',+ 'tours.variants.notice.failed': 'Túto cestu sa nepodarilo overiť. Úsek zostáva, ako je.',+ 'tours.variants.checking': 'Cesta sa overuje',+ 'tours.variants.apply': 'Použiť túto cestu',+ 'tours.variants.applied': 'Cesta 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 22ecd98f1..e150a72e1 100644--- a/shared/src/i18n/sv/tours.ts+++ b/shared/src/i18n/sv/tours.ts@@ -1010,6 +1010,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Gör till stopp','tours.planner.makeShaping': 'Gör till formpunkt','tours.planner.recomputeLeg': 'Beräkna nästa etapp igen',+ 'tours.planner.compareLeg': 'Jämför vägar för nästa etapp',+ 'tours.variants.title': 'Andra vägar för den här etappen',+ 'tours.variants.section': 'Etapp från {from} till {to}',+ 'tours.variants.current': 'Nuvarande väg',+ 'tours.variants.option': 'Väg {letter}',+ 'tours.variants.heightsPending': 'Höjder hämtas',+ 'tours.variants.heightsUnknown': 'Inga höjder för den här vägen, så stigning, nedstigning och tid förblir okända.',+ 'tours.variants.deltaHint': 'Jämfört med nuvarande väg',+ 'tours.variants.loading': 'Letar efter andra vägar',+ 'tours.variants.failed': 'Routern svarade inte. Etappen behåller sin väg.',+ 'tours.variants.none': 'Routern känner inte till någon annan väg för den här etappen med nuvarande inställningar.',+ 'tours.variants.notice.notHeld': 'Routern håller sig inte till den här vägen. Etappen förblir som den är.',+ 'tours.variants.notice.stale': 'Turen har ändrats under tiden. Etappen förblir som den är.',+ 'tours.variants.notice.failed': 'Den här vägen kunde inte kontrolleras. Etappen förblir som den är.',+ 'tours.variants.checking': 'Kontrollerar vägen',+ 'tours.variants.apply': 'Ta den här vägen',+ 'tours.variants.applied': 'Vägen 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 9d43169b3..9915944c2 100644--- a/shared/src/i18n/th/tours.ts+++ b/shared/src/i18n/th/tours.ts@@ -968,6 +968,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'เปลี่ยนเป็นจุดแวะ','tours.planner.makeShaping': 'เปลี่ยนเป็นจุดกำหนดเส้นทาง','tours.planner.recomputeLeg': 'คำนวณช่วงถัดไปใหม่',+ 'tours.planner.compareLeg': 'เปรียบเทียบเส้นทางของช่วงถัดไป',+ 'tours.variants.title': 'เส้นทางอื่นสำหรับช่วงนี้',+ 'tours.variants.section': 'ช่วงจาก {from} ถึง {to}',+ 'tours.variants.current': 'เส้นทางปัจจุบัน',+ 'tours.variants.option': 'เส้นทาง {letter}',+ 'tours.variants.heightsPending': 'กำลังค้นหาความสูง',+ 'tours.variants.heightsUnknown': 'เส้นทางนี้ไม่มีข้อมูลความสูง จึงไม่ทราบการขึ้น การลง และเวลา',+ 'tours.variants.deltaHint': 'เทียบกับเส้นทางปัจจุบัน',+ 'tours.variants.loading': 'กำลังค้นหาเส้นทางอื่น',+ 'tours.variants.failed': 'ระบบหาเส้นทางไม่ตอบกลับ ช่วงนี้ยังใช้เส้นทางเดิม',+ 'tours.variants.none': 'ด้วยการตั้งค่าปัจจุบัน ระบบหาเส้นทางไม่รู้จักเส้นทางอื่นสำหรับช่วงนี้',+ 'tours.variants.notice.notHeld': 'ระบบหาเส้นทางไม่ยึดตามเส้นทางนี้ ช่วงนี้ยังคงเดิม',+ 'tours.variants.notice.stale': 'ทัวร์เปลี่ยนไปในระหว่างนี้ ช่วงนี้ยังคงเดิม',+ 'tours.variants.notice.failed': 'ไม่สามารถตรวจสอบเส้นทางนี้ได้ ช่วงนี้ยังคงเดิม',+ 'tours.variants.checking': 'กำลังตรวจสอบเส้นทาง',+ 'tours.variants.apply': 'ใช้เส้นทางนี้',+ 'tours.variants.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 c50ce11f2..3eca4959f 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 = 1022;+const GENERAL_KEY_COUNT = 1039;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 7a73e2e36..77f5da6ae 100644--- a/shared/src/i18n/tr/tours.ts+++ b/shared/src/i18n/tr/tours.ts@@ -1019,6 +1019,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Durak yap','tours.planner.makeShaping': 'Şekil noktası yap','tours.planner.recomputeLeg': 'Sonraki bölümü yeniden hesapla',+ 'tours.planner.compareLeg': 'Sonraki bölüm için yolları karşılaştır',+ 'tours.variants.title': 'Bu bölüm için diğer yollar',+ 'tours.variants.section': '{from} ile {to} arasındaki bölüm',+ 'tours.variants.current': 'Mevcut yol',+ 'tours.variants.option': 'Yol {letter}',+ 'tours.variants.heightsPending': 'Yükseklikler sorgulanıyor',+ 'tours.variants.heightsUnknown': 'Bu yol için yükseklik yok, bu yüzden tırmanış, iniş ve süre bilinmiyor.',+ 'tours.variants.deltaHint': 'Mevcut yola göre',+ 'tours.variants.loading': 'Diğer yollar aranıyor',+ 'tours.variants.failed': 'Yönlendirici yanıt vermedi. Bölüm kendi yolunu koruyor.',+ 'tours.variants.none': 'Yönlendirici mevcut ayarlarla bu bölüm için başka bir yol bilmiyor.',+ 'tours.variants.notice.notHeld': 'Yönlendirici bu yola uymuyor. Bölüm olduğu gibi kalıyor.',+ 'tours.variants.notice.stale': 'Tur bu arada değişti. Bölüm olduğu gibi kalıyor.',+ 'tours.variants.notice.failed': 'Bu yol kontrol edilemedi. Bölüm olduğu gibi kalıyor.',+ 'tours.variants.checking': 'Yol kontrol ediliyor',+ 'tours.variants.apply': 'Bu yolu kullan',+ 'tours.variants.applied': 'Yol 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 f775d3d2e..e6e069c9d 100644--- a/shared/src/i18n/uk/tours.ts+++ b/shared/src/i18n/uk/tours.ts@@ -1052,6 +1052,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Зробити зупинкою','tours.planner.makeShaping': 'Зробити точкою форми','tours.planner.recomputeLeg': 'Перерахувати наступну ділянку',+ 'tours.planner.compareLeg': 'Порівняти шляхи для наступної ділянки',+ 'tours.variants.title': 'Інші шляхи для цієї ділянки',+ 'tours.variants.section': 'Ділянка від {from} до {to}',+ 'tours.variants.current': 'Поточний шлях',+ 'tours.variants.option': 'Шлях {letter}',+ 'tours.variants.heightsPending': 'Висоти запитуються',+ 'tours.variants.heightsUnknown': 'Для цього шляху немає висот, тому підйом, спуск і час лишаються невідомими.',+ 'tours.variants.deltaHint': 'Порівняно з поточним шляхом',+ 'tours.variants.loading': 'Пошук інших шляхів',+ 'tours.variants.failed': 'Маршрутизатор не відповів. Ділянка зберігає свій шлях.',+ 'tours.variants.none': 'За поточних налаштувань маршрутизатор не знає іншого шляху для цієї ділянки.',+ 'tours.variants.notice.notHeld': 'Маршрутизатор не дотримується цього шляху. Ділянка лишається як є.',+ 'tours.variants.notice.stale': 'Тим часом тур змінився. Ділянка лишається як є.',+ 'tours.variants.notice.failed': 'Не вдалося перевірити цей шлях. Ділянка лишається як є.',+ 'tours.variants.checking': 'Шлях перевіряється',+ 'tours.variants.apply': 'Обрати цей шлях',+ 'tours.variants.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 881768a70..f6ba56e50 100644--- a/shared/src/i18n/vi/tours.ts+++ b/shared/src/i18n/vi/tours.ts@@ -1003,6 +1003,24 @@ const tours: TranslationStrings = {'tours.planner.makeStop': 'Chuyển thành điểm dừng','tours.planner.makeShaping': 'Chuyển thành điểm định hình','tours.planner.recomputeLeg': 'Tính lại chặng tiếp theo',+ 'tours.planner.compareLeg': 'So sánh các lối đi cho chặng tiếp theo',+ 'tours.variants.title': 'Lối đi khác cho chặng này',+ 'tours.variants.section': 'Chặng từ {from} đến {to}',+ 'tours.variants.current': 'Lối đi hiện tại',+ 'tours.variants.option': 'Lối đi {letter}',+ 'tours.variants.heightsPending': 'Đang tra độ cao',+ 'tours.variants.heightsUnknown':+ 'Không có độ cao cho lối đi này, nên đoạn lên, đoạn xuống và thời gian vẫn chưa biết.',+ 'tours.variants.deltaHint': 'So với lối đi hiện tại',+ 'tours.variants.loading': 'Đang tìm lối đi khác',+ 'tours.variants.failed': 'Bộ định tuyến không trả lời. Chặng giữ nguyên lối đi của nó.',+ 'tours.variants.none': 'Với cài đặt hiện tại, bộ định tuyến không biết lối đi nào khác cho chặng này.',+ 'tours.variants.notice.notHeld': 'Bộ định tuyến không bám theo lối đi này. Chặng giữ nguyên như cũ.',+ 'tours.variants.notice.stale': 'Trong lúc đó chuyến tham quan đã thay đổi. Chặng giữ nguyên như cũ.',+ 'tours.variants.notice.failed': 'Không thể kiểm tra lối đi này. Chặng giữ nguyên như cũ.',+ '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.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 2a7a0ec99..1d13c1f23 100644--- a/shared/src/i18n/zh-TW/tours.ts+++ b/shared/src/i18n/zh-TW/tours.ts@@ -935,6 +935,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': '設為停靠點','tours.planner.makeShaping': '設為塑形點','tours.planner.recomputeLeg': '重新計算下一段',+ 'tours.planner.compareLeg': '比較下一段的道路',+ 'tours.variants.title': '這一段的其他道路',+ 'tours.variants.section': '從{from}到{to}的路段',+ 'tours.variants.current': '目前道路',+ 'tours.variants.option': '道路{letter}',+ 'tours.variants.heightsPending': '正在查詢海拔',+ 'tours.variants.heightsUnknown': '這條道路沒有海拔資料,因此上升、下降和時間仍未知。',+ 'tours.variants.deltaHint': '與目前道路相比',+ 'tours.variants.loading': '正在尋找其他道路',+ 'tours.variants.failed': '路線規劃器沒有回應。此路段保留原本的道路。',+ 'tours.variants.none': '在目前設定下,路線規劃器不知道這一段的其他道路。',+ 'tours.variants.notice.notHeld': '路線規劃器不沿這條道路走。此路段維持不變。',+ 'tours.variants.notice.stale': '在此期間遊程已變更。此路段維持不變。',+ 'tours.variants.notice.failed': '無法核實這條道路。此路段維持不變。',+ 'tours.variants.checking': '正在核實道路',+ 'tours.variants.apply': '採用這條道路',+ 'tours.variants.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 3117538eb..c55739dd7 100644--- a/shared/src/i18n/zh/tours.ts+++ b/shared/src/i18n/zh/tours.ts@@ -936,6 +936,23 @@ const tours: TranslationStrings = {'tours.planner.makeStop': '设为停靠点','tours.planner.makeShaping': '设为塑形点','tours.planner.recomputeLeg': '重新计算下一段',+ 'tours.planner.compareLeg': '比较下一段的道路',+ 'tours.variants.title': '这一段的其他道路',+ 'tours.variants.section': '从{from}到{to}的路段',+ 'tours.variants.current': '当前道路',+ 'tours.variants.option': '道路{letter}',+ 'tours.variants.heightsPending': '正在查询海拔',+ 'tours.variants.heightsUnknown': '这条道路没有海拔数据,因此上升、下降和时间仍未知。',+ 'tours.variants.deltaHint': '与当前道路相比',+ 'tours.variants.loading': '正在查找其他道路',+ 'tours.variants.failed': '路线规划器没有响应。该路段保留原来的道路。',+ 'tours.variants.none': '在当前设置下,路线规划器不知道这一段的其他道路。',+ 'tours.variants.notice.notHeld': '路线规划器不沿这条道路走。该路段保持不变。',+ 'tours.variants.notice.stale': '在此期间游览路线已更改。该路段保持不变。',+ 'tours.variants.notice.failed': '无法核实这条道路。该路段保持不变。',+ 'tours.variants.checking': '正在核实道路',+ 'tours.variants.apply': '采用这条道路',+ 'tours.variants.applied': '已采用道路','tours.planner.shapeOnLine': '点击地图上的路线即可在该处添加塑形点。','tours.paddle.routeOnWater': '沿水路规划下一段','tours.paddle.routeAllOnWater': '沿水路规划手绘的路段',