Skip to content

armgit / TREK

Public Imported from GitHub
0

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

feat(tours): put a multi-day tour on a day whole or a stage a day from it on

Mauricebafb74f872d1
diff --git a/client/scripts/feature-pairs.json b/client/scripts/feature-pairs.json
index 3d3ec7809..27dc71d47 100644
--- a/client/scripts/feature-pairs.json
+++ b/client/scripts/feature-pairs.json
@@ -592,6 +592,12 @@
"desktop": ["src/components/Planner/DayPlanSidebar.tsx"],
"mobile": ["src/mobile/screens/trip/plan/useMPlanTimeline.ts"]
},
+ {
+ "feature": "A multi-day tour put on a day: the whole tour there, or a stage a day from that day on",
+ "hooks": ["src/components/Tours/stages/stageSpread.ts"],
+ "desktop": ["src/components/Tours/stages/TourDayChoiceDialog.tsx", "src/components/Tours/stages/TourDayAddButton.tsx"],
+ "mobile": ["src/mobile/screens/trip/sheets/MTourDayChoiceSheet.tsx"]
+ },
{
"feature": "Reservation form incl. hotel accommodation creation",
"hooks": ["src/components/Planner/reservationFormModel.ts", "src/components/Planner/useReservationForm.ts"],
diff --git a/client/src/components/Tours/TourDetailDialog.tsx b/client/src/components/Tours/TourDetailDialog.tsx
index eb83ce1d9..8726299a2 100644
--- a/client/src/components/Tours/TourDetailDialog.tsx
+++ b/client/src/components/Tours/TourDetailDialog.tsx
@@ -18,7 +18,6 @@ import {
Minus,
Navigation,
Pencil,
- Plus,
Route,
Ruler,
Upload,
@@ -58,6 +57,8 @@ import { PaddleWindSection } from './paddle/PaddleWindCard';
import { TourProvenanceBlock } from './provenance/TourProvenanceSection';
import { RunHeadPills } from './run/RunHeadPills';
import { SkiHeadPill } from './ski/skiMarks';
+import { stageKeysOfTour, type TourDayHow } from './stages/stageSpread';
+import { TourDayAddButton } from './stages/TourDayAddButton';
import { tourDayRowIcon } from './tourDayRowIcon';
import { tourDaysOf } from './tourDays';
import { heightsUnknown, movingTimeLabel, withoutHeights } from './tourFacts';
@@ -98,7 +99,8 @@ interface TourDetailDialogProps extends TourPermissionProps {
onToursChanged?: (placeIds: number[]) => Promise<void> | void;
/** P2D-XD-01: opens the trip's packing list the tour points at. */
onOpenPacking?: () => void;
- onAssignToDay?: (placeId: number, dayId?: number) => void;
+ /** `how` is the answer the day menu got for a multi-day tour (MDT-02); without it the plan asks. */
+ onAssignToDay?: (placeId: number, dayId?: number, position?: number, how?: TourDayHow) => void;
onRemoveAssignment?: (dayId: number, assignmentId: number) => void;
onDelete?: () => void;
leftWidth?: number;
@@ -531,7 +533,11 @@ export default function TourDetailDialog({
canAssign: assignPermission,
});
const canEdit = hasEditPermission && !readOnly;
- const dayAssignment = useTourDayAssignment({ canAssign, onAssignToDay: (id, dayId) => onAssignToDay?.(id, dayId) });
+ const dayAssignment = useTourDayAssignment({
+ canAssign,
+ onAssignToDay: (id, dayId, position, how) =>
+ how ? onAssignToDay?.(id, dayId, position, how) : onAssignToDay?.(id, dayId),
+ });
const { t } = useTranslation();
const distanceUnit = useSettingsStore((state) => state.settings.distance_unit) ?? 'metric';
const [colorOpen, setColorOpen] = useState(false);
@@ -625,14 +631,13 @@ export default function TourDetailDialog({
</DialogButton>
)
: onAssignToDay && (
- <DialogButton
- variant="primary"
- onClick={() => void dayAssignment.assign(place.id, selectedDayId)}
- disabled={!dayAssignment.isAvailable(place.id, selectedDayId)}
- icon={<Plus size={14} strokeWidth={2} />}
- >
- {t('inspector.addToDay')}
- </DialogButton>
+ <TourDayAddButton
+ placeId={place.id}
+ dayId={selectedDayId}
+ days={days}
+ stageCount={stageKeysOfTour(tour).length}
+ assignment={dayAssignment}
+ />
))}
{navigationTargets.length > 0 && (
<>
diff --git a/client/src/components/Tours/ToursSidebar.tsx b/client/src/components/Tours/ToursSidebar.tsx
index 2f9f8d657..7f84aa1a8 100644
--- a/client/src/components/Tours/ToursSidebar.tsx
+++ b/client/src/components/Tours/ToursSidebar.tsx
@@ -15,6 +15,7 @@ import TourGpxPreviewDialog from './TourGpxPreviewDialog'
import { useTourGpxImport } from './useTourGpxImport'
import { type AssignTourToDay, useTourDayAssignment } from './useTourDayAssignment'
import { useTourMapVisibility } from './useTourMapVisibility'
+import { stageKeysOfTour } from './stages/stageSpread'
import { useTripStore } from '../../store/tripStore'
import { resolveTrackColor } from '../Map/trackColors'
@@ -118,7 +119,7 @@ export default function ToursSidebar({ tripId, days, tours, loading = false, sel
hideLabel: t('tours.visibility.hide'),
}}
onSelect={(selectedTour, opener) => onSelectTour?.(selectedTour, opener)}
- action={<TourDayMenu days={days} placeId={tour.place_id} label={t('tours.addToDay')} assignment={dayAssignment} />}
+ action={<TourDayMenu days={days} placeId={tour.place_id} label={t('tours.addToDay')} assignment={dayAssignment} stageCount={stageKeysOfTour(tour).length} />}
/>
))}
</ul>
diff --git a/client/src/components/Tours/planner/TourPlannerPanels.tsx b/client/src/components/Tours/planner/TourPlannerPanels.tsx
index f3582a338..8833c719f 100644
--- a/client/src/components/Tours/planner/TourPlannerPanels.tsx
+++ b/client/src/components/Tours/planner/TourPlannerPanels.tsx
@@ -36,6 +36,7 @@ import { TourStageDayNotice } from '../stages/TourStageDayNotice'
import { TourStageModeField } from '../stages/TourStageModeField'
import { TourStagesSection } from '../stages/TourStagesSection'
import { stageBoundariesM } from '../stages/tourStages'
+import { stageKeysOfTour } from '../stages/stageSpread'
import { TourStageOverview } from '../stages/TourStageOverview'
import { useTourStageRail } from '../stages/useTourStageRail'
import { useTripStore } from '../../../store/tripStore'
@@ -893,6 +894,7 @@ export function TourPlannerToursRail({ planner, tours, days, loading, onAssignTo
placeId={tour.place_id}
label={`${t('tours.addToDay')}: ${tour.name}`}
assignment={dayAssignment}
+ stageCount={stageKeysOfTour(tour).length}
/>
)}
{canEdit && onDeleteTour && (
diff --git a/client/src/components/Tours/stages/TourDayAddButton.tsx b/client/src/components/Tours/stages/TourDayAddButton.tsx
new file mode 100644
index 000000000..1dc038f35
--- /dev/null
+++ b/client/src/components/Tours/stages/TourDayAddButton.tsx
@@ -0,0 +1,89 @@
+import { CalendarDays, CalendarRange, ChevronDown, Plus } from 'lucide-react';
+import type { MouseEvent } from 'react';
+import { useTranslation } from '../../../i18n';
+import type { Day } from '../../../types';
+import { ContextMenu, useContextMenu } from '../../shared/ContextMenu';
+import { DialogButton } from '../../shared/DialogShell';
+import type { TourDayAssignment } from '../useTourDayAssignment';
+import { stagesThatFit, tourDayChoices } from './stageSpread';
+
+type Translate = ReturnType<typeof useTranslation>['t'];
+type MenuItems = Parameters<ReturnType<typeof useContextMenu>['open']>[1];
+
+interface TourDayHowInput {
+ placeId: number;
+ dayId: number;
+ days: Day[];
+ /** The stages of the multi-day tour. */
+ stageCount: number;
+ assignment: TourDayAssignment;
+}
+
+/**
+ * MDT-02: the two ways a multi-day tour goes on a day, as menu items: whole,
+ * or a stage a day from it on. Whole is greyed out on a day that holds the
+ * tour already; the stages say how many fit when the trip ends before them.
+ */
+export function tourDayHowItems(input: TourDayHowInput, t: Translate): MenuItems {
+ const { placeId, dayId, days, stageCount, assignment } = input;
+ const facts = {
+ count: stageCount,
+ fit: stagesThatFit(days, dayId, stageCount),
+ wholeFree: !assignment.isOnDay(placeId, dayId),
+ };
+ return tourDayChoices(facts, t).map((choice) => ({
+ label: choice.title,
+ icon: choice.how === 'whole' ? CalendarDays : CalendarRange,
+ disabled: choice.disabled || !assignment.isAvailable(placeId, dayId, choice.how),
+ onClick: () => void assignment.assign(placeId, dayId, choice.how),
+ }));
+}
+
+/**
+ * The detail's "Add to day" for the day selected in the plan. A day tour goes
+ * on at once; a multi-day tour opens the two ways first, in a menu under the
+ * button, so the choice is made where the day was.
+ */
+export function TourDayAddButton(input: TourDayHowInput) {
+ const { placeId, dayId, stageCount, assignment } = input;
+ const { t } = useTranslation();
+ const menu = useContextMenu();
+ const staged = stageCount > 1;
+
+ const onClick = (event: MouseEvent<HTMLButtonElement>) => {
+ if (!staged) {
+ void assignment.assign(placeId, dayId);
+ return;
+ }
+ if (menu.menu) {
+ event.stopPropagation();
+ menu.close();
+ return;
+ }
+ menu.open(event, tourDayHowItems(input, t), true);
+ };
+
+ return (
+ <>
+ <DialogButton
+ variant="primary"
+ onClick={onClick}
+ disabled={!assignment.isAvailable(placeId, dayId, staged ? 'stages' : 'whole')}
+ aria-haspopup={staged ? 'menu' : undefined}
+ aria-expanded={staged ? !!menu.menu : undefined}
+ icon={<Plus size={14} strokeWidth={2} />}
+ >
+ {t('inspector.addToDay')}
+ {staged && (
+ <ChevronDown
+ size={13}
+ strokeWidth={2.2}
+ aria-hidden="true"
+ className={`transition-transform ${menu.menu ? 'rotate-180' : ''}`}
+ />
+ )}
+ </DialogButton>
+ <ContextMenu menu={menu.menu} onClose={menu.close} />
+ </>
+ );
+}
diff --git a/client/src/components/Tours/stages/TourDayChoiceDialog.tsx b/client/src/components/Tours/stages/TourDayChoiceDialog.tsx
new file mode 100644
index 000000000..7d96b7024
--- /dev/null
+++ b/client/src/components/Tours/stages/TourDayChoiceDialog.tsx
@@ -0,0 +1,89 @@
+import { CalendarDays, CalendarRange } from 'lucide-react';
+import { useId } from 'react';
+import { useTranslation } from '../../../i18n';
+import {
+ DialogButton,
+ DialogFooter,
+ DialogHeader,
+ DialogShell,
+ DialogTile,
+ FooterSpacer,
+ fs,
+ NEUTRAL_TINT,
+} from '../../shared/DialogShell';
+import { tourDayChoices, type TourDayHow, type TourDayQuestion } from './stageSpread';
+
+interface TourDayChoiceDialogProps {
+ question: TourDayQuestion | null;
+ onAnswer: (how: TourDayHow | null) => void;
+}
+
+/**
+ * MDT-02: how a multi-day tour goes on a day that it was dragged onto or
+ * added to from somewhere without a day menu: whole, or a stage a day from it
+ * on, each saying what it does. Nothing is written before one is chosen, and
+ * closing leaves the plan as it was.
+ */
+export function TourDayChoiceDialog({ question, onAnswer }: TourDayChoiceDialogProps) {
+ const { t } = useTranslation();
+ const labelId = useId();
+ if (!question) return null;
+ const close = () => onAnswer(null);
+ return (
+ <DialogShell
+ onClose={close}
+ labelledBy={labelId}
+ width="narrow"
+ header={
+ <DialogHeader
+ tile={
+ <DialogTile>
+ <CalendarRange size={20} strokeWidth={1.9} className="text-content" />
+ </DialogTile>
+ }
+ tint={NEUTRAL_TINT}
+ labelId={labelId}
+ onClose={close}
+ eyebrow={t('dayplan.dayN', { n: question.day })}
+ title={question.name}
+ sub={t('tours.stages.count', { count: question.count })}
+ />
+ }
+ footer={
+ <DialogFooter>
+ <FooterSpacer />
+ <DialogButton onClick={close}>{t('common.cancel')}</DialogButton>
+ </DialogFooter>
+ }
+ >
+ <div className="flex flex-col gap-2">
+ {tourDayChoices(question, t).map((choice) => (
+ <button
+ key={choice.how}
+ type="button"
+ disabled={choice.disabled}
+ onClick={() => onAnswer(choice.how)}
+ data-testid={`tour-day-choice-${choice.how}`}
+ className="flex w-full min-w-0 items-center gap-3 rounded-[12px] border border-edge-faint bg-surface-secondary px-3 py-2.5 text-start transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent enabled:hover:bg-surface-card disabled:cursor-default disabled:opacity-50"
+ >
+ <span className="grid h-8 w-8 flex-none place-items-center rounded-full bg-edge text-content-secondary">
+ {choice.how === 'whole' ? (
+ <CalendarDays size={15} strokeWidth={2} aria-hidden="true" />
+ ) : (
+ <CalendarRange size={15} strokeWidth={2} aria-hidden="true" />
+ )}
+ </span>
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <span className="font-semibold text-content" style={fs(13, 'body')}>
+ {choice.title}
+ </span>
+ <span className="text-content-muted" style={fs(12, 'body')}>
+ {choice.hint}
+ </span>
+ </span>
+ </button>
+ ))}
+ </div>
+ </DialogShell>
+ );
+}
diff --git a/client/src/components/Tours/stages/stageSpread.test.ts b/client/src/components/Tours/stages/stageSpread.test.ts
new file mode 100644
index 000000000..b0d635e42
--- /dev/null
+++ b/client/src/components/Tours/stages/stageSpread.test.ts
@@ -0,0 +1,118 @@
+// FE-TOUR-STAGE-SPREAD-001 to FE-TOUR-STAGE-SPREAD-009: the stages of a multi-day tour put on the
+// trip's days from one day on, one a day, and the two ways a tour goes on a day (MDT-02).
+import { describe, expect, it } from 'vitest';
+import type { AssignmentsMap } from '../../../types';
+import { planStageSpread, stageKeysOfTour, stagesThatFit, tourDayChoices } from './stageSpread';
+
+const DAYS = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }];
+const KEYS = ['stop-a', 'stop-b', 'stop-c'];
+const t = (key: string, params?: Record<string, unknown>) => (params ? `${key} ${JSON.stringify(params)}` : key);
+
+/** Tour 9 on the days given as `{ day: [assignment id, stage key or null] }`; place 5 on day 2 as a neighbour. */
+function plan(held: Record<number, [number, string | null]>) {
+ const assignments: AssignmentsMap = { '1': [], '2': [], '3': [], '4': [] };
+ assignments['2'].push({ id: 500, place_id: 5, tour_stage_key: null } as never);
+ for (const [day, [id, key]] of Object.entries(held)) {
+ assignments[day].push({ id, place_id: 9, tour_stage_key: key } as never);
+ }
+ return (dayId: number, keys = KEYS) => planStageSpread({ placeId: 9, keys, days: DAYS, assignments, dayId });
+}
+
+describe('stage spread', () => {
+ it('FE-TOUR-STAGE-SPREAD-001: reads the stage keys off the stops, the last stop starting none', () => {
+ const stops = KEYS.concat('stop-end').map((key) => ({ key, lat: 47, lng: 11 }));
+ expect(stageKeysOfTour({ stage_stops: stops })).toEqual(KEYS);
+ expect(stageKeysOfTour({ stage_stops: null })).toEqual([]);
+ expect(stageKeysOfTour(undefined)).toEqual([]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-002: counts the stages that fit before the trip ends, and none for a day it has not', () => {
+ expect(stagesThatFit(DAYS, 1, 3)).toBe(3);
+ expect(stagesThatFit(DAYS, 3, 3)).toBe(2);
+ expect(stagesThatFit(DAYS, 4, 3)).toBe(1);
+ expect(stagesThatFit(DAYS, 99, 3)).toBe(0);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-003: puts each stage on the next day in order, leaving other places alone', () => {
+ const result = plan({})(2);
+ expect(result.steps).toEqual([
+ { kind: 'create', dayId: 2, key: 'stop-a' },
+ { kind: 'create', dayId: 3, key: 'stop-b' },
+ { kind: 'create', dayId: 4, key: 'stop-c' },
+ ]);
+ expect(result.placed.map((stage) => stage.dayId)).toEqual([2, 3, 4]);
+ expect(result.unplaced).toBe(0);
+ expect(result.wholeOff).toEqual([]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-004: past the last day the rest stay on no day, never on a day made up', () => {
+ const result = plan({ 1: [11, 'stop-c'] })(3);
+ expect(result.steps).toEqual([
+ { kind: 'remove', dayId: 1, assignmentId: 11 },
+ { kind: 'create', dayId: 3, key: 'stop-a' },
+ { kind: 'create', dayId: 4, key: 'stop-b' },
+ ]);
+ expect(result.placed).toEqual([
+ { key: 'stop-a', dayId: 3 },
+ { key: 'stop-b', dayId: 4 },
+ ]);
+ expect(result.unplaced).toBe(1);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-005: a stage on its day stays and one on another day moves', () => {
+ const result = plan({ 1: [11, 'stop-a'], 4: [14, 'stop-b'] })(1);
+ expect(result.steps).toEqual([
+ { kind: 'move', assignmentId: 14, fromDayId: 4, toDayId: 2 },
+ { kind: 'create', dayId: 3, key: 'stop-c' },
+ ]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-006: the whole tour and a stage the route no longer has come off first', () => {
+ const result = plan({ 1: [11, null], 3: [13, 'stop-gone'] })(1);
+ expect(result.steps.slice(0, 2)).toEqual([
+ { kind: 'remove', dayId: 1, assignmentId: 11 },
+ { kind: 'remove', dayId: 3, assignmentId: 13 },
+ ]);
+ expect(result.steps.slice(2).map((step) => step.kind)).toEqual(['create', 'create', 'create']);
+ expect(result.wholeOff).toEqual([1]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-007: a stage waits until the one on its day has moved on', () => {
+ const result = plan({ 2: [12, 'stop-b'], 3: [13, 'stop-c'] })(3, ['stop-b', 'stop-c']);
+ expect(result.steps).toEqual([
+ { kind: 'move', assignmentId: 13, fromDayId: 3, toDayId: 4 },
+ { kind: 'move', assignmentId: 12, fromDayId: 2, toDayId: 3 },
+ ]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-008: two stages that would swap days: one comes off and goes on again', () => {
+ const result = plan({ 1: [11, 'stop-b'], 2: [12, 'stop-a'] })(1, ['stop-a', 'stop-b']);
+ expect(result.steps).toEqual([
+ { kind: 'remove', dayId: 1, assignmentId: 11 },
+ { kind: 'move', assignmentId: 12, fromDayId: 2, toDayId: 1 },
+ { kind: 'create', dayId: 2, key: 'stop-b' },
+ ]);
+ expect(plan({})(99).placed).toEqual([]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-009: words the two ways, whole greyed out on a day that holds the tour', () => {
+ const [whole, stages] = tourDayChoices({ count: 3, fit: 3, wholeFree: true }, t);
+ expect(whole).toEqual({
+ how: 'whole',
+ title: 'tours.stages.placeWhole',
+ hint: 'tours.stages.placeWholeHint',
+ disabled: false,
+ });
+ expect(stages).toEqual({
+ how: 'stages',
+ title: 'tours.stages.placeStages',
+ hint: 'tours.stages.placeStagesHint',
+ disabled: false,
+ });
+ const [taken, short] = tourDayChoices({ count: 3, fit: 2, wholeFree: false }, t);
+ expect(taken.disabled).toBe(true);
+ expect(taken.hint).toBe('tours.stages.placeWholeTaken');
+ expect(short.title).toBe('tours.stages.placeStagesFit {"last":2}');
+ expect(short.hint).toBe('tours.stages.placeStagesShort {"last":2}');
+ });
+});
diff --git a/client/src/components/Tours/stages/stageSpread.ts b/client/src/components/Tours/stages/stageSpread.ts
new file mode 100644
index 000000000..034d59005
--- /dev/null
+++ b/client/src/components/Tours/stages/stageSpread.ts
@@ -0,0 +1,170 @@
+import type { TourListItem } from '@trek/shared';
+import type { useTranslation } from '../../../i18n';
+import type { AssignmentsMap, Day } from '../../../types';
+
+type Translate = ReturnType<typeof useTranslation>['t'];
+
+/** How a multi-day tour goes on a day: the whole tour there, or a stage a day from there on. */
+export type TourDayHow = 'whole' | 'stages';
+
+/**
+ * The keys a tour's stages go on days by, in route order: those of the stops
+ * each stage starts at, the last stop starting none. Empty for a day tour.
+ */
+export function stageKeysOfTour(tour: Pick<TourListItem, 'stage_stops'> | null | undefined): string[] {
+ return (tour?.stage_stops ?? []).slice(0, -1).map((stop) => stop.key);
+}
+
+/** How many of `count` stages fit from a day on, one a day up to the trip's last day; 0 for a day the trip has not. */
+export function stagesThatFit(days: readonly Pick<Day, 'id'>[], dayId: number, count: number): number {
+ const at = days.findIndex((day) => day.id === dayId);
+ return at < 0 ? 0 : Math.min(count, days.length - at);
+}
+
+/** One write of a spread, in the order it is sent. */
+export type SpreadStep =
+ | { kind: 'remove'; dayId: number; assignmentId: number }
+ | { kind: 'move'; assignmentId: number; fromDayId: number; toDayId: number }
+ | { kind: 'create'; dayId: number; key: string };
+
+export interface StageSpread {
+ steps: SpreadStep[];
+ /** The stages that get a day, in route order. */
+ placed: Array<{ key: string; dayId: number }>;
+ /** The stages the trip has no day left for; they end up on none. */
+ unplaced: number;
+ /** The days the whole tour comes off, its stages taking its place. */
+ wholeOff: number[];
+}
+
+interface SpreadInput {
+ placeId: number;
+ keys: readonly string[];
+ days: readonly Pick<Day, 'id'>[];
+ assignments: AssignmentsMap;
+ dayId: number;
+}
+
+/**
+ * The stages of the tour on a day that keep a day, by their key; and the
+ * writes that take off the rest first: the whole tour, a stage the route no
+ * longer has, and a stage the trip has no day left for.
+ */
+function heldStagesOf(placeId: number, want: ReadonlyMap<string, number | null>, assignments: AssignmentsMap) {
+ const own = new Map<string, { assignmentId: number; dayId: number }>();
+ const steps: SpreadStep[] = [];
+ const wholeOff: number[] = [];
+ for (const [dayKey, items] of Object.entries(assignments)) {
+ for (const item of items.filter((entry) => entry.place_id === placeId)) {
+ const day = Number(dayKey);
+ const key = item.tour_stage_key;
+ if (key && want.get(key) != null) own.set(key, { assignmentId: item.id, dayId: day });
+ else steps.push({ kind: 'remove', dayId: day, assignmentId: item.id });
+ if (!key) wholeOff.push(day);
+ }
+ }
+ return { own, steps, wholeOff };
+}
+
+/**
+ * The writes that put the stages of a multi-day tour on the trip's days from
+ * one day on: stage 1 on that day, stage 2 on the next, and so on (MDT-02
+ * holds a stage on one day at most, and a day holds the tour once). A stage
+ * already on its day stays, one on another day moves, one on none is put on
+ * its day. The whole tour comes off the days it is on, since the stages take
+ * its place; so does a stage the route no longer has. Stages past the trip's
+ * last day are on no day afterwards, never on a day made up for them. The
+ * writes are ordered so that each lands on a day nothing else of the tour
+ * holds at that moment: a stage whose day another stage still holds waits
+ * until that one has moved, and of stages that would swap days one comes off
+ * first and goes on again like a new one.
+ */
+export function planStageSpread({ placeId, keys, days, assignments, dayId }: SpreadInput): StageSpread {
+ const at = days.findIndex((day) => day.id === dayId);
+ const targets = at < 0 ? [] : days.slice(at).map((day) => day.id);
+ const want = new Map(keys.map((key, index) => [key, targets[index] ?? null] as const));
+ const { own, steps, wholeOff } = heldStagesOf(placeId, want, assignments);
+
+ const holder = new Map([...own].map(([key, held]) => [held.dayId, key] as const));
+ let open = keys.filter((key) => {
+ const target = want.get(key);
+ return target != null && own.get(key)?.dayId !== target;
+ });
+ while (open.length > 0) {
+ const free = open.find((key) => !holder.has(want.get(key) as number));
+ if (free === undefined) {
+ // Every stage left waits for a day another of them holds: the one in the way comes off first.
+ const blocker = holder.get(want.get(open[0]) as number) as string;
+ const held = own.get(blocker);
+ if (!held) break;
+ steps.push({ kind: 'remove', dayId: held.dayId, assignmentId: held.assignmentId });
+ holder.delete(held.dayId);
+ own.delete(blocker);
+ continue;
+ }
+ const target = want.get(free) as number;
+ const held = own.get(free);
+ if (held) {
+ steps.push({ kind: 'move', assignmentId: held.assignmentId, fromDayId: held.dayId, toDayId: target });
+ holder.delete(held.dayId);
+ } else {
+ steps.push({ kind: 'create', dayId: target, key: free });
+ }
+ holder.set(target, free);
+ open = open.filter((key) => key !== free);
+ }
+
+ const placed = keys.flatMap((key) => {
+ const target = want.get(key);
+ return target == null ? [] : [{ key, dayId: target }];
+ });
+ return { steps, placed, unplaced: keys.length - placed.length, wholeOff };
+}
+
+/** What the choice between the two ways is asked about: the stages, how many fit, and whether the day is free. */
+interface TourDayChoiceFacts {
+ count: number;
+ fit: number;
+ /** Whether the whole tour can go on the day: not while the day holds the tour or a stage of it. */
+ wholeFree: boolean;
+}
+
+/** The question the day plan asks when a multi-day tour is put on a day some way without a menu. */
+export interface TourDayQuestion extends TourDayChoiceFacts {
+ placeId: number;
+ dayId: number;
+ /** The day's number in the trip, as the plan shows it. */
+ day: number;
+ name: string;
+}
+
+interface TourDayChoice {
+ how: TourDayHow;
+ title: string;
+ hint: string;
+ disabled: boolean;
+}
+
+/**
+ * The two ways a multi-day tour goes on a day, as every place that asks words
+ * them: the menu of a tour list, the detail's button, the dialog and the
+ * phone's sheet. The stages say up to which one fits when the trip ends
+ * before the last of them.
+ */
+export function tourDayChoices({ count, fit, wholeFree }: TourDayChoiceFacts, t: Translate): TourDayChoice[] {
+ const short = fit < count;
+ return [
+ {
+ how: 'whole',
+ title: t('tours.stages.placeWhole'),
+ hint: wholeFree ? t('tours.stages.placeWholeHint') : t('tours.stages.placeWholeTaken'),
+ disabled: !wholeFree,
+ },
+ {
+ how: 'stages',
+ title: short ? t('tours.stages.placeStagesFit', { last: fit }) : t('tours.stages.placeStages'),
+ hint: short ? t('tours.stages.placeStagesShort', { last: fit }) : t('tours.stages.placeStagesHint'),
+ disabled: fit === 0,
+ },
+ ];
+}
diff --git a/client/src/components/Tours/stages/tourDayChoiceViews.test.tsx b/client/src/components/Tours/stages/tourDayChoiceViews.test.tsx
new file mode 100644
index 000000000..fb6d06a10
--- /dev/null
+++ b/client/src/components/Tours/stages/tourDayChoiceViews.test.tsx
@@ -0,0 +1,96 @@
+// FE-TOUR-STAGE-SPREAD-017 to FE-TOUR-STAGE-SPREAD-021: where a multi-day tour is put on a day on the
+// desktop, the choice between the whole tour and a stage a day: the list's day menu, the detail's
+// button and the dialog for a tour dragged onto a day (MDT-02).
+import userEvent from '@testing-library/user-event';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { buildDay } from '../../../../tests/helpers/factories';
+import { render, screen } from '../../../../tests/helpers/render';
+import { TourDayMenu } from '../tourParts';
+import type { TourDayAssignment } from '../useTourDayAssignment';
+import { TourDayAddButton } from './TourDayAddButton';
+import { TourDayChoiceDialog } from './TourDayChoiceDialog';
+import type { TourDayQuestion } from './stageSpread';
+
+const DAYS = [buildDay({ id: 3, day_number: 1, date: null }), buildDay({ id: 4, day_number: 2, date: null })];
+
+let assignment: TourDayAssignment;
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ assignment = {
+ canAssign: true,
+ isOnDay: vi.fn(() => false),
+ isPending: vi.fn(() => false),
+ isAvailable: vi.fn(() => true),
+ assign: vi.fn(async () => true),
+ };
+});
+
+describe('the day menu of a tour list', () => {
+ it('FE-TOUR-STAGE-SPREAD-017: a day tour goes on the day it is given, with no second step', async () => {
+ render(<TourDayMenu days={DAYS} placeId={81} label="Add to day" assignment={assignment} />);
+ await userEvent.click(screen.getByRole('button', { name: 'Add to day' }));
+ await userEvent.click(screen.getByText('Day 2'));
+ expect(assignment.assign).toHaveBeenCalledWith(81, 4);
+ expect(screen.queryByText('Whole tour on this day')).toBeNull();
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-018: a multi-day tour asks next, in the menu, whole or a stage a day', async () => {
+ render(<TourDayMenu days={DAYS} placeId={81} label="Add to day" assignment={assignment} stageCount={2} />);
+ await userEvent.click(screen.getByRole('button', { name: 'Add to day' }));
+ await userEvent.click(screen.getByText('Day 1'));
+ expect(assignment.assign).not.toHaveBeenCalled();
+ expect(await screen.findByRole('button', { name: 'Whole tour on this day' })).toBeEnabled();
+ await userEvent.click(screen.getByRole('button', { name: 'Stages from this day on' }));
+ expect(assignment.assign).toHaveBeenCalledWith(81, 3, 'stages');
+ expect(assignment.isAvailable).toHaveBeenCalledWith(81, 3, 'stages');
+ });
+});
+
+describe('the detail button and the dialog', () => {
+ it('FE-TOUR-STAGE-SPREAD-019: the detail adds a day tour at once and offers a multi-day tour both ways', async () => {
+ const props = { placeId: 81, dayId: 4, days: DAYS, assignment };
+ const { unmount } = render(<TourDayAddButton {...props} stageCount={0} />);
+ await userEvent.click(screen.getByRole('button', { name: 'Add to day' }));
+ expect(assignment.assign).toHaveBeenCalledWith(81, 4);
+ unmount();
+
+ vi.mocked(assignment.isOnDay).mockReturnValue(true);
+ render(<TourDayAddButton {...props} stageCount={3} />);
+ await userEvent.click(screen.getByRole('button', { name: 'Add to day' }));
+ expect(screen.getByRole('button', { name: 'Whole tour on this day' })).toBeDisabled();
+ await userEvent.click(screen.getByRole('button', { name: 'Stages from this day on, up to stage 1' }));
+ expect(assignment.assign).toHaveBeenLastCalledWith(81, 4, 'stages');
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-020: the dialog names the day and the tour, says what each way does and answers', async () => {
+ const onAnswer = vi.fn();
+ const question: TourDayQuestion = {
+ placeId: 81,
+ dayId: 4,
+ day: 2,
+ name: 'Hut to hut',
+ count: 3,
+ fit: 2,
+ wholeFree: false,
+ };
+ render(<TourDayChoiceDialog question={question} onAnswer={onAnswer} />);
+ expect(screen.getByText('Day 2')).toBeInTheDocument();
+ expect(screen.getByText('Hut to hut')).toBeInTheDocument();
+ expect(screen.getByText('3 stages')).toBeInTheDocument();
+ expect(screen.getByTestId('tour-day-choice-whole')).toBeDisabled();
+ expect(screen.getByText('This day already holds the tour.')).toBeInTheDocument();
+ expect(screen.getByText('Stages from this day on, up to stage 2')).toBeInTheDocument();
+ const short = 'The trip ends after stage 2. The stages after it stay without a day.';
+ expect(screen.getByText(short)).toBeInTheDocument();
+ await userEvent.click(screen.getByTestId('tour-day-choice-stages'));
+ expect(onAnswer).toHaveBeenLastCalledWith('stages');
+ await userEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+ expect(onAnswer).toHaveBeenLastCalledWith(null);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-021: no question, no dialog', () => {
+ render(<TourDayChoiceDialog question={null} onAnswer={vi.fn()} />);
+ expect(screen.queryByTestId('tour-day-choice-whole')).toBeNull();
+ });
+});
diff --git a/client/src/components/Tours/tourParts.tsx b/client/src/components/Tours/tourParts.tsx
index 3b831a9cc..d75186e70 100644
--- a/client/src/components/Tours/tourParts.tsx
+++ b/client/src/components/Tours/tourParts.tsx
@@ -18,6 +18,7 @@ import type { TourDayAssignment } from './useTourDayAssignment'
import { useRailFold } from './railFold'
import { tourDayRowIcon } from './tourDayRowIcon'
import { SkiCornerMark } from './ski/skiMarks'
+import { tourDayHowItems } from './stages/TourDayAddButton'
/**
* A tour's tile in a list: its T-scale grade in place of the mountain, named in
@@ -181,28 +182,40 @@ export function TourDayTiles({ tourDays }: { tourDays: readonly TourDay[] }) {
* Putting a tour on a day: a round "+" on a row, or a footer button with a
* chevron, both opening the trip's days as a menu. Which days it offers and
* the write itself come from the shared assignment rules (PR1-18): a day that
- * has the tour, or is getting it right now, is greyed out.
+ * has the tour, or is getting it right now, is greyed out. A multi-day tour
+ * (MDT-02) asks next, in the same place, whether it goes on the day whole or
+ * a stage a day from it on; a day that holds it can still take its stages.
*/
-export function TourDayMenu({ days, placeId, assignment, label, variant = 'round', primary = false }: {
+export function TourDayMenu({ days, placeId, assignment, label, variant = 'round', primary = false, stageCount = 0 }: {
days: Day[]
placeId: number
assignment: TourDayAssignment
label: string
variant?: 'round' | 'button'
primary?: boolean
+ /** The stages of a multi-day tour; under two it is a day tour. */
+ stageCount?: number
}) {
const { t, locale } = useTranslation()
const menu = useContextMenu()
+ const trigger = useRef<Element | null>(null)
const disabled = !assignment.canAssign
+ const staged = stageCount > 1
+ // The next step opens once the click that chose the day has closed the first.
+ const askHow = (day: Day) => window.setTimeout(() => {
+ const ways = tourDayHowItems({ placeId, dayId: day.id, days, stageCount, assignment }, t)
+ if (trigger.current?.isConnected) menu.openAt(trigger.current, ways)
+ }, 0)
const items = days.map((day, index) => ({
label: dayMenuLabel(day, index, t, locale),
- disabled: !assignment.isAvailable(placeId, day.id),
- onClick: () => void assignment.assign(placeId, day.id),
+ disabled: !assignment.isAvailable(placeId, day.id, staged ? 'stages' : 'whole'),
+ onClick: () => { if (staged) askHow(day); else void assignment.assign(placeId, day.id) },
}))
const hasAvailableDay = items.some(item => !item.disabled)
const open = (event: React.MouseEvent<HTMLButtonElement>) => {
if (disabled || !hasAvailableDay) return
if (menu.menu) { event.stopPropagation(); menu.close(); return }
+ trigger.current = event.currentTarget
menu.open(event, items, true)
}
return (
diff --git a/client/src/components/Tours/useTourDayAssignment.test.ts b/client/src/components/Tours/useTourDayAssignment.test.ts
index 95a4770c2..af694c4b6 100644
--- a/client/src/components/Tours/useTourDayAssignment.test.ts
+++ b/client/src/components/Tours/useTourDayAssignment.test.ts
@@ -65,4 +65,17 @@ describe('useTourDayAssignment (PR1-18)', () => {
expect(onAssignToDay).toHaveBeenCalledTimes(1);
expect(onAssignToDay).toHaveBeenCalledWith(42, 4);
});
+
+ it('lets the stages of a multi-day tour go from a day that holds it, and passes on how (MDT-02)', async () => {
+ const onAssignToDay = vi.fn(async () => true);
+ const { result } = renderHook(() => useTourDayAssignment({ canAssign: true, onAssignToDay }));
+ expect(result.current.isAvailable(42, 3, 'whole')).toBe(false);
+ expect(result.current.isAvailable(42, 3, 'stages')).toBe(true);
+ await act(async () => {
+ expect(await result.current.assign(42, 3, 'stages')).toBe(true);
+ expect(await result.current.assign(42, 3, 'whole')).toBe(false);
+ });
+ expect(onAssignToDay).toHaveBeenCalledTimes(1);
+ expect(onAssignToDay).toHaveBeenCalledWith(42, 3, undefined, 'stages');
+ });
});
diff --git a/client/src/components/Tours/useTourDayAssignment.ts b/client/src/components/Tours/useTourDayAssignment.ts
index 87f2c9b5e..3c83acd00 100644
--- a/client/src/components/Tours/useTourDayAssignment.ts
+++ b/client/src/components/Tours/useTourDayAssignment.ts
@@ -1,17 +1,23 @@
import { useCallback, useRef, useState } from 'react';
import { useTripStore } from '../../store/tripStore';
import type { AssignmentsMap } from '../../types';
+import type { TourDayHow } from './stages/stageSpread';
/** A tour fills its day, so a day holds it at most once; the server refuses a second time the same way. */
export function isTourOnDay(assignments: AssignmentsMap, placeId: number, dayId: number): boolean {
return (assignments[String(dayId)] ?? []).some((assignment) => assignment.place_id === placeId);
}
-/** The one write a tour goes onto a day through; `false` when it did not happen. */
+/**
+ * The one write a tour goes onto a day through; `false` when it did not happen.
+ * `how` is the answer a menu got already for a multi-day tour (MDT-02): whole,
+ * or a stage a day from this day on. Without it the plan asks itself.
+ */
export type AssignTourToDay = (
placeId: number,
dayId: number,
- position?: number
+ position?: number,
+ how?: TourDayHow
) => void | boolean | Promise<void | boolean>;
interface TourDayAssignmentOptions {
@@ -25,8 +31,9 @@ interface TourDayAssignmentOptions {
* of a tour list, the tour's detail and the phone's action sheet alike: the
* right to change the days, a day that already has the tour (from the store,
* so a change shows at once), and a request still on its way, so a second
- * click cannot send it twice. The write itself is the plan's one assignment
- * path, which also says what happened.
+ * click cannot send it twice. A multi-day tour goes on a day whole or a stage
+ * a day from it on (MDT-02), as the menu asked. The write itself is the plan's
+ * one assignment path, which also says what happened.
*/
export function useTourDayAssignment({ canAssign, onAssignToDay }: TourDayAssignmentOptions) {
const assignments = useTripStore((state) => state.assignments);
@@ -39,19 +46,22 @@ export function useTourDayAssignment({ canAssign, onAssignToDay }: TourDayAssign
[assignments]
);
const isPending = useCallback((placeId: number, dayId: number) => pending.has(`${placeId}:${dayId}`), [pending]);
+ // The stages of a multi-day tour can go from a day that holds the tour: they take its place there.
const isAvailable = useCallback(
- (placeId: number, dayId: number) => canAssign && !isOnDay(placeId, dayId) && !isPending(placeId, dayId),
+ (placeId: number, dayId: number, how: TourDayHow = 'whole') =>
+ canAssign && (how === 'stages' || !isOnDay(placeId, dayId)) && !isPending(placeId, dayId),
[canAssign, isOnDay, isPending]
);
const assign = useCallback(
- async (placeId: number, dayId: number): Promise<boolean> => {
+ async (placeId: number, dayId: number, how?: TourDayHow): Promise<boolean> => {
const key = `${placeId}:${dayId}`;
- if (!isAvailable(placeId, dayId) || inFlight.current.has(key)) return false;
+ if (!isAvailable(placeId, dayId, how) || inFlight.current.has(key)) return false;
inFlight.current.add(key);
setPending((current) => new Set(current).add(key));
try {
- return (await onAssignToDay(placeId, dayId)) !== false;
+ const done = how ? await onAssignToDay(placeId, dayId, undefined, how) : await onAssignToDay(placeId, dayId);
+ return done !== false;
} finally {
inFlight.current.delete(key);
setPending((current) => {
diff --git a/client/src/components/shared/ContextMenu.tsx b/client/src/components/shared/ContextMenu.tsx
index 4a48595c8..953e3a587 100644
--- a/client/src/components/shared/ContextMenu.tsx
+++ b/client/src/components/shared/ContextMenu.tsx
@@ -29,9 +29,15 @@ export function useContextMenu() {
setMenu({ x: alignEnd ? anchor.right : e.clientX, y: alignEnd ? anchor.bottom + 6 : e.clientY, items, alignEnd })
}
+ /** Opens the menu under an element, its end on the element's end: the next step of a menu opened there. */
+ const openAt = (anchor: Element, items: MenuItem[]) => {
+ const rect = anchor.getBoundingClientRect()
+ setMenu({ x: rect.right, y: rect.bottom + 6, items, alignEnd: true })
+ }
+
const close = () => setMenu(null)
- return { menu, open, close }
+ return { menu, open, openAt, close }
}
interface ContextMenuProps {
diff --git a/client/src/mobile/screens/trip/sheets/MTourDayChoiceSheet.tsx b/client/src/mobile/screens/trip/sheets/MTourDayChoiceSheet.tsx
new file mode 100644
index 000000000..0357ea92f
--- /dev/null
+++ b/client/src/mobile/screens/trip/sheets/MTourDayChoiceSheet.tsx
@@ -0,0 +1,53 @@
+import { CalendarDays, CalendarRange } from 'lucide-react';
+import { tourDayChoices, type TourDayHow, type TourDayQuestion } from '../../../../components/Tours/stages/stageSpread';
+import { useTranslation } from '../../../../i18n';
+import MConfirmSheet from '../../settings/MConfirmSheet';
+
+interface MTourDayChoiceSheetProps {
+ question: TourDayQuestion | null;
+ onAnswer: (how: TourDayHow | null) => void;
+}
+
+/**
+ * MDT-02 on the phone: how a multi-day tour goes on the day it was added to,
+ * whole or a stage a day from it on, the same two ways the desktop offers.
+ */
+export default function MTourDayChoiceSheet({ question, onAnswer }: MTourDayChoiceSheetProps) {
+ const { t } = useTranslation();
+ const close = () => onAnswer(null);
+ return (
+ <MConfirmSheet
+ open={question != null}
+ onClose={close}
+ title={question ? `${t('dayplan.dayN', { n: question.day })}: ${question.name}` : ''}
+ message={question ? t('tours.stages.count', { count: question.count }) : ''}
+ cancelLabel={t('common.cancel')}
+ >
+ <div className="mt-3 flex flex-col gap-2">
+ {question &&
+ tourDayChoices(question, t).map((choice) => (
+ <button
+ key={choice.how}
+ type="button"
+ disabled={choice.disabled}
+ onClick={() => onAnswer(choice.how)}
+ data-testid={`m-tour-day-choice-${choice.how}`}
+ className="flex w-full items-center gap-3 rounded-[14px] border border-m-rowbr bg-m-ic px-3 py-[10px] text-start disabled:opacity-40"
+ >
+ <span className="grid h-8 w-8 flex-none place-items-center rounded-full bg-m-card text-m-muted">
+ {choice.how === 'whole' ? (
+ <CalendarDays size={15} strokeWidth={2} aria-hidden="true" />
+ ) : (
+ <CalendarRange size={15} strokeWidth={2} aria-hidden="true" />
+ )}
+ </span>
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <span className="text-body font-semibold text-m-ink">{choice.title}</span>
+ <span className="text-caption text-m-muted">{choice.hint}</span>
+ </span>
+ </button>
+ ))}
+ </div>
+ </MConfirmSheet>
+ );
+}
diff --git a/client/src/mobile/screens/trip/sheets/MTripSheets.tsx b/client/src/mobile/screens/trip/sheets/MTripSheets.tsx
index 9ad403b29..425b139cc 100644
--- a/client/src/mobile/screens/trip/sheets/MTripSheets.tsx
+++ b/client/src/mobile/screens/trip/sheets/MTripSheets.tsx
@@ -21,6 +21,7 @@ import MTransportFormSheet from './MTransportFormSheet'
import MCostSheet from './MCostSheet'
import MTransportSheet from './MTransportSheet'
import MBrowseActionsSheet from './MBrowseActionsSheet'
+import MTourDayChoiceSheet from './MTourDayChoiceSheet'
import MNoteSheet, { type MNoteSheetPayload } from './MNoteSheet'
import MImportSheet from './MImportSheet'
import MExportSheet from './MExportSheet'
@@ -271,6 +272,9 @@ export default function MTripSheets({ planner, shell }: MTripSheetsProps) {
>
<MDayImpactList lines={planner.deleteDayLines} label={planner.deleteDayTitle} />
</MConfirmSheet>
+
+ {/* A multi-day tour put on a day: whole, or a stage a day from it on (MDT-02). Over the sheet it came from. */}
+ <MTourDayChoiceSheet question={planner.tourDayQuestion} onAnswer={planner.answerTourDay} />
</>
)
}
diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsx
index 824cda6b6..225d6d7ce 100644
--- a/client/src/pages/TripPlannerPage.tsx
+++ b/client/src/pages/TripPlannerPage.tsx
@@ -7,6 +7,7 @@ import RoadtripModeSwitch from '../components/Roadtrip/RoadtripModeSwitch'
import PlacesToursModeSwitch from '../components/Tours/PlacesToursModeSwitch'
import ToursSidebar from '../components/Tours/ToursSidebar'
import TourDetailDialog from '../components/Tours/TourDetailDialog'
+import { TourDayChoiceDialog } from '../components/Tours/stages/TourDayChoiceDialog'
import TripLoadingSplash from '../components/shared/TripLoadingSplash'
import PlacesSidebar from '../components/Planner/PlacesSidebar'
import PlaceInspector from '../components/Planner/PlaceInspector'
@@ -120,10 +121,9 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
route, routeWalking, routeSegments, routeInfo, setRoute, setRouteInfo, updateRouteForDay,
handleSelectDay, handlePlaceClick, handleMarkerClick, handleMapClick, handleMapContextMenu, handlePoiClick,
handleSavePlace, openPlaceEditor, handleDeletePlace, confirmDeletePlace, confirmDeletePlaces, confirmChangeCategory,
- handleDeleteTour,
- handleAssignToDay, handleMoveToDay, handleRemoveAssignment, handleReorder, handleReorderDays, handleAddDay, dayAdd, handleUpdateDayTitle,
- deleteDayQuestion, handleDeleteDay,
- clearDayId, clearDayTitle, handleClearDay, cancelClearDay, confirmClearDay,
+ handleAssignToDay, handleMoveToDay, handleRemoveAssignment, handleReorder, handleReorderDays, handleAddDay, dayAdd,
+ handleDeleteTour, handleUpdateDayTitle, deleteDayQuestion, handleDeleteDay,
+ clearDayId, clearDayTitle, handleClearDay, cancelClearDay, confirmClearDay, tourDayQuestion, answerTourDay,
handleSaveReservation, handleSaveTransport, handleDeleteReservation,
selectedPlace, dayOrderMap, dayPlaces,
toursEnabled, toursMode, setToursMode, tours, toursLoading, tourDataReady, tourPlaceIds,
@@ -682,7 +682,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
canAssign={canDayEdit}
tours={tours}
days={days} loading={toursLoading}
- onAssignToDay={(placeId, dayId) => handleAssignToDay(placeId, dayId)}
+ onAssignToDay={handleAssignToDay}
onDeleteTour={handleDeleteTour}
gpxImport={tourGpxImport}
onViewGpxTour={viewImportedTour}
@@ -934,6 +934,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
confirmLabel={t('dayplan.clearDay')}
danger
/>
+ <TourDayChoiceDialog question={tourDayQuestion} onAnswer={answerTourDay} />
<ConfirmDialog
isOpen={!!stayRelease}
onClose={() => setStayRelease(null)}
diff --git a/client/src/pages/TripPlannerPage.wiring.fixture.ts b/client/src/pages/TripPlannerPage.wiring.fixture.ts
index 3389c4d7c..ca43e059b 100644
--- a/client/src/pages/TripPlannerPage.wiring.fixture.ts
+++ b/client/src/pages/TripPlannerPage.wiring.fixture.ts
@@ -302,6 +302,8 @@ function mapState(): HookState {
confirmDeletePlaces: vi.fn(async () => undefined),
confirmChangeCategory: vi.fn(async () => undefined),
handleAssignToDay: vi.fn(async () => undefined),
+ tourDayQuestion: null,
+ answerTourDay: vi.fn(),
handleRemoveAssignment: vi.fn(async () => undefined),
handleReorder: vi.fn(),
handleReorderDays: vi.fn(),
diff --git a/client/src/pages/tripPlanner/useTourDayChoice.test.ts b/client/src/pages/tripPlanner/useTourDayChoice.test.ts
new file mode 100644
index 000000000..1e8451b2e
--- /dev/null
+++ b/client/src/pages/tripPlanner/useTourDayChoice.test.ts
@@ -0,0 +1,200 @@
+// FE-TOUR-STAGE-SPREAD-010 to FE-TOUR-STAGE-SPREAD-016: putting a multi-day tour on a day through
+// the plan's one path, whole or a stage a day from it on, asked first where no menu asked (MDT-02).
+import { act, renderHook } from '@testing-library/react';
+import type { TourListItem } from '@trek/shared';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { buildAssignment, buildDay, buildPlace } from '../../../tests/helpers/factories';
+import { resetAllStores, seedStore } from '../../../tests/helpers/store';
+import { useTripStore } from '../../store/tripStore';
+import type { AssignmentsMap } from '../../types';
+import { useTourDayChoice } from './useTourDayChoice';
+
+type Options = Parameters<typeof useTourDayChoice>[0];
+type Undo = () => Promise<void>;
+
+const DAYS = [buildDay({ id: 1 }), buildDay({ id: 2 }), buildDay({ id: 3 })];
+const stops = ['stop-a', 'stop-b', 'stop-c', 'stop-end'].map((key) => ({ key, lat: 47, lng: 11 }));
+const TOURS = [
+ { place_id: 9, name: 'Hut to hut', stage_stops: stops },
+ { place_id: 5, name: 'Lake loop', stage_stops: null },
+] as unknown as TourListItem[];
+const t = (key: string, params?: Record<string, unknown>) => (params ? `${key} ${JSON.stringify(params)}` : key);
+
+let writes: Record<string, ReturnType<typeof vi.fn>>;
+let options: Options;
+
+function seed(assignments: AssignmentsMap) {
+ seedStore(useTripStore, { ...writes, days: DAYS, assignments, selectedDayId: 1 } as never);
+}
+
+beforeEach(() => {
+ resetAllStores();
+ vi.clearAllMocks();
+ writes = {
+ assignPlaceToDay: vi.fn(async (_trip: number, dayId: number, placeId: number) => ({ id: 900 + dayId, placeId })),
+ moveAssignment: vi.fn(async () => undefined),
+ removeAssignment: vi.fn(async () => undefined),
+ setAssignmentTimes: vi.fn(async () => undefined),
+ setAssignmentNotes: vi.fn(async () => undefined),
+ setAssignmentEndDay: vi.fn(async () => undefined),
+ setAssignmentRouteExcluded: vi.fn(async () => undefined),
+ setAssignmentParticipants: vi.fn(async () => undefined),
+ setAssignmentLegMode: vi.fn(async () => undefined),
+ };
+ seed({ '1': [], '2': [], '3': [] });
+ options = {
+ tripId: 42,
+ days: DAYS,
+ tours: TOURS,
+ selectedDayId: 1,
+ t,
+ toast: { success: vi.fn(), warning: vi.fn(), error: vi.fn() },
+ pushUndo: vi.fn(),
+ assignWhole: vi.fn(async () => true),
+ updateRouteForDay: vi.fn(),
+ onToursChanged: vi.fn(async () => undefined),
+ };
+});
+
+const render = () => renderHook(() => useTourDayChoice(options));
+const lastUndo = () => vi.mocked(options.pushUndo).mock.calls.at(-1)?.[1] as Undo;
+
+describe('useTourDayChoice', () => {
+ it('FE-TOUR-STAGE-SPREAD-010: a place, a day tour and a tour put whole on purpose go on at once', async () => {
+ const { result } = render();
+ await act(async () => {
+ expect(await result.current.handleAssignToDay(77, 1, 3)).toBe(true);
+ await result.current.handleAssignToDay(5, 2);
+ await result.current.handleAssignToDay(9, 2, undefined, 'whole');
+ });
+ expect(options.assignWhole).toHaveBeenNthCalledWith(1, 77, 1, 3);
+ expect(options.assignWhole).toHaveBeenNthCalledWith(2, 5, 2, undefined);
+ expect(options.assignWhole).toHaveBeenNthCalledWith(3, 9, 2, undefined);
+ expect(result.current.tourDayQuestion).toBeNull();
+ expect(writes.assignPlaceToDay).not.toHaveBeenCalled();
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-011: a multi-day tour asks first; whole goes the plan way, closing does nothing', async () => {
+ const { result } = render();
+ let pending: Promise<boolean> = Promise.resolve(false);
+ act(() => {
+ pending = result.current.handleAssignToDay(9, 2, 4);
+ });
+ expect(result.current.tourDayQuestion).toEqual({
+ placeId: 9,
+ dayId: 2,
+ day: 2,
+ name: 'Hut to hut',
+ count: 3,
+ fit: 2,
+ wholeFree: true,
+ });
+ act(() => result.current.answerTourDay('whole'));
+ expect(await pending).toBe(true);
+ expect(options.assignWhole).toHaveBeenCalledWith(9, 2, 4);
+
+ act(() => {
+ pending = result.current.handleAssignToDay(9);
+ });
+ expect(result.current.tourDayQuestion?.dayId).toBe(1);
+ act(() => result.current.answerTourDay(null));
+ expect(await pending).toBe(false);
+ expect(result.current.tourDayQuestion).toBeNull();
+ expect(options.assignWhole).toHaveBeenCalledTimes(1);
+ expect(writes.assignPlaceToDay).not.toHaveBeenCalled();
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-012: stages go on day after day in order, the whole tour gives way, and it says so', async () => {
+ const whole = buildAssignment({ id: 22, day_id: 2, place: buildPlace({ id: 9 }), tour_stage_key: null });
+ seed({ '1': [], '2': [whole], '3': [] });
+ const { result } = render();
+ let pending: Promise<boolean> = Promise.resolve(false);
+ act(() => {
+ pending = result.current.handleAssignToDay(9, 1);
+ });
+ expect(result.current.tourDayQuestion?.wholeFree).toBe(true);
+ act(() => result.current.answerTourDay('stages'));
+ expect(await pending).toBe(true);
+
+ expect(writes.removeAssignment).toHaveBeenCalledWith(42, 2, 22);
+ expect(writes.assignPlaceToDay.mock.calls).toEqual([
+ [42, 1, 9, null, 'stop-a'],
+ [42, 2, 9, null, 'stop-b'],
+ [42, 3, 9, null, 'stop-c'],
+ ]);
+ expect(options.assignWhole).not.toHaveBeenCalled();
+ expect(options.onToursChanged).toHaveBeenCalled();
+ expect(options.updateRouteForDay).toHaveBeenCalledWith(1);
+ expect(options.toast.success).toHaveBeenCalledWith(
+ 'tours.stages.placed {"from":1} tours.stages.placedReplaced {"list":"2"}'
+ );
+ expect(options.pushUndo).toHaveBeenCalledWith('tours.stages.placeUndo', expect.any(Function), [2, 1, 3], [9]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-013: one undo takes the whole spread back, the whole tour onto its day again', async () => {
+ const whole = buildAssignment({ id: 22, day_id: 2, place: buildPlace({ id: 9 }), tour_stage_key: null });
+ seed({ '1': [], '2': [whole], '3': [] });
+ const { result } = render();
+ await act(async () => {
+ await result.current.handleAssignToDay(9, 1, undefined, 'stages');
+ });
+ expect(result.current.tourDayQuestion).toBeNull();
+ writes.removeAssignment.mockClear();
+ writes.assignPlaceToDay.mockClear();
+ await act(async () => {
+ await lastUndo()();
+ });
+ expect(writes.removeAssignment.mock.calls).toEqual([
+ [42, 3, 903],
+ [42, 2, 902],
+ [42, 1, 901],
+ ]);
+ expect(writes.assignPlaceToDay).toHaveBeenCalledWith(42, 2, 9, 0, undefined);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-014: fewer days left than stages: the rest stay on no day, and the toast says so', async () => {
+ const { result } = render();
+ await act(async () => {
+ expect(await result.current.handleAssignToDay(9, 2, undefined, 'stages')).toBe(true);
+ });
+ expect(writes.assignPlaceToDay.mock.calls).toEqual([
+ [42, 2, 9, null, 'stop-a'],
+ [42, 3, 9, null, 'stop-b'],
+ ]);
+ expect(options.toast.warning).toHaveBeenCalledWith(
+ 'tours.stages.placed {"from":2} tours.stages.placeStagesShort {"last":2}'
+ );
+ expect(options.toast.success).not.toHaveBeenCalled();
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-015: a stage already on a day moves, and a move is undone by moving it back', async () => {
+ const held = buildAssignment({ id: 31, day_id: 3, place: buildPlace({ id: 9 }), tour_stage_key: 'stop-a' });
+ seed({ '1': [], '2': [], '3': [held] });
+ const { result } = render();
+ await act(async () => {
+ await result.current.handleAssignToDay(9, 1, undefined, 'stages');
+ });
+ expect(writes.moveAssignment).toHaveBeenCalledWith(42, 31, 3, 1);
+ expect(writes.assignPlaceToDay.mock.calls.map((call) => call[4])).toEqual(['stop-b', 'stop-c']);
+ writes.moveAssignment.mockClear();
+ await act(async () => {
+ await lastUndo()();
+ });
+ expect(writes.moveAssignment).toHaveBeenCalledWith(42, 31, 1, 3);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-016: a refused write stops the spread, says so, and the undo has what went before', async () => {
+ writes.assignPlaceToDay.mockResolvedValueOnce({ id: 901 }).mockRejectedValueOnce(new Error('offline'));
+ const { result } = render();
+ await act(async () => {
+ expect(await result.current.handleAssignToDay(9, 1, undefined, 'stages')).toBe(false);
+ });
+ expect(writes.assignPlaceToDay).toHaveBeenCalledTimes(2);
+ expect(options.toast.error).toHaveBeenCalledWith('tours.stages.placeFailed');
+ expect(options.toast.success).not.toHaveBeenCalled();
+ await act(async () => {
+ await lastUndo()();
+ });
+ expect(writes.removeAssignment).toHaveBeenCalledWith(42, 1, 901);
+ });
+});
diff --git a/client/src/pages/tripPlanner/useTourDayChoice.ts b/client/src/pages/tripPlanner/useTourDayChoice.ts
new file mode 100644
index 000000000..8b60f21d2
--- /dev/null
+++ b/client/src/pages/tripPlanner/useTourDayChoice.ts
@@ -0,0 +1,184 @@
+import type { TourListItem } from '@trek/shared';
+import { useCallback, useRef, useState } from 'react';
+import {
+ planStageSpread,
+ stageKeysOfTour,
+ stagesThatFit,
+ type SpreadStep,
+ type StageSpread,
+ type TourDayHow,
+ type TourDayQuestion,
+} from '../../components/Tours/stages/stageSpread';
+import { isTourOnDay } from '../../components/Tours/useTourDayAssignment';
+import { useTripStore } from '../../store/tripStore';
+import type { Day } from '../../types';
+import { restoreVisit, visitOf } from './placeUndo';
+
+type Translate = (key: string, params?: Record<string, string | number>) => string;
+type Undo = () => Promise<void>;
+
+interface TourDayChoiceOptions {
+ tripId: number;
+ days: Day[];
+ tours: readonly TourListItem[];
+ selectedDayId: number | null;
+ t: Translate;
+ toast: {
+ success: (message: string) => unknown;
+ warning: (message: string) => unknown;
+ error: (message: string) => unknown;
+ };
+ pushUndo: (label: string, undoFn: () => Promise<void> | void, dayIds?: number[], placeIds?: number[]) => void;
+ /** The plan's one way of putting a place on a day, which puts a tour there whole. */
+ assignWhole: (placeId: number, dayId?: number, position?: number) => Promise<boolean>;
+ updateRouteForDay: (dayId: number) => void;
+ onToursChanged: () => Promise<unknown> | void;
+}
+
+/** Sends one write of a spread through the store, the plan's offline way, and returns what takes it back. */
+async function runStep(tripId: number, placeId: number, step: SpreadStep): Promise<Undo> {
+ const store = useTripStore.getState();
+ if (step.kind === 'move') {
+ await store.moveAssignment(tripId, step.assignmentId, step.fromDayId, step.toDayId);
+ return () => useTripStore.getState().moveAssignment(tripId, step.assignmentId, step.toDayId, step.fromDayId);
+ }
+ if (step.kind === 'create') {
+ const created = await store.assignPlaceToDay(tripId, step.dayId, placeId, null, step.key);
+ return async () => {
+ if (created?.id) await useTripStore.getState().removeAssignment(tripId, step.dayId, created.id);
+ };
+ }
+ const item = (store.assignments[String(step.dayId)] ?? []).find((entry) => entry.id === step.assignmentId);
+ await store.removeAssignment(tripId, step.dayId, step.assignmentId);
+ return async () => {
+ if (!item?.place) return;
+ // Back where it was, whole or as its stage, with the times, note and travellers it had.
+ const visit = visitOf(step.dayId, item);
+ const actions = useTripStore.getState();
+ const key = item.tour_stage_key ?? undefined;
+ const restored = await actions.assignPlaceToDay(tripId, step.dayId, placeId, visit.orderIndex, key);
+ if (restored?.id) await restoreVisit(tripId, actions, visit, restored.id);
+ };
+}
+
+/** The days a write acts on. */
+const daysOf = (step: SpreadStep): number[] => (step.kind === 'move' ? [step.fromDayId, step.toDayId] : [step.dayId]);
+
+/** What a spread did, in a sentence or three: from which day, what found no day, what the stages replaced. */
+function spreadMessage(plan: StageSpread, days: readonly Day[], t: Translate): string {
+ const numberOf = (dayId: number) => days.findIndex((day) => day.id === dayId) + 1;
+ const parts = [t('tours.stages.placed', { from: numberOf(plan.placed[0].dayId) })];
+ if (plan.unplaced > 0) parts.push(t('tours.stages.placeStagesShort', { last: plan.placed.length }));
+ if (plan.wholeOff.length > 0) {
+ const off = plan.wholeOff.map(numberOf).sort((a, b) => a - b);
+ parts.push(t('tours.stages.placedReplaced', { list: off.join(', ') }));
+ }
+ return parts.join(' ');
+}
+
+/**
+ * MDT-02: putting a multi-day tour on a day, for the desktop and the phone
+ * alike. Every way the plan puts a place on a day ends here; a tour with
+ * stages asks first whether it goes on the day whole or a stage a day from
+ * there on, unless the menu it came from has asked already (`how`). Put on
+ * a day each, the stages go through the plan's one write path in order
+ * (store, repo, mutation queue), so they work offline and show at once, and
+ * one undo takes them all back. With fewer days left in the trip than stages
+ * it says so and leaves the rest on no day.
+ */
+export function useTourDayChoice(options: TourDayChoiceOptions) {
+ const { tripId, days, tours, selectedDayId, t, toast } = options;
+ const { pushUndo, assignWhole, updateRouteForDay, onToursChanged } = options;
+ const [tourDayQuestion, setTourDayQuestion] = useState<TourDayQuestion | null>(null);
+ const answer = useRef<((how: TourDayHow | null) => void) | null>(null);
+
+ const answerTourDay = useCallback((how: TourDayHow | null) => {
+ const resolve = answer.current;
+ answer.current = null;
+ setTourDayQuestion(null);
+ resolve?.(how);
+ }, []);
+
+ const ask = useCallback(
+ (question: TourDayQuestion) =>
+ new Promise<TourDayHow | null>((resolve) => {
+ // A question still open is dropped, as if it had been closed.
+ answer.current?.(null);
+ answer.current = resolve;
+ setTourDayQuestion(question);
+ }),
+ []
+ );
+
+ const spreadTourStages = useCallback(
+ async (placeId: number, dayId: number): Promise<boolean> => {
+ const keys = stageKeysOfTour(tours.find((tour) => tour.place_id === placeId));
+ const plan = planStageSpread({ placeId, keys, days, assignments: useTripStore.getState().assignments, dayId });
+ if (plan.placed.length === 0) return false;
+ const undos: Undo[] = [];
+ let failed = false;
+ for (const step of plan.steps) {
+ try {
+ undos.unshift(await runStep(tripId, placeId, step));
+ } catch {
+ // The store has put back the write that failed; what went before stays, and the undo takes it back.
+ failed = true;
+ break;
+ }
+ }
+ const touched = [...new Set(plan.steps.flatMap(daysOf))];
+ const redraw = () => {
+ const selected = useTripStore.getState().selectedDayId;
+ if (selected != null && touched.includes(selected)) updateRouteForDay(selected);
+ };
+ redraw();
+ await onToursChanged();
+ if (undos.length > 0) {
+ pushUndo(
+ t('tours.stages.placeUndo'),
+ async () => {
+ for (const undo of undos) await undo();
+ await onToursChanged();
+ redraw();
+ },
+ touched,
+ [placeId]
+ );
+ }
+ if (failed) {
+ toast.error(t('tours.stages.placeFailed'));
+ return false;
+ }
+ const message = spreadMessage(plan, days, t);
+ if (plan.unplaced > 0) toast.warning(message);
+ else toast.success(message);
+ return true;
+ },
+ [days, onToursChanged, pushUndo, t, toast, tours, tripId, updateRouteForDay]
+ );
+
+ const handleAssignToDay = useCallback(
+ async (placeId: number, dayId?: number, position?: number, how?: TourDayHow): Promise<boolean> => {
+ const target = dayId || selectedDayId;
+ const tour = tours.find((item) => item.place_id === placeId);
+ const count = stageKeysOfTour(tour).length;
+ const index = target ? days.findIndex((day) => day.id === target) : -1;
+ if (!tour || !target || count < 2 || index < 0 || how === 'whole') return assignWhole(placeId, dayId, position);
+ const question: TourDayQuestion = {
+ placeId,
+ dayId: target,
+ day: index + 1,
+ name: tour.name,
+ count,
+ fit: stagesThatFit(days, target, count),
+ wholeFree: !isTourOnDay(useTripStore.getState().assignments, placeId, target),
+ };
+ const choice = how ?? (await ask(question));
+ if (choice === 'stages') return spreadTourStages(placeId, target);
+ return choice === 'whole' ? assignWhole(placeId, target, position) : false;
+ },
+ [ask, assignWhole, days, selectedDayId, spreadTourStages, tours]
+ );
+
+ return { tourDayQuestion, answerTourDay, handleAssignToDay };
+}
diff --git a/client/src/pages/tripPlanner/useTripPlanner.ts b/client/src/pages/tripPlanner/useTripPlanner.ts
index dfd997452..6c12dfee4 100644
--- a/client/src/pages/tripPlanner/useTripPlanner.ts
+++ b/client/src/pages/tripPlanner/useTripPlanner.ts
@@ -58,6 +58,7 @@ import { useRoadtripDriveShaping } from './useRoadtripDriveShaping'
import { usePlaceEdits } from './usePlaceEdits'
import { usePlaceFormOpeners } from './usePlaceFormOpeners'
import { useDayPlanEdits } from './useDayPlanEdits'
+import { useTourDayChoice } from './useTourDayChoice'
import { useBookingEdits } from './useBookingEdits'
import { usePlannerTripView } from './usePlannerTripView'
import { useIsPhone } from '../../mobile/useIsPhone'
@@ -569,12 +570,19 @@ export function useTripPlanner() {
})
const {
- handleReorder, handleReorderDays, handleUpdateDayTitle, handleAssignToDay, handleMoveToDay, handleRemoveAssignment,
+ handleReorder, handleReorderDays, handleUpdateDayTitle, handleMoveToDay, handleRemoveAssignment,
+ handleAssignToDay: assignWholeToDay,
} = useDayPlanEdits({
tripId, tripActions, toast, t, places, storedAssignments, tripAccommodations, selectedDayId,
pushUndo, reloadTourPlaceIds, updateRouteForDay, isTourPlace, roadtripVias, viasAfterInsert, roadtripStopsOf,
})
+ // MDT-02: every way onto a day passes here; a multi-day tour asks whole or a stage a day first.
+ const { tourDayQuestion, answerTourDay, handleAssignToDay } = useTourDayChoice({
+ tripId, days, tours, selectedDayId, t, toast, pushUndo, assignWhole: assignWholeToDay, updateRouteForDay,
+ onToursChanged: reloadTourPlaceIds,
+ })
+
const { handleAddDay, dayAdd } = useDayAdd({
tripId, trip, days, canEditDays: can('day_edit', trip), t, locale, toast,
})
@@ -735,6 +743,7 @@ export function useTripPlanner() {
handleSavePlace, openPlaceEditor, handleDeletePlace, confirmDeletePlace, confirmDeletePlaces, confirmChangeCategory,
handleDeleteTour,
handleAssignToDay, handleMoveToDay, handleRemoveAssignment, handleReorder, handleReorderDays, handleAddDay, dayAdd, handleUpdateDayTitle,
+ tourDayQuestion, answerTourDay,
...dayDelete,
...dayClear,
handleSaveReservation, handleSaveTransport, handleDeleteReservation,
diff --git a/client/tests/helpers/mobileTrip.ts b/client/tests/helpers/mobileTrip.ts
index a16d4e82b..c19b91686 100644
--- a/client/tests/helpers/mobileTrip.ts
+++ b/client/tests/helpers/mobileTrip.ts
@@ -294,6 +294,8 @@ export function buildPlanner(overrides: Partial<TripPlanner> = {}): TripPlanner
confirmDeletePlaces: vi.fn(),
confirmChangeCategory: vi.fn(),
handleAssignToDay: vi.fn(),
+ tourDayQuestion: null,
+ answerTourDay: vi.fn(),
handleRemoveAssignment: vi.fn(),
handleReorder: vi.fn(),
handleReorderDays: vi.fn(),
diff --git a/client/tests/unit/mobile/trip/MTourDayChoiceSheet.test.tsx b/client/tests/unit/mobile/trip/MTourDayChoiceSheet.test.tsx
new file mode 100644
index 000000000..83fc1050c
--- /dev/null
+++ b/client/tests/unit/mobile/trip/MTourDayChoiceSheet.test.tsx
@@ -0,0 +1,39 @@
+// FE-TOUR-STAGE-SPREAD-022 to FE-TOUR-STAGE-SPREAD-023: on the phone, a multi-day tour put on a day
+// asks the same two ways as the desktop, whole or a stage a day from it on (MDT-02).
+import { fireEvent } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+import type { TourDayQuestion } from '../../../../src/components/Tours/stages/stageSpread';
+import MTourDayChoiceSheet from '../../../../src/mobile/screens/trip/sheets/MTourDayChoiceSheet';
+import { render, screen } from '../../../helpers/render';
+
+const question: TourDayQuestion = {
+ placeId: 81,
+ dayId: 4,
+ day: 2,
+ name: 'Hut to hut',
+ count: 3,
+ fit: 3,
+ wholeFree: true,
+};
+
+describe('MTourDayChoiceSheet', () => {
+ it('FE-TOUR-STAGE-SPREAD-022: names the day and the tour, and answers with the way chosen', () => {
+ const onAnswer = vi.fn();
+ render(<MTourDayChoiceSheet question={question} onAnswer={onAnswer} />);
+ expect(screen.getByText('Day 2: Hut to hut')).toBeInTheDocument();
+ expect(screen.getByText('3 stages')).toBeInTheDocument();
+ expect(screen.getByText('Stage 1 on this day, each next stage on the day after.')).toBeInTheDocument();
+ fireEvent.click(screen.getByTestId('m-tour-day-choice-whole'));
+ expect(onAnswer).toHaveBeenLastCalledWith('whole');
+ fireEvent.click(screen.getByTestId('m-tour-day-choice-stages'));
+ expect(onAnswer).toHaveBeenLastCalledWith('stages');
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+ expect(onAnswer).toHaveBeenLastCalledWith(null);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-023: a day that holds the tour offers only the stages', () => {
+ render(<MTourDayChoiceSheet question={{ ...question, wholeFree: false }} onAnswer={vi.fn()} />);
+ expect(screen.getByTestId('m-tour-day-choice-whole')).toBeDisabled();
+ expect(screen.getByTestId('m-tour-day-choice-stages')).toBeEnabled();
+ });
+});
diff --git a/shared/src/i18n/ar/tours.ts b/shared/src/i18n/ar/tours.ts
index 739a1d9f3..12924376b 100644
--- a/shared/src/i18n/ar/tours.ts
+++ b/shared/src/i18n/ar/tours.ts
@@ -1441,6 +1441,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'الجولة كاملة',
'tours.stages.totalPartial': 'معروف لـ {known} من {of} مراحل',
'tours.stages.openInPlanner': 'فتح هذه المرحلة في المخطط',
+ 'tours.stages.placeWhole': 'الجولة كاملة في هذا اليوم',
+ 'tours.stages.placeWholeHint': 'المسار كله في هذا اليوم وحده.',
+ 'tours.stages.placeWholeTaken': 'هذا اليوم فيه الجولة بالفعل.',
+ 'tours.stages.placeStages': 'المراحل بدءًا من هذا اليوم',
+ 'tours.stages.placeStagesFit': 'المراحل بدءًا من هذا اليوم، حتى المرحلة {last}',
+ 'tours.stages.placeStagesHint': 'المرحلة 1 في هذا اليوم، وكل مرحلة تالية في اليوم الذي يليه.',
+ 'tours.stages.placeStagesShort': 'تنتهي الرحلة بعد المرحلة {last}. تبقى المراحل التالية بلا يوم.',
+ 'tours.stages.placed': 'المراحل بدءًا من اليوم {from}.',
+ 'tours.stages.placedReplaced': 'لم تعد الجولة كاملة في اليوم {list}.',
+ 'tours.stages.placeFailed': 'تعذّر وضع كل مرحلة في يومها. التراجع يعيد ما تم بالفعل.',
+ 'tours.stages.placeUndo': 'توزيع المراحل على الأيام',
'tours.estimate.label': 'الوقت المقدَّر',
'tours.estimate.short': 'تقديري',
'tours.estimate.unknown': 'غير معروف',
diff --git a/shared/src/i18n/az/tours.ts b/shared/src/i18n/az/tours.ts
index 88f892531..d44d924ab 100644
--- a/shared/src/i18n/az/tours.ts
+++ b/shared/src/i18n/az/tours.ts
@@ -1383,6 +1383,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Bütün tur',
'tours.stages.totalPartial': '{of} mərhələdən {known} üçün məlumdur',
'tours.stages.openInPlanner': 'Bu mərhələni planlayıcıda aç',
+ 'tours.stages.placeWhole': 'Bütün tur bu gündə',
+ 'tours.stages.placeWholeHint': 'Bütün marşrut bu bir gündə.',
+ 'tours.stages.placeWholeTaken': 'Bu gündə tur artıq var.',
+ 'tours.stages.placeStages': 'Bu gündən etibarən mərhələlər',
+ 'tours.stages.placeStagesFit': 'Bu gündən etibarən mərhələlər, {last}-ci mərhələyə qədər',
+ 'tours.stages.placeStagesHint': '1-ci mərhələ bu gündə, hər növbəti mərhələ ertəsi gündə.',
+ 'tours.stages.placeStagesShort': 'Səfər {last}-ci mərhələdən sonra bitir. Sonrakı mərhələlər günsüz qalır.',
+ 'tours.stages.placed': 'Mərhələlər {from}-ci gündən etibarən.',
+ 'tours.stages.placedReplaced': 'Bütün tur artıq {list}-ci gündə deyil.',
+ 'tours.stages.placeFailed': 'Hər mərhələni öz gününə qoymaq alınmadı. Geri al edilənləri geri qaytarır.',
+ 'tours.stages.placeUndo': 'Mərhələlər günlərə bölündü',
'tours.estimate.label': 'Təxmini vaxt',
'tours.estimate.short': 'Təxmini',
'tours.estimate.unknown': 'Naməlum',
diff --git a/shared/src/i18n/br/tours.ts b/shared/src/i18n/br/tours.ts
index f29bd35f9..befad2018 100644
--- a/shared/src/i18n/br/tours.ts
+++ b/shared/src/i18n/br/tours.ts
@@ -1397,6 +1397,18 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Roteiro completo',
'tours.stages.totalPartial': 'conhecido para {known} de {of} etapas',
'tours.stages.openInPlanner': 'Abrir esta etapa no planejador',
+ 'tours.stages.placeWhole': 'Roteiro completo neste dia',
+ 'tours.stages.placeWholeHint': 'O percurso inteiro neste único dia.',
+ 'tours.stages.placeWholeTaken': 'Este dia já tem o roteiro.',
+ 'tours.stages.placeStages': 'Etapas a partir deste dia',
+ 'tours.stages.placeStagesFit': 'Etapas a partir deste dia, até a etapa {last}',
+ 'tours.stages.placeStagesHint': 'Etapa 1 neste dia, cada etapa seguinte no dia depois.',
+ 'tours.stages.placeStagesShort': 'A viagem termina após a etapa {last}. As etapas seguintes ficam sem dia.',
+ 'tours.stages.placed': 'Etapas a partir do dia {from}.',
+ 'tours.stages.placedReplaced': 'O roteiro completo não está mais no dia {list}.',
+ 'tours.stages.placeFailed':
+ 'Nem todas as etapas puderam ser colocadas no seu dia. Desfazer reverte o que já foi feito.',
+ 'tours.stages.placeUndo': 'Etapas distribuídas pelos dias',
'tours.estimate.label': 'Tempo estimado',
'tours.estimate.short': 'Estimado',
'tours.estimate.unknown': 'Desconhecido',
diff --git a/shared/src/i18n/ca/tours.ts b/shared/src/i18n/ca/tours.ts
index 837142697..4340140cd 100644
--- a/shared/src/i18n/ca/tours.ts
+++ b/shared/src/i18n/ca/tours.ts
@@ -1404,6 +1404,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Ruta sencera',
'tours.stages.totalPartial': 'conegut per a {known} de {of} etapes',
'tours.stages.openInPlanner': 'Obre aquesta etapa al planificador',
+ 'tours.stages.placeWhole': 'Ruta sencera en aquest dia',
+ 'tours.stages.placeWholeHint': 'Tot el recorregut en aquest únic dia.',
+ 'tours.stages.placeWholeTaken': 'Aquest dia ja té la ruta.',
+ 'tours.stages.placeStages': 'Etapes a partir d’aquest dia',
+ 'tours.stages.placeStagesFit': 'Etapes a partir d’aquest dia, fins a l’etapa {last}',
+ 'tours.stages.placeStagesHint': 'Etapa 1 en aquest dia, cada etapa següent el dia després.',
+ 'tours.stages.placeStagesShort': 'El viatge acaba després de l’etapa {last}. Les etapes següents queden sense dia.',
+ 'tours.stages.placed': 'Etapes a partir del dia {from}.',
+ 'tours.stages.placedReplaced': 'La ruta sencera ja no és al dia {list}.',
+ 'tours.stages.placeFailed': 'No totes les etapes s’han pogut posar al seu dia. Desfer reverteix el que ja s’ha fet.',
+ 'tours.stages.placeUndo': 'Etapes repartides per dies',
'tours.estimate.label': 'Temps estimat',
'tours.estimate.short': 'Estimat',
'tours.estimate.unknown': 'Desconegut',
diff --git a/shared/src/i18n/cs/tours.ts b/shared/src/i18n/cs/tours.ts
index c57bc7ef2..6ed02a4e0 100644
--- a/shared/src/i18n/cs/tours.ts
+++ b/shared/src/i18n/cs/tours.ts
@@ -1387,6 +1387,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Celá trasa',
'tours.stages.totalPartial': 'známo pro {known} z {of} etap',
'tours.stages.openInPlanner': 'Otevřít tuto etapu v plánovači',
+ 'tours.stages.placeWhole': 'Celá trasa v tento den',
+ 'tours.stages.placeWholeHint': 'Celá trasa v tomto jediném dni.',
+ 'tours.stages.placeWholeTaken': 'Tento den už trasu má.',
+ 'tours.stages.placeStages': 'Etapy od tohoto dne',
+ 'tours.stages.placeStagesFit': 'Etapy od tohoto dne, až po etapu {last}',
+ 'tours.stages.placeStagesHint': 'Etapa 1 v tento den, každá další etapa v den poté.',
+ 'tours.stages.placeStagesShort': 'Cesta končí po etapě {last}. Další etapy zůstanou bez dne.',
+ 'tours.stages.placed': 'Etapy ode dne {from}.',
+ 'tours.stages.placedReplaced': 'Celá trasa už není ve dni {list}.',
+ 'tours.stages.placeFailed': 'Ne každou etapu se podařilo zařadit do jejího dne. Zpět vrátí, co už proběhlo.',
+ 'tours.stages.placeUndo': 'Etapy rozložené do dnů',
'tours.estimate.label': 'Odhadovaný čas',
'tours.estimate.short': 'Odhad',
'tours.estimate.unknown': 'Neznámý',
diff --git a/shared/src/i18n/de/tours.ts b/shared/src/i18n/de/tours.ts
index d96965d8c..979e65c55 100644
--- a/shared/src/i18n/de/tours.ts
+++ b/shared/src/i18n/de/tours.ts
@@ -1415,6 +1415,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Ganze Tour',
'tours.stages.totalPartial': 'bekannt für {known} von {of} Etappen',
'tours.stages.openInPlanner': 'Diese Etappe im Planer öffnen',
+ 'tours.stages.placeWhole': 'Ganze Tour an diesem Tag',
+ 'tours.stages.placeWholeHint': 'Die ganze Route an diesem einen Tag.',
+ 'tours.stages.placeWholeTaken': 'Dieser Tag hat die Tour schon.',
+ 'tours.stages.placeStages': 'Etappen ab diesem Tag',
+ 'tours.stages.placeStagesFit': 'Etappen ab diesem Tag, bis Etappe {last}',
+ 'tours.stages.placeStagesHint': 'Etappe 1 an diesem Tag, jede weitere am Tag danach.',
+ 'tours.stages.placeStagesShort': 'Die Reise endet nach Etappe {last}. Die Etappen danach bleiben ohne Tag.',
+ 'tours.stages.placed': 'Etappen ab Tag {from}.',
+ 'tours.stages.placedReplaced': 'Die ganze Tour liegt nicht mehr an Tag {list}.',
+ 'tours.stages.placeFailed': 'Nicht jede Etappe kam auf ihren Tag. Rückgängig nimmt zurück, was schon geschah.',
+ 'tours.stages.placeUndo': 'Etappen auf Tage verteilt',
'tours.estimate.label': 'Geschätzte Zeit',
'tours.estimate.short': 'Geschätzt',
'tours.estimate.unknown': 'Unbekannt',
diff --git a/shared/src/i18n/en/tours.ts b/shared/src/i18n/en/tours.ts
index 41e9ac101..6c677067e 100644
--- a/shared/src/i18n/en/tours.ts
+++ b/shared/src/i18n/en/tours.ts
@@ -1368,6 +1368,18 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Whole tour',
'tours.stages.totalPartial': 'known for {known} of {of} stages',
'tours.stages.openInPlanner': 'Open this stage in the planner',
+ // MDT-02: a multi-day tour put on a day, whole or a stage a day from it on.
+ 'tours.stages.placeWhole': 'Whole tour on this day',
+ 'tours.stages.placeWholeHint': 'The whole route on this one day.',
+ 'tours.stages.placeWholeTaken': 'This day already holds the tour.',
+ 'tours.stages.placeStages': 'Stages from this day on',
+ 'tours.stages.placeStagesFit': 'Stages from this day on, up to stage {last}',
+ 'tours.stages.placeStagesHint': 'Stage 1 on this day, each next stage on the day after.',
+ 'tours.stages.placeStagesShort': 'The trip ends after stage {last}. The stages after it stay without a day.',
+ 'tours.stages.placed': 'Stages from day {from} on.',
+ 'tours.stages.placedReplaced': 'The whole tour is no longer on day {list}.',
+ 'tours.stages.placeFailed': 'Not every stage could be put on its day. Undo takes back what was done.',
+ 'tours.stages.placeUndo': 'Stages put on days',
'tours.estimate.label': 'Estimated time',
'tours.estimate.short': 'Estimated',
'tours.estimate.unknown': 'Unknown',
diff --git a/shared/src/i18n/es/tours.ts b/shared/src/i18n/es/tours.ts
index fd36b9e57..fabe6ec5c 100644
--- a/shared/src/i18n/es/tours.ts
+++ b/shared/src/i18n/es/tours.ts
@@ -1397,6 +1397,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Ruta completa',
'tours.stages.totalPartial': 'conocido para {known} de {of} etapas',
'tours.stages.openInPlanner': 'Abrir esta etapa en el planificador',
+ 'tours.stages.placeWhole': 'Ruta completa en este día',
+ 'tours.stages.placeWholeHint': 'Todo el recorrido en este único día.',
+ 'tours.stages.placeWholeTaken': 'Este día ya tiene la ruta.',
+ 'tours.stages.placeStages': 'Etapas desde este día',
+ 'tours.stages.placeStagesFit': 'Etapas desde este día, hasta la etapa {last}',
+ 'tours.stages.placeStagesHint': 'Etapa 1 en este día, cada etapa siguiente en el día después.',
+ 'tours.stages.placeStagesShort': 'El viaje termina tras la etapa {last}. Las etapas siguientes quedan sin día.',
+ 'tours.stages.placed': 'Etapas desde el día {from}.',
+ 'tours.stages.placedReplaced': 'La ruta completa ya no está en el día {list}.',
+ 'tours.stages.placeFailed': 'No todas las etapas pudieron ponerse en su día. Deshacer revierte lo ya hecho.',
+ 'tours.stages.placeUndo': 'Etapas repartidas por días',
'tours.estimate.label': 'Tiempo estimado',
'tours.estimate.short': 'Estimado',
'tours.estimate.unknown': 'Desconocido',
diff --git a/shared/src/i18n/et/tours.ts b/shared/src/i18n/et/tours.ts
index dec82e0b6..092f5e887 100644
--- a/shared/src/i18n/et/tours.ts
+++ b/shared/src/i18n/et/tours.ts
@@ -1377,6 +1377,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Kogu matk',
'tours.stages.totalPartial': 'teada {known} etapi kohta {of}-st',
'tours.stages.openInPlanner': 'Ava see etapp planeerijas',
+ 'tours.stages.placeWhole': 'Kogu matk sellel päeval',
+ 'tours.stages.placeWholeHint': 'Kogu marsruut sellel ühel päeval.',
+ 'tours.stages.placeWholeTaken': 'Sellel päeval on matk juba olemas.',
+ 'tours.stages.placeStages': 'Etapid alates sellest päevast',
+ 'tours.stages.placeStagesFit': 'Etapid alates sellest päevast, kuni etapini {last}',
+ 'tours.stages.placeStagesHint': 'Etapp 1 sellel päeval, iga järgmine etapp järgmisel päeval.',
+ 'tours.stages.placeStagesShort': 'Reis lõpeb pärast etappi {last}. Järgmised etapid jäävad päevata.',
+ 'tours.stages.placed': 'Etapid alates päevast {from}.',
+ 'tours.stages.placedReplaced': 'Kogu matk pole enam päeval {list}.',
+ 'tours.stages.placeFailed': 'Kõiki etappe ei õnnestunud oma päevale panna. Võta tagasi ennistab juba tehtu.',
+ 'tours.stages.placeUndo': 'Etapid päevadele jaotatud',
'tours.estimate.label': 'Hinnanguline aeg',
'tours.estimate.short': 'Hinnang',
'tours.estimate.unknown': 'Teadmata',
diff --git a/shared/src/i18n/fr/tours.ts b/shared/src/i18n/fr/tours.ts
index eff29b3bf..b5f931c3c 100644
--- a/shared/src/i18n/fr/tours.ts
+++ b/shared/src/i18n/fr/tours.ts
@@ -1424,6 +1424,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Itinéraire complet',
'tours.stages.totalPartial': 'connu pour {known} étapes sur {of}',
'tours.stages.openInPlanner': 'Ouvrir cette étape dans le planificateur',
+ 'tours.stages.placeWhole': 'L’itinéraire complet sur ce jour',
+ 'tours.stages.placeWholeHint': 'Tout le parcours sur ce seul jour.',
+ 'tours.stages.placeWholeTaken': 'Ce jour contient déjà l’itinéraire.',
+ 'tours.stages.placeStages': 'Étapes à partir de ce jour',
+ 'tours.stages.placeStagesFit': 'Étapes à partir de ce jour, jusqu’à l’étape {last}',
+ 'tours.stages.placeStagesHint': 'Étape 1 sur ce jour, chaque étape suivante sur le jour d’après.',
+ 'tours.stages.placeStagesShort': 'Le voyage se termine après l’étape {last}. Les étapes suivantes restent sans jour.',
+ 'tours.stages.placed': 'Étapes à partir du jour {from}.',
+ 'tours.stages.placedReplaced': 'L’itinéraire complet n’est plus sur le jour {list}.',
+ 'tours.stages.placeFailed': 'Toutes les étapes n’ont pas pu être placées. Annuler défait ce qui a été fait.',
+ 'tours.stages.placeUndo': 'Étapes réparties sur les jours',
'tours.estimate.label': 'Temps estimé',
'tours.estimate.short': 'Estimé',
'tours.estimate.unknown': 'Inconnu',
diff --git a/shared/src/i18n/gr/tours.ts b/shared/src/i18n/gr/tours.ts
index bd2e2fa2a..7d54166ec 100644
--- a/shared/src/i18n/gr/tours.ts
+++ b/shared/src/i18n/gr/tours.ts
@@ -1426,6 +1426,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Όλη η διαδρομή',
'tours.stages.totalPartial': 'γνωστό για {known} από {of} σκέλη',
'tours.stages.openInPlanner': 'Άνοιγμα αυτού του σκέλους στον σχεδιαστή',
+ 'tours.stages.placeWhole': 'Όλη η διαδρομή αυτή την ημέρα',
+ 'tours.stages.placeWholeHint': 'Ολόκληρη η διαδρομή σε αυτή τη μία ημέρα.',
+ 'tours.stages.placeWholeTaken': 'Αυτή η ημέρα έχει ήδη τη διαδρομή.',
+ 'tours.stages.placeStages': 'Σκέλη από αυτή την ημέρα',
+ 'tours.stages.placeStagesFit': 'Σκέλη από αυτή την ημέρα, έως το σκέλος {last}',
+ 'tours.stages.placeStagesHint': 'Σκέλος 1 αυτή την ημέρα, κάθε επόμενο σκέλος την επόμενη ημέρα.',
+ 'tours.stages.placeStagesShort': 'Το ταξίδι τελειώνει μετά το σκέλος {last}. Τα επόμενα σκέλη μένουν χωρίς ημέρα.',
+ 'tours.stages.placed': 'Σκέλη από την ημέρα {from}.',
+ 'tours.stages.placedReplaced': 'Όλη η διαδρομή δεν είναι πια στην ημέρα {list}.',
+ 'tours.stages.placeFailed': 'Δεν μπήκε κάθε σκέλος στην ημέρα του. Η αναίρεση επαναφέρει ό,τι έγινε ήδη.',
+ 'tours.stages.placeUndo': 'Τα σκέλη μοιράστηκαν σε ημέρες',
'tours.estimate.label': 'Εκτιμώμενος χρόνος',
'tours.estimate.short': 'Εκτίμηση',
'tours.estimate.unknown': 'Άγνωστος',
diff --git a/shared/src/i18n/hu/tours.ts b/shared/src/i18n/hu/tours.ts
index 3accb832b..4ce3e248d 100644
--- a/shared/src/i18n/hu/tours.ts
+++ b/shared/src/i18n/hu/tours.ts
@@ -1401,6 +1401,19 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Teljes túra',
'tours.stages.totalPartial': 'ismert {known} szakasznál a {of} közül',
'tours.stages.openInPlanner': 'A szakasz megnyitása a tervezőben',
+ 'tours.stages.placeWhole': 'Teljes túra ezen a napon',
+ 'tours.stages.placeWholeHint': 'Az egész útvonal ezen az egy napon.',
+ 'tours.stages.placeWholeTaken': 'Ezen a napon már ott a túra.',
+ 'tours.stages.placeStages': 'Szakaszok ettől a naptól',
+ 'tours.stages.placeStagesFit': 'Szakaszok ettől a naptól ({last}. szakaszig)',
+ 'tours.stages.placeStagesHint': 'Az 1. szakasz ezen a napon, minden következő a rákövetkező napon.',
+ 'tours.stages.placeStagesShort':
+ 'Az utazás véget ér ezzel: {last}. szakasz. A további szakaszok nap nélkül maradnak.',
+ 'tours.stages.placed': 'Szakaszok {from}. naptól kezdve.',
+ 'tours.stages.placedReplaced': 'A teljes túra lekerült innen: {list}. nap.',
+ 'tours.stages.placeFailed':
+ 'Nem minden szakasz került a saját napjára. A visszavonás visszaállítja, ami már megtörtént.',
+ 'tours.stages.placeUndo': 'Szakaszok napokra osztva',
'tours.estimate.label': 'Becsült idő',
'tours.estimate.short': 'Becsült',
'tours.estimate.unknown': 'Ismeretlen',
diff --git a/shared/src/i18n/id/tours.ts b/shared/src/i18n/id/tours.ts
index bfd84affa..418254634 100644
--- a/shared/src/i18n/id/tours.ts
+++ b/shared/src/i18n/id/tours.ts
@@ -1378,6 +1378,18 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Seluruh tur',
'tours.stages.totalPartial': 'diketahui untuk {known} dari {of} etape',
'tours.stages.openInPlanner': 'Buka etape ini di perencana',
+ 'tours.stages.placeWhole': 'Seluruh tur di hari tersebut',
+ 'tours.stages.placeWholeHint': 'Seluruh rute dalam satu hari tersebut.',
+ 'tours.stages.placeWholeTaken': 'Hari tersebut sudah berisi tur ini.',
+ 'tours.stages.placeStages': 'Etape mulai hari tersebut',
+ 'tours.stages.placeStagesFit': 'Etape mulai hari tersebut, sampai etape {last}',
+ 'tours.stages.placeStagesHint': 'Etape 1 di hari tersebut, setiap etape berikutnya di hari sesudahnya.',
+ 'tours.stages.placeStagesShort': 'Perjalanan berakhir setelah etape {last}. Etape sesudahnya tetap tanpa hari.',
+ 'tours.stages.placed': 'Etape mulai Hari {from}.',
+ 'tours.stages.placedReplaced': 'Seluruh tur tidak lagi ada di Hari {list}.',
+ 'tours.stages.placeFailed':
+ 'Tidak semua etape bisa dimasukkan ke harinya. Urungkan membatalkan yang sudah dilakukan.',
+ 'tours.stages.placeUndo': 'Etape dibagi ke beberapa hari',
'tours.estimate.label': 'Perkiraan waktu',
'tours.estimate.short': 'Perkiraan',
'tours.estimate.unknown': 'Tidak diketahui',
diff --git a/shared/src/i18n/it/tours.ts b/shared/src/i18n/it/tours.ts
index f0be00155..0f4f19b52 100644
--- a/shared/src/i18n/it/tours.ts
+++ b/shared/src/i18n/it/tours.ts
@@ -1409,6 +1409,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Tour completo',
'tours.stages.totalPartial': 'noto per {known} tappe su {of}',
'tours.stages.openInPlanner': 'Apri questa tappa nel pianificatore',
+ 'tours.stages.placeWhole': 'Tour completo in questo giorno',
+ 'tours.stages.placeWholeHint': 'L’intero percorso in questo solo giorno.',
+ 'tours.stages.placeWholeTaken': 'Questo giorno ha già il tour.',
+ 'tours.stages.placeStages': 'Tappe da questo giorno in poi',
+ 'tours.stages.placeStagesFit': 'Tappe da questo giorno in poi, fino alla tappa {last}',
+ 'tours.stages.placeStagesHint': 'Tappa 1 in questo giorno, ogni tappa successiva nel giorno dopo.',
+ 'tours.stages.placeStagesShort': 'Il viaggio finisce dopo la tappa {last}. Le tappe successive restano senza giorno.',
+ 'tours.stages.placed': 'Tappe dal giorno {from} in poi.',
+ 'tours.stages.placedReplaced': 'Il tour completo non è più nel giorno {list}.',
+ 'tours.stages.placeFailed': 'Non tutte le tappe sono finite nel loro giorno. Annulla ripristina quanto già fatto.',
+ 'tours.stages.placeUndo': 'Tappe distribuite sui giorni',
'tours.estimate.label': 'Tempo stimato',
'tours.estimate.short': 'Stimato',
'tours.estimate.unknown': 'Sconosciuto',
diff --git a/shared/src/i18n/ja/tours.ts b/shared/src/i18n/ja/tours.ts
index b5c803d33..fb9766550 100644
--- a/shared/src/i18n/ja/tours.ts
+++ b/shared/src/i18n/ja/tours.ts
@@ -1343,6 +1343,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'ツアー全体',
'tours.stages.totalPartial': '{of} 件中 {known} 件のステージで判明',
'tours.stages.openInPlanner': 'このステージをプランナーで開く',
+ 'tours.stages.placeWhole': 'この日にツアー全体',
+ 'tours.stages.placeWholeHint': 'ルート全体をこの1日で。',
+ 'tours.stages.placeWholeTaken': 'この日にはすでにこのツアーがあります。',
+ 'tours.stages.placeStages': 'この日からステージごとに',
+ 'tours.stages.placeStagesFit': 'この日からステージごとに(ステージ {last} まで)',
+ 'tours.stages.placeStagesHint': 'ステージ 1 をこの日に、続くステージを翌日以降に1日ずつ。',
+ 'tours.stages.placeStagesShort': '旅行はステージ {last} の後で終わります。それ以降のステージは日なしのままです。',
+ 'tours.stages.placed': '{from}日目からステージを配置しました。',
+ 'tours.stages.placedReplaced': 'ツアー全体は {list}日目から外れました。',
+ 'tours.stages.placeFailed': '一部のステージを日に入れられませんでした。元に戻すと、行った変更を取り消せます。',
+ 'tours.stages.placeUndo': 'ステージを日ごとに配置',
'tours.estimate.label': '推定時間',
'tours.estimate.short': '推定',
'tours.estimate.unknown': '不明',
diff --git a/shared/src/i18n/ko/tours.ts b/shared/src/i18n/ko/tours.ts
index f12ea5ce8..5941f7495 100644
--- a/shared/src/i18n/ko/tours.ts
+++ b/shared/src/i18n/ko/tours.ts
@@ -1339,6 +1339,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': '전체 투어',
'tours.stages.totalPartial': '{of}개 구간 중 {known}개에서 알려짐',
'tours.stages.openInPlanner': '이 구간을 플래너에서 열기',
+ 'tours.stages.placeWhole': '이날 전체 투어',
+ 'tours.stages.placeWholeHint': '전체 경로를 이 하루에.',
+ 'tours.stages.placeWholeTaken': '이날에는 이미 이 투어가 있습니다.',
+ 'tours.stages.placeStages': '이날부터 구간별로',
+ 'tours.stages.placeStagesFit': '이날부터 구간별로 ({last}구간까지)',
+ 'tours.stages.placeStagesHint': '1구간은 이날, 다음 구간은 그다음 날마다.',
+ 'tours.stages.placeStagesShort': '여행이 {last}구간 뒤에 끝납니다. 그 뒤 구간은 날짜 없이 남습니다.',
+ 'tours.stages.placed': '{from}일차부터 구간을 배치했습니다.',
+ 'tours.stages.placedReplaced': '전체 투어가 더 이상 {list}일차에 없습니다.',
+ 'tours.stages.placeFailed': '일부 구간을 해당 날에 넣지 못했습니다. 실행 취소로 이미 한 변경을 되돌릴 수 있습니다.',
+ 'tours.stages.placeUndo': '구간을 날짜별로 배치',
'tours.estimate.label': '예상 시간',
'tours.estimate.short': '예상',
'tours.estimate.unknown': '알 수 없음',
diff --git a/shared/src/i18n/nl/tours.ts b/shared/src/i18n/nl/tours.ts
index b724e1a54..f44e3dc89 100644
--- a/shared/src/i18n/nl/tours.ts
+++ b/shared/src/i18n/nl/tours.ts
@@ -1404,6 +1404,18 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Hele tocht',
'tours.stages.totalPartial': 'bekend voor {known} van {of} etappes',
'tours.stages.openInPlanner': 'Deze etappe openen in de planner',
+ 'tours.stages.placeWhole': 'Hele tocht op deze dag',
+ 'tours.stages.placeWholeHint': 'De hele route op deze ene dag.',
+ 'tours.stages.placeWholeTaken': 'Deze dag heeft de tocht al.',
+ 'tours.stages.placeStages': 'Etappes vanaf deze dag',
+ 'tours.stages.placeStagesFit': 'Etappes vanaf deze dag, tot etappe {last}',
+ 'tours.stages.placeStagesHint': 'Etappe 1 op deze dag, elke volgende etappe op de dag erna.',
+ 'tours.stages.placeStagesShort': 'De reis eindigt na etappe {last}. De etappes daarna blijven zonder dag.',
+ 'tours.stages.placed': 'Etappes vanaf dag {from}.',
+ 'tours.stages.placedReplaced': 'De hele tocht staat niet meer op dag {list}.',
+ 'tours.stages.placeFailed':
+ 'Niet elke etappe kon op haar dag worden gezet. Ongedaan maken draait terug wat al gebeurd is.',
+ 'tours.stages.placeUndo': 'Etappes over dagen verdeeld',
'tours.estimate.label': 'Geschatte tijd',
'tours.estimate.short': 'Geschat',
'tours.estimate.unknown': 'Onbekend',
diff --git a/shared/src/i18n/pl/tours.ts b/shared/src/i18n/pl/tours.ts
index c0d63e8b5..545203812 100644
--- a/shared/src/i18n/pl/tours.ts
+++ b/shared/src/i18n/pl/tours.ts
@@ -1438,6 +1438,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Cała trasa',
'tours.stages.totalPartial': 'znane dla {known} z {of} etapów',
'tours.stages.openInPlanner': 'Otwórz ten etap w planerze',
+ 'tours.stages.placeWhole': 'Cała trasa w tym dniu',
+ 'tours.stages.placeWholeHint': 'Cała trasa przypada na ten jeden dzień.',
+ 'tours.stages.placeWholeTaken': 'Ten dzień ma już tę trasę.',
+ 'tours.stages.placeStages': 'Etapy od tego dnia',
+ 'tours.stages.placeStagesFit': 'Etapy od tego dnia, do etapu {last}',
+ 'tours.stages.placeStagesHint': 'Etap 1 w tym dniu, każdy kolejny etap w następnym dniu.',
+ 'tours.stages.placeStagesShort': 'Podróż kończy się po etapie {last}. Kolejne etapy zostają bez dnia.',
+ 'tours.stages.placed': 'Etapy od dnia {from}.',
+ 'tours.stages.placedReplaced': 'Cała trasa nie jest już w dniu {list}.',
+ 'tours.stages.placeFailed': 'Nie każdy etap udało się przypisać do jego dnia. Cofnij wycofa to, co już zrobiono.',
+ 'tours.stages.placeUndo': 'Etapy rozłożone na dni',
'tours.estimate.label': 'Szacowany czas',
'tours.estimate.short': 'Szacunek',
'tours.estimate.unknown': 'Nieznany',
diff --git a/shared/src/i18n/ru/tours.ts b/shared/src/i18n/ru/tours.ts
index d90424146..e1a171644 100644
--- a/shared/src/i18n/ru/tours.ts
+++ b/shared/src/i18n/ru/tours.ts
@@ -1444,6 +1444,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Весь маршрут',
'tours.stages.totalPartial': 'известно для {known} из {of} этапов',
'tours.stages.openInPlanner': 'Открыть этот этап в планировщике',
+ 'tours.stages.placeWhole': 'Весь маршрут в этот день',
+ 'tours.stages.placeWholeHint': 'Весь маршрут за один этот день.',
+ 'tours.stages.placeWholeTaken': 'В этот день маршрут уже есть.',
+ 'tours.stages.placeStages': 'Этапы с этого дня',
+ 'tours.stages.placeStagesFit': 'Этапы с этого дня, до этапа {last}',
+ 'tours.stages.placeStagesHint': 'Этап 1 в этот день, каждый следующий этап на следующий день.',
+ 'tours.stages.placeStagesShort': 'Поездка заканчивается после этапа {last}. Следующие этапы останутся без дня.',
+ 'tours.stages.placed': 'Этапы начиная со дня {from}.',
+ 'tours.stages.placedReplaced': 'Весь маршрут убран из дня {list}.',
+ 'tours.stages.placeFailed': 'Не все этапы удалось назначить на свои дни. Отмена вернёт то, что уже сделано.',
+ 'tours.stages.placeUndo': 'Этапы распределены по дням',
'tours.estimate.label': 'Расчётное время',
'tours.estimate.short': 'Оценка',
'tours.estimate.unknown': 'Неизвестно',
diff --git a/shared/src/i18n/sk/tours.ts b/shared/src/i18n/sk/tours.ts
index 3b1acdb71..778ee4771 100644
--- a/shared/src/i18n/sk/tours.ts
+++ b/shared/src/i18n/sk/tours.ts
@@ -1391,6 +1391,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Celá trasa',
'tours.stages.totalPartial': 'známe pre {known} z {of} etáp',
'tours.stages.openInPlanner': 'Otvoriť túto etapu v plánovači',
+ 'tours.stages.placeWhole': 'Celá trasa v tento deň',
+ 'tours.stages.placeWholeHint': 'Celá trasa v tomto jedinom dni.',
+ 'tours.stages.placeWholeTaken': 'Tento deň už trasu má.',
+ 'tours.stages.placeStages': 'Etapy od tohto dňa',
+ 'tours.stages.placeStagesFit': 'Etapy od tohto dňa, až po etapu {last}',
+ 'tours.stages.placeStagesHint': 'Etapa 1 v tento deň, každá ďalšia etapa v deň potom.',
+ 'tours.stages.placeStagesShort': 'Cesta končí po etape {last}. Ďalšie etapy zostanú bez dňa.',
+ 'tours.stages.placed': 'Etapy odo dňa {from}.',
+ 'tours.stages.placedReplaced': 'Celá trasa už nie je v dni {list}.',
+ 'tours.stages.placeFailed': 'Nie každú etapu sa podarilo zaradiť do jej dňa. Späť vráti, čo už prebehlo.',
+ 'tours.stages.placeUndo': 'Etapy rozložené do dní',
'tours.estimate.label': 'Odhadovaný čas',
'tours.estimate.short': 'Odhad',
'tours.estimate.unknown': 'Neznámy',
diff --git a/shared/src/i18n/sv/tours.ts b/shared/src/i18n/sv/tours.ts
index 4db8b6a63..a0e69747f 100644
--- a/shared/src/i18n/sv/tours.ts
+++ b/shared/src/i18n/sv/tours.ts
@@ -1373,6 +1373,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Hela turen',
'tours.stages.totalPartial': 'känt för {known} av {of} etapper',
'tours.stages.openInPlanner': 'Öppna etappen i planeraren',
+ 'tours.stages.placeWhole': 'Hela turen den här dagen',
+ 'tours.stages.placeWholeHint': 'Hela rutten på den här enda dagen.',
+ 'tours.stages.placeWholeTaken': 'Den här dagen har redan turen.',
+ 'tours.stages.placeStages': 'Etapper från den här dagen',
+ 'tours.stages.placeStagesFit': 'Etapper från den här dagen, till och med etapp {last}',
+ 'tours.stages.placeStagesHint': 'Etapp 1 den här dagen, varje följande etapp dagen efter.',
+ 'tours.stages.placeStagesShort': 'Resan slutar efter etapp {last}. Etapperna efter den blir utan dag.',
+ 'tours.stages.placed': 'Etapper från dag {from}.',
+ 'tours.stages.placedReplaced': 'Hela turen ligger inte längre på dag {list}.',
+ 'tours.stages.placeFailed': 'Alla etapper kunde inte läggas på sin dag. Ångra tar tillbaka det som redan gjorts.',
+ 'tours.stages.placeUndo': 'Etapper fördelade på dagar',
'tours.estimate.label': 'Uppskattad tid',
'tours.estimate.short': 'Uppskattad',
'tours.estimate.unknown': 'Okänd',
diff --git a/shared/src/i18n/th/tours.ts b/shared/src/i18n/th/tours.ts
index f2c6894c2..b6b7f076b 100644
--- a/shared/src/i18n/th/tours.ts
+++ b/shared/src/i18n/th/tours.ts
@@ -1318,6 +1318,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'ทั้งเส้นทาง',
'tours.stages.totalPartial': 'ทราบสำหรับ {known} จาก {of} ช่วง',
'tours.stages.openInPlanner': 'เปิดช่วงนี้ในตัววางแผน',
+ 'tours.stages.placeWhole': 'ทั้งเส้นทางในวันนี้',
+ 'tours.stages.placeWholeHint': 'ทั้งเส้นทางอยู่ในวันเดียวนี้',
+ 'tours.stages.placeWholeTaken': 'วันนี้มีทัวร์นี้อยู่แล้ว',
+ 'tours.stages.placeStages': 'ช่วงต่าง ๆ ตั้งแต่วันนี้',
+ 'tours.stages.placeStagesFit': 'ช่วงต่าง ๆ ตั้งแต่วันนี้ ถึงช่วงที่ {last}',
+ 'tours.stages.placeStagesHint': 'ช่วงที่ 1 ในวันนี้ ช่วงถัดไปแต่ละช่วงในวันถัดไป',
+ 'tours.stages.placeStagesShort': 'ทริปจบหลังช่วงที่ {last} ช่วงหลังจากนั้นจะยังไม่มีวัน',
+ 'tours.stages.placed': 'ช่วงต่าง ๆ ตั้งแต่วันที่ {from}',
+ 'tours.stages.placedReplaced': 'ทั้งเส้นทางไม่ได้อยู่ในวันที่ {list} แล้ว',
+ 'tours.stages.placeFailed': 'ใส่บางช่วงลงในวันของมันไม่ได้ การเลิกทำจะย้อนสิ่งที่ทำไปแล้ว',
+ 'tours.stages.placeUndo': 'แบ่งช่วงลงในวันต่าง ๆ แล้ว',
'tours.estimate.label': 'เวลาโดยประมาณ',
'tours.estimate.short': 'ประมาณ',
'tours.estimate.unknown': 'ไม่ทราบ',
diff --git a/shared/src/i18n/tours-locales.spec.ts b/shared/src/i18n/tours-locales.spec.ts
index 952ea5b9f..fb9aae727 100644
--- a/shared/src/i18n/tours-locales.spec.ts
+++ b/shared/src/i18n/tours-locales.spec.ts
@@ -20,7 +20,7 @@ const toursModules = import.meta.glob<{ default: TranslationStrings }>('./*/tour
const TOUR_DOMAINS: { file: string; generalKeyCount: number; modules: DomainModules }[] = [
{
file: 'tours',
- generalKeyCount: 1266,
+ generalKeyCount: 1277,
modules: toursModules,
},
{
diff --git a/shared/src/i18n/tr/tours.ts b/shared/src/i18n/tr/tours.ts
index 15ffb8178..a5432cdf7 100644
--- a/shared/src/i18n/tr/tours.ts
+++ b/shared/src/i18n/tr/tours.ts
@@ -1381,6 +1381,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Tüm tur',
'tours.stages.totalPartial': '{of} etabın {known} tanesi için biliniyor',
'tours.stages.openInPlanner': 'Bu etabı planlayıcıda aç',
+ 'tours.stages.placeWhole': 'Bu gün tüm tur',
+ 'tours.stages.placeWholeHint': 'Tüm rota bu tek günde.',
+ 'tours.stages.placeWholeTaken': 'Bu günde tur zaten var.',
+ 'tours.stages.placeStages': 'Bu günden itibaren etaplar',
+ 'tours.stages.placeStagesFit': 'Bu günden itibaren etaplar, {last}. etaba kadar',
+ 'tours.stages.placeStagesHint': 'Etap 1 bu günde, sonraki her etap ertesi günde.',
+ 'tours.stages.placeStagesShort': 'Seyahat {last}. etaptan sonra bitiyor. Sonraki etaplar günsüz kalır.',
+ 'tours.stages.placed': 'Etaplar {from}. günden itibaren.',
+ 'tours.stages.placedReplaced': 'Tüm tur artık {list}. günde değil.',
+ 'tours.stages.placeFailed': 'Her etap kendi gününe konamadı. Geri al, yapılanı geri alır.',
+ 'tours.stages.placeUndo': 'Etaplar günlere dağıtıldı',
'tours.estimate.label': 'Tahmini süre',
'tours.estimate.short': 'Tahmini',
'tours.estimate.unknown': 'Bilinmiyor',
diff --git a/shared/src/i18n/uk/tours.ts b/shared/src/i18n/uk/tours.ts
index a3239463b..19655fa52 100644
--- a/shared/src/i18n/uk/tours.ts
+++ b/shared/src/i18n/uk/tours.ts
@@ -1429,6 +1429,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Увесь маршрут',
'tours.stages.totalPartial': 'відомо для {known} з {of} етапів',
'tours.stages.openInPlanner': 'Відкрити цей етап у планувальнику',
+ 'tours.stages.placeWhole': 'Увесь маршрут у цей день',
+ 'tours.stages.placeWholeHint': 'Увесь маршрут за один цей день.',
+ 'tours.stages.placeWholeTaken': 'У цей день маршрут уже є.',
+ 'tours.stages.placeStages': 'Етапи з цього дня',
+ 'tours.stages.placeStagesFit': 'Етапи з цього дня, до етапу {last}',
+ 'tours.stages.placeStagesHint': 'Етап 1 у цей день, кожен наступний етап наступного дня.',
+ 'tours.stages.placeStagesShort': 'Подорож закінчується після етапу {last}. Наступні етапи залишаться без дня.',
+ 'tours.stages.placed': 'Етапи починаючи з дня {from}.',
+ 'tours.stages.placedReplaced': 'Увесь маршрут прибрано з дня {list}.',
+ 'tours.stages.placeFailed': 'Не всі етапи вдалося призначити на їхні дні. Скасування поверне те, що вже зроблено.',
+ 'tours.stages.placeUndo': 'Етапи розподілено по днях',
'tours.estimate.label': 'Орієнтовний час',
'tours.estimate.short': 'Оцінка',
'tours.estimate.unknown': 'Невідомо',
diff --git a/shared/src/i18n/vi/tours.ts b/shared/src/i18n/vi/tours.ts
index 977e50d88..0d22ca399 100644
--- a/shared/src/i18n/vi/tours.ts
+++ b/shared/src/i18n/vi/tours.ts
@@ -1363,6 +1363,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': 'Cả hành trình',
'tours.stages.totalPartial': 'đã biết cho {known} trên {of} chặng',
'tours.stages.openInPlanner': 'Mở chặng này trong trình lập kế hoạch',
+ 'tours.stages.placeWhole': 'Cả hành trình trong ngày này',
+ 'tours.stages.placeWholeHint': 'Toàn bộ tuyến đường trong một ngày này.',
+ 'tours.stages.placeWholeTaken': 'Ngày này đã có hành trình.',
+ 'tours.stages.placeStages': 'Các chặng từ ngày này',
+ 'tours.stages.placeStagesFit': 'Các chặng từ ngày này, đến chặng {last}',
+ 'tours.stages.placeStagesHint': 'Chặng 1 vào ngày này, mỗi chặng tiếp theo vào ngày sau đó.',
+ 'tours.stages.placeStagesShort': 'Chuyến đi kết thúc sau chặng {last}. Các chặng sau đó chưa có ngày.',
+ 'tours.stages.placed': 'Các chặng từ ngày {from}.',
+ 'tours.stages.placedReplaced': 'Cả hành trình không còn ở ngày {list}.',
+ 'tours.stages.placeFailed': 'Không phải chặng nào cũng xếp được vào ngày của nó. Hoàn tác sẽ gỡ những gì đã làm.',
+ 'tours.stages.placeUndo': 'Các chặng đã chia theo ngày',
'tours.estimate.label': 'Thời gian ước tính',
'tours.estimate.short': 'Ước tính',
'tours.estimate.unknown': 'Không rõ',
diff --git a/shared/src/i18n/zh-TW/tours.ts b/shared/src/i18n/zh-TW/tours.ts
index 798ba7cf0..8ae5c5d8b 100644
--- a/shared/src/i18n/zh-TW/tours.ts
+++ b/shared/src/i18n/zh-TW/tours.ts
@@ -1281,6 +1281,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': '整條路線',
'tours.stages.totalPartial': '{of} 個階段中 {known} 個已知',
'tours.stages.openInPlanner': '在規劃器中開啟此階段',
+ 'tours.stages.placeWhole': '整條路線放在這一天',
+ 'tours.stages.placeWholeHint': '整條路線都在這一天。',
+ 'tours.stages.placeWholeTaken': '這一天已有這條路線。',
+ 'tours.stages.placeStages': '從這一天起按階段安排',
+ 'tours.stages.placeStagesFit': '從這一天起按階段安排,直到第 {last} 階段',
+ 'tours.stages.placeStagesHint': '第 1 階段在這一天,之後每個階段排在下一天。',
+ 'tours.stages.placeStagesShort': '行程在第 {last} 階段之後結束。之後的階段暫無日期。',
+ 'tours.stages.placed': '已從第 {from} 天起安排各階段。',
+ 'tours.stages.placedReplaced': '整條路線已不在第 {list} 天。',
+ 'tours.stages.placeFailed': '並非所有階段都排進了對應的日期。復原可還原已完成的部分。',
+ 'tours.stages.placeUndo': '已按天安排各階段',
'tours.estimate.label': '預估時間',
'tours.estimate.short': '預估',
'tours.estimate.unknown': '未知',
diff --git a/shared/src/i18n/zh/tours.ts b/shared/src/i18n/zh/tours.ts
index 852fdfecc..05f92b67d 100644
--- a/shared/src/i18n/zh/tours.ts
+++ b/shared/src/i18n/zh/tours.ts
@@ -1282,6 +1282,17 @@ const tours: TranslationStrings = {
'tours.stages.wholeTour': '整条路线',
'tours.stages.totalPartial': '{of} 个阶段中 {known} 个已知',
'tours.stages.openInPlanner': '在规划器中打开此阶段',
+ 'tours.stages.placeWhole': '整条路线放在这一天',
+ 'tours.stages.placeWholeHint': '整条路线都在这一天。',
+ 'tours.stages.placeWholeTaken': '这一天已有这条路线。',
+ 'tours.stages.placeStages': '从这一天起按阶段安排',
+ 'tours.stages.placeStagesFit': '从这一天起按阶段安排,直到第 {last} 阶段',
+ 'tours.stages.placeStagesHint': '第 1 阶段在这一天,之后每个阶段排在下一天。',
+ 'tours.stages.placeStagesShort': '行程在第 {last} 阶段之后结束。之后的阶段暂无日期。',
+ 'tours.stages.placed': '已从第 {from} 天起安排各阶段。',
+ 'tours.stages.placedReplaced': '整条路线已不在第 {list} 天。',
+ 'tours.stages.placeFailed': '并非所有阶段都排进了对应的日期。撤销可还原已完成的部分。',
+ 'tours.stages.placeUndo': '已按天安排各阶段',
'tours.estimate.label': '预计用时',
'tours.estimate.short': '预计',
'tours.estimate.unknown': '未知',