Skip to content

armgit / TREK

Public Imported from GitHub
0

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

fix(tours): keep the road trip's vias on their legs when stages spread, and ask on the phone too

Maurice3e8d1923056b
diff --git a/client/src/components/Tours/stages/TourDayAddButton.tsx b/client/src/components/Tours/stages/TourDayAddButton.tsx
index 1dc038f35..82a537bee 100644
--- a/client/src/components/Tours/stages/TourDayAddButton.tsx
+++ b/client/src/components/Tours/stages/TourDayAddButton.tsx
@@ -4,6 +4,7 @@ import { useTranslation } from '../../../i18n';
import type { Day } from '../../../types';
import { ContextMenu, useContextMenu } from '../../shared/ContextMenu';
import { DialogButton } from '../../shared/DialogShell';
+import { dayMenuLabel } from '../tourDays';
import type { TourDayAssignment } from '../useTourDayAssignment';
import { stagesThatFit, tourDayChoices } from './stageSpread';
@@ -21,22 +22,32 @@ interface TourDayHowInput {
/**
* 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.
+ * or a stage a day from it on, under the day they act on, so the step after
+ * the day menu still says which day was picked. Whole is greyed out on a day
+ * that holds the tour already, and says so; the stages say how many fit when
+ * the trip ends before them.
*/
-export function tourDayHowItems(input: TourDayHowInput, t: Translate): MenuItems {
+export function tourDayHowItems(input: TourDayHowInput, t: Translate, locale: string): 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),
- }));
+ const ways = tourDayChoices(facts, t).map((choice) => {
+ const disabled = choice.disabled || !assignment.isAvailable(placeId, dayId, choice.how);
+ return {
+ label: choice.title,
+ // Greyed out with no reason reads as broken; the reason goes right under it.
+ hint: choice.disabled && choice.how === 'whole' ? choice.hint : undefined,
+ icon: choice.how === 'whole' ? CalendarDays : CalendarRange,
+ disabled,
+ onClick: () => void assignment.assign(placeId, dayId, choice.how),
+ };
+ });
+ const at = days.findIndex((day) => day.id === dayId);
+ if (at < 0) return ways;
+ return [{ label: dayMenuLabel(days[at], at, t, locale), heading: true }, ...ways];
}
/**
@@ -46,7 +57,7 @@ export function tourDayHowItems(input: TourDayHowInput, t: Translate): MenuItems
*/
export function TourDayAddButton(input: TourDayHowInput) {
const { placeId, dayId, stageCount, assignment } = input;
- const { t } = useTranslation();
+ const { t, locale } = useTranslation();
const menu = useContextMenu();
const staged = stageCount > 1;
@@ -60,7 +71,7 @@ export function TourDayAddButton(input: TourDayHowInput) {
menu.close();
return;
}
- menu.open(event, tourDayHowItems(input, t), true);
+ menu.open(event, tourDayHowItems(input, t, locale), true);
};
return (
diff --git a/client/src/components/Tours/stages/tourDayChoiceViews.test.tsx b/client/src/components/Tours/stages/tourDayChoiceViews.test.tsx
index fb6d06a10..0ef25d164 100644
--- a/client/src/components/Tours/stages/tourDayChoiceViews.test.tsx
+++ b/client/src/components/Tours/stages/tourDayChoiceViews.test.tsx
@@ -1,4 +1,5 @@
-// FE-TOUR-STAGE-SPREAD-017 to FE-TOUR-STAGE-SPREAD-021: where a multi-day tour is put on a day on the
+// FE-TOUR-STAGE-SPREAD-017 to FE-TOUR-STAGE-SPREAD-021 and FE-TOUR-STAGE-SPREAD-026: 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';
@@ -45,6 +46,22 @@ describe('the day menu of a tour list', () => {
expect(assignment.assign).toHaveBeenCalledWith(81, 3, 'stages');
expect(assignment.isAvailable).toHaveBeenCalledWith(81, 3, 'stages');
});
+
+ it('FE-TOUR-STAGE-SPREAD-026: the second step names the day picked, and a greyed-out whole says why', async () => {
+ vi.mocked(assignment.isOnDay).mockReturnValue(true);
+ render(<TourDayMenu days={DAYS} placeId={81} label="Add to day" assignment={assignment} stageCount={3} />);
+ await userEvent.click(screen.getByRole('button', { name: 'Add to day' }));
+ await userEvent.click(screen.getByRole('button', { name: 'Day 2' }));
+ const whole = await screen.findByRole('button', { name: /^Whole tour on this day/ });
+ expect(whole).toBeDisabled();
+ expect(whole).toHaveTextContent('This day already holds the tour.');
+ // The day stays in sight as a heading, not as something to click again.
+ expect(screen.getByText('Day 2')).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Day 2' })).toBeNull();
+ const stages = screen.getByRole('button', { name: 'Stages from this day on, up to stage 1' });
+ expect(stages).toBeEnabled();
+ expect(stages).not.toHaveTextContent('The trip ends');
+ });
});
describe('the detail button and the dialog', () => {
@@ -58,7 +75,9 @@ describe('the detail button and the dialog', () => {
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();
+ const whole = screen.getByRole('button', { name: /^Whole tour on this day/ });
+ expect(whole).toBeDisabled();
+ expect(whole).toHaveTextContent('This day already holds the tour.');
await userEvent.click(screen.getByRole('button', { name: 'Stages from this day on, up to stage 1' }));
expect(assignment.assign).toHaveBeenLastCalledWith(81, 4, 'stages');
});
diff --git a/client/src/components/Tours/tourParts.tsx b/client/src/components/Tours/tourParts.tsx
index d75186e70..e3749bb48 100644
--- a/client/src/components/Tours/tourParts.tsx
+++ b/client/src/components/Tours/tourParts.tsx
@@ -203,7 +203,7 @@ export function TourDayMenu({ days, placeId, assignment, label, variant = 'round
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)
+ const ways = tourDayHowItems({ placeId, dayId: day.id, days, stageCount, assignment }, t, locale)
if (trigger.current?.isConnected) menu.openAt(trigger.current, ways)
}, 0)
const items = days.map((day, index) => ({
diff --git a/client/src/components/Tours/useTourDayAssignment.test.ts b/client/src/components/Tours/useTourDayAssignment.test.ts
index af694c4b6..362fa1058 100644
--- a/client/src/components/Tours/useTourDayAssignment.test.ts
+++ b/client/src/components/Tours/useTourDayAssignment.test.ts
@@ -78,4 +78,15 @@ describe('useTourDayAssignment (PR1-18)', () => {
expect(onAssignToDay).toHaveBeenCalledTimes(1);
expect(onAssignToDay).toHaveBeenCalledWith(42, 3, undefined, 'stages');
});
+
+ it('FE-TOUR-STAGE-SPREAD-028: left for the plan to ask, a day that holds a multi-day tour still goes, with no way passed', async () => {
+ const onAssignToDay = vi.fn(async () => true);
+ const { result } = renderHook(() => useTourDayAssignment({ canAssign: true, onAssignToDay }));
+ await act(async () => {
+ expect(await result.current.assign(42, 3, 'ask')).toBe(true);
+ expect(await result.current.assign(42, 3)).toBe(false);
+ });
+ expect(onAssignToDay).toHaveBeenCalledTimes(1);
+ expect(onAssignToDay).toHaveBeenCalledWith(42, 3);
+ });
});
diff --git a/client/src/components/Tours/useTourDayAssignment.ts b/client/src/components/Tours/useTourDayAssignment.ts
index 3c83acd00..550274dd3 100644
--- a/client/src/components/Tours/useTourDayAssignment.ts
+++ b/client/src/components/Tours/useTourDayAssignment.ts
@@ -53,14 +53,22 @@ export function useTourDayAssignment({ canAssign, onAssignToDay }: TourDayAssign
[canAssign, isOnDay, isPending]
);
+ /**
+ * `ask` is for a multi-day tour put on a day where no menu asked: the plan
+ * asks whole or stages, so a day that holds the tour still goes, for its
+ * stages, the way the menus let it.
+ */
const assign = useCallback(
- async (placeId: number, dayId: number, how?: TourDayHow): Promise<boolean> => {
+ async (placeId: number, dayId: number, how?: TourDayHow | 'ask'): Promise<boolean> => {
const key = `${placeId}:${dayId}`;
- if (!isAvailable(placeId, dayId, how) || inFlight.current.has(key)) return false;
+ if (!isAvailable(placeId, dayId, how === 'ask' ? 'stages' : how) || inFlight.current.has(key)) return false;
inFlight.current.add(key);
setPending((current) => new Set(current).add(key));
try {
- const done = how ? await onAssignToDay(placeId, dayId, undefined, how) : await onAssignToDay(placeId, dayId);
+ const asked = how === 'ask' ? undefined : how;
+ const done = asked
+ ? await onAssignToDay(placeId, dayId, undefined, asked)
+ : await onAssignToDay(placeId, dayId);
return done !== false;
} finally {
inFlight.current.delete(key);
diff --git a/client/src/components/shared/ContextMenu.tsx b/client/src/components/shared/ContextMenu.tsx
index 953e3a587..8e354f8b5 100644
--- a/client/src/components/shared/ContextMenu.tsx
+++ b/client/src/components/shared/ContextMenu.tsx
@@ -10,6 +10,10 @@ interface MenuItem {
disabled?: boolean
danger?: boolean
divider?: boolean
+ /** A second, quieter line under the label: what an item does, or why it is greyed out. */
+ hint?: string
+ /** A row that only names what the items below it act on, such as the day picked a step before. */
+ heading?: boolean
}
interface MenuState {
@@ -115,6 +119,14 @@ export function ContextMenu({ menu, onClose }: ContextMenuProps) {
}}>
{menu.items.filter(Boolean).map((item, i) => {
if (item.divider) return <div key={i} style={{ height: 1, background: 'var(--border-faint)', margin: '3px 6px' }} />
+ if (item.heading) return (
+ <div key={i} style={{
+ padding: '6px 10px 4px', fontSize: 'calc(11px * var(--fs-scale-caption, 1))', fontWeight: 600,
+ color: 'var(--text-faint)',
+ }}>
+ {item.label}
+ </div>
+ )
const Icon = item.icon
return (
<button type="button" key={i} disabled={item.disabled} onClick={() => { if (item.disabled) return; item.onClick?.(); onClose() }} style={{
@@ -129,7 +141,17 @@ export function ContextMenu({ menu, onClose }: ContextMenuProps) {
onMouseLeave={e => e.currentTarget.style.background = 'none'}
>
{Icon && <Icon size={13} style={{ flexShrink: 0, color: item.danger ? '#ef4444' : 'var(--text-faint)' }} />}
- <span>{item.label}</span>
+ {item.hint ? (
+ <span style={{ display: 'flex', flexDirection: 'column', gap: 1, minWidth: 0 }}>
+ <span>{item.label}</span>
+ <span style={{
+ maxWidth: 240, whiteSpace: 'normal', fontWeight: 400, color: 'var(--text-muted)',
+ fontSize: 'calc(11px * var(--fs-scale-caption, 1))',
+ }}>
+ {item.hint}
+ </span>
+ </span>
+ ) : <span>{item.label}</span>}
</button>
)
})}
diff --git a/client/src/mobile/screens/trip/sheets/MBrowseActionsSheet.tsx b/client/src/mobile/screens/trip/sheets/MBrowseActionsSheet.tsx
index 86220d80c..e7c9e5e96 100644
--- a/client/src/mobile/screens/trip/sheets/MBrowseActionsSheet.tsx
+++ b/client/src/mobile/screens/trip/sheets/MBrowseActionsSheet.tsx
@@ -7,6 +7,7 @@ import { useAddonStore } from '../../../../store/addonStore'
import { useSaveToCollectionStore } from '../../../../store/saveToCollectionStore'
import { placeToSaveTarget } from '../../../../components/Collections/saveTarget'
import { useTourDayAssignment } from '../../../../components/Tours/useTourDayAssignment'
+import { stageKeysOfTour } from '../../../../components/Tours/stages/stageSpread'
import type { Place } from '../../../../types'
interface BrowseActionsPayload {
@@ -60,11 +61,14 @@ export default function MBrowseActionsSheet({ planner, shell }: MTripSheetsProps
openSavePicker(placeToSaveTarget(place))
}
- const tourUnavailableOnDay = (dayId: number) => isTourPlace(place.id) && !dayAssignment.isAvailable(place.id, dayId)
+ // A multi-day tour can still go from a day that holds it, as stages (MDT-02); the plan asks which way.
+ const staged = stageKeysOfTour(planner.tours.find(tour => tour.place_id === place.id)).length > 1
+ const tourUnavailableOnDay = (dayId: number) =>
+ isTourPlace(place.id) && !dayAssignment.isAvailable(place.id, dayId, staged ? 'stages' : 'whole')
const assignToDay = async (dayId: number) => {
const assigned = isTourPlace(place.id)
- ? await dayAssignment.assign(place.id, dayId)
+ ? await dayAssignment.assign(place.id, dayId, staged ? 'ask' : undefined)
: await planner.handleAssignToDay(place.id, dayId)
if (assigned !== false) shell.closeSheet()
}
diff --git a/client/src/pages/tripPlanner/useTourDayChoice.test.ts b/client/src/pages/tripPlanner/useTourDayChoice.test.ts
index 1e8451b2e..eaeeb442e 100644
--- a/client/src/pages/tripPlanner/useTourDayChoice.test.ts
+++ b/client/src/pages/tripPlanner/useTourDayChoice.test.ts
@@ -1,12 +1,14 @@
-// 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).
+// FE-TOUR-STAGE-SPREAD-010 to FE-TOUR-STAGE-SPREAD-016, FE-TOUR-STAGE-SPREAD-024 and
+// FE-TOUR-STAGE-SPREAD-025: 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), the road trip's vias kept on
+// their legs.
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 type { Assignment, AssignmentsMap } from '../../types';
import { useTourDayChoice } from './useTourDayChoice';
type Options = Parameters<typeof useTourDayChoice>[0];
@@ -53,9 +55,31 @@ beforeEach(() => {
assignWhole: vi.fn(async () => true),
updateRouteForDay: vi.fn(),
onToursChanged: vi.fn(async () => undefined),
+ roadtripVias: { byDay: {}, reanchor: vi.fn(async () => undefined) },
+ viaLiesBefore: vi.fn(() => () => true),
};
});
+/** Lets the store writes change the day lists, the way the real ones do, so the stops can be counted. */
+function writesThatLand() {
+ const dayOf = (dayId: number) => useTripStore.getState().assignments[String(dayId)] ?? [];
+ const setDay = (dayId: number, items: Assignment[]) =>
+ useTripStore.setState((state) => ({ assignments: { ...state.assignments, [String(dayId)]: items } }));
+ writes.removeAssignment.mockImplementation(async (_trip: number, dayId: number, id: number) => {
+ setDay(dayId, dayOf(dayId).filter((item) => item.id !== id));
+ });
+ writes.assignPlaceToDay.mockImplementation(
+ async (_trip: number, dayId: number, placeId: number, position: number | null, key?: string) => {
+ const rows = dayOf(dayId).slice().sort((a, b) => a.order_index - b.order_index);
+ const added = buildAssignment({ id: 900 + dayId, day_id: dayId, place: buildPlace({ id: placeId }) });
+ added.tour_stage_key = key ?? null;
+ rows.splice(position ?? rows.length, 0, added);
+ setDay(dayId, rows.map((item, index) => ({ ...item, order_index: index })));
+ return added;
+ }
+ );
+}
+
const render = () => renderHook(() => useTourDayChoice(options));
const lastUndo = () => vi.mocked(options.pushUndo).mock.calls.at(-1)?.[1] as Undo;
@@ -183,6 +207,65 @@ describe('useTourDayChoice', () => {
expect(writes.moveAssignment).toHaveBeenCalledWith(42, 31, 1, 3);
});
+ it('FE-TOUR-STAGE-SPREAD-024: a whole tour taken off a road-trip day moves the vias behind it, and undo moves them back', async () => {
+ const stop = (id: number, order: number, placeId: number) =>
+ buildAssignment({ id, day_id: 2, order_index: order, place: buildPlace({ id: placeId }) });
+ const whole = buildAssignment({ id: 22, day_id: 2, order_index: 1, place: buildPlace({ id: 9 }) });
+ whole.tour_stage_key = null;
+ seed({ '1': [], '2': [stop(50, 0, 100), whole, stop(51, 2, 101), stop(52, 3, 102)], '3': [] });
+ writesThatLand();
+ // One via on the leg into the tour, one on the leg after it (stop 51 to stop 52).
+ options.roadtripVias.byDay = {
+ 2: [
+ { id: 701, day_id: 2, after_order_index: 0, lat: 1, lng: 1 },
+ { id: 700, day_id: 2, after_order_index: 2, lat: 2, lng: 2 },
+ ] as never,
+ };
+ const { result } = render();
+ await act(async () => {
+ expect(await result.current.handleAssignToDay(9, 1, undefined, 'stages')).toBe(true);
+ });
+ // The tour was the second of four stops: the via behind it now leaves the stop before it.
+ expect(options.roadtripVias.reanchor).toHaveBeenCalledTimes(1);
+ expect(options.roadtripVias.reanchor).toHaveBeenCalledWith(2, {
+ vias: [{ id: 700, after_order_index: 1 }],
+ remove: [],
+ });
+
+ vi.mocked(options.roadtripVias.reanchor).mockClear();
+ await act(async () => {
+ await lastUndo()();
+ });
+ // Stage 2 comes off the end of day 2 with no via behind it, then the whole tour goes back
+ // second, and the via is counted from where the spread left it, not where it started.
+ expect(writes.assignPlaceToDay).toHaveBeenLastCalledWith(42, 2, 9, 1, undefined);
+ expect(options.roadtripVias.reanchor).toHaveBeenCalledTimes(1);
+ expect(options.roadtripVias.reanchor).toHaveBeenCalledWith(2, {
+ vias: [{ id: 700, after_order_index: 2 }],
+ remove: [],
+ });
+ expect(useTripStore.getState().assignments['2'].map((item) => item.id)).toEqual([50, 902, 51, 52]);
+ });
+
+ it('FE-TOUR-STAGE-SPREAD-025: a tour whole on several days says it left all of them, and a via that cannot follow says why', async () => {
+ const onDay = (id: number, dayId: number) =>
+ buildAssignment({ id, day_id: dayId, place: buildPlace({ id: 9 }), tour_stage_key: null });
+ seed({ '1': [], '2': [buildAssignment({ id: 60, day_id: 2 }), onDay(22, 2)], '3': [onDay(33, 3)] });
+ options.roadtripVias.byDay = { 2: [{ id: 700, day_id: 2, after_order_index: 0, lat: 2, lng: 2 }] as never };
+ vi.mocked(options.roadtripVias.reanchor).mockRejectedValueOnce(new Error('No network'));
+ const { result } = render();
+ await act(async () => {
+ expect(await result.current.handleAssignToDay(9, 1, undefined, 'stages')).toBe(true);
+ });
+ expect(options.toast.success).toHaveBeenCalledWith(
+ 'tours.stages.placed {"from":1} tours.stages.placedReplacedMany {"list":"2, 3"}'
+ );
+ // The stages went on all the same; only the road kept its old anchors, and the plan says so once.
+ expect(writes.assignPlaceToDay).toHaveBeenCalledTimes(3);
+ expect(options.toast.error).toHaveBeenCalledTimes(1);
+ expect(options.toast.error).toHaveBeenCalledWith('No network');
+ });
+
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();
diff --git a/client/src/pages/tripPlanner/useTourDayChoice.ts b/client/src/pages/tripPlanner/useTourDayChoice.ts
index 8b60f21d2..928204e1c 100644
--- a/client/src/pages/tripPlanner/useTourDayChoice.ts
+++ b/client/src/pages/tripPlanner/useTourDayChoice.ts
@@ -9,13 +9,21 @@ import {
type TourDayHow,
type TourDayQuestion,
} from '../../components/Tours/stages/stageSpread';
+import {
+ isEmptyReanchoring,
+ reanchorAfterInsert,
+ reanchorAfterRemove,
+ type Reanchoring,
+} from '../../components/Roadtrip/roadtripModel';
+import type { RoadtripVias } from '../../components/Roadtrip/useRoadtripVias';
import { isTourOnDay } from '../../components/Tours/useTourDayAssignment';
import { useTripStore } from '../../store/tripStore';
-import type { Day } from '../../types';
+import type { Day, Place } from '../../types';
+import { roadtripStopList } from '../../utils/dayRouteVias';
import { restoreVisit, visitOf } from './placeUndo';
+import type { RoadtripFeed } from './useRoadtripFeed';
type Translate = (key: string, params?: Record<string, string | number>) => string;
-type Undo = () => Promise<void>;
interface TourDayChoiceOptions {
tripId: number;
@@ -33,30 +41,125 @@ interface TourDayChoiceOptions {
assignWhole: (placeId: number, dayId?: number, position?: number) => Promise<boolean>;
updateRouteForDay: (dayId: number) => void;
onToursChanged: () => Promise<unknown> | void;
+ /** The road trip's vias, which every write that shifts the stops of a day carries along. */
+ roadtripVias: Pick<RoadtripVias, 'byDay' | 'reanchor'>;
+ viaLiesBefore: RoadtripFeed['viaLiesBefore'];
}
-/** 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> {
+type ViaFeed = Pick<TourDayChoiceOptions, 'roadtripVias' | 'viaLiesBefore'>;
+type Located = Pick<Place, 'lat' | 'lng'> | null | undefined;
+
+/**
+ * Keeps a day's road on the legs it was drawn on while a spread, or its undo,
+ * takes stops off days and puts them back, the way the plan's own writes do
+ * (useDayPlanEdits). A via is anchored by `after_order_index`, a POSITION among
+ * the day's stops, and a tour with a start counts as one: a stop taken off the
+ * middle of a road-trip day shifts every via behind it onto the wrong leg. One
+ * run of writes can touch a day twice (the undo takes a stage off a day and
+ * puts the whole tour back on it) faster than the plan renders, so the stops
+ * are read from the store as each write goes out, and the vias are kept as the
+ * last correction left them.
+ */
+function viaKeeper(feed: ViaFeed, onError: (err: unknown) => void) {
+ const known = new Map<number, ViaFeed['roadtripVias']['byDay'][number]>();
+ const viasOf = (dayId: number) => known.get(dayId) ?? feed.roadtripVias.byDay[dayId] ?? [];
+ const rowsOf = (dayId: number) =>
+ (useTripStore.getState().assignments[String(dayId)] ?? [])
+ .slice()
+ .sort((a, b) => (a.order_index ?? 0) - (b.order_index ?? 0));
+
+ const correct = async (dayId: number, plan: Reanchoring | null) => {
+ if (!plan || isEmptyReanchoring(plan)) return;
+ try {
+ await feed.roadtripVias.reanchor(dayId, plan);
+ const moved = new Map(plan.vias.map((via) => [via.id, via.after_order_index] as const));
+ known.set(
+ dayId,
+ viasOf(dayId)
+ .filter((via) => !plan.remove.includes(via.id))
+ .map((via) => ({ ...via, after_order_index: moved.get(via.id) ?? via.after_order_index }))
+ );
+ } catch (err: unknown) {
+ // The stop is where it was put all the same; only the road kept its old anchors.
+ onError(err);
+ }
+ };
+
+ return {
+ /** Takes a stop off a day through `write`, the vias behind it moving up a leg. */
+ async takeOff(dayId: number, assignmentId: number, write: () => Promise<void>) {
+ const stops = roadtripStopList(rowsOf(dayId));
+ const at = stops.findIndex((stop) => stop.id === assignmentId);
+ const plan = at < 0 ? null : reanchorAfterRemove(viasOf(dayId), at, stops.length);
+ await write();
+ await correct(dayId, plan);
+ },
+ /** Puts a stop on a day at row `position` through `write`, the vias behind it moving down a leg. */
+ async putOn<T>(dayId: number, position: number, place: Located, write: () => Promise<T>): Promise<T> {
+ const rows = rowsOf(dayId);
+ const stopCount = roadtripStopList(rows).length;
+ const insertAt = roadtripStopList(rows.slice(0, Math.max(0, position))).length;
+ const lat = place?.lat;
+ const lng = place?.lng;
+ const plan =
+ insertAt >= stopCount || typeof lat !== 'number' || typeof lng !== 'number'
+ ? null
+ : reanchorAfterInsert(viasOf(dayId), insertAt, feed.viaLiesBefore(dayId, { lat, lng }));
+ const result = await write();
+ await correct(dayId, plan);
+ return result;
+ },
+ };
+}
+
+type ViaKeeper = ReturnType<typeof viaKeeper>;
+/** Takes one write back, the vias kept by the one keeper of the whole undo. */
+type Undo = (road: ViaKeeper) => Promise<void>;
+
+/**
+ * Sends one write of a spread through the store, the plan's offline way, and
+ * returns what takes it back. A stage moved or put on a day goes on at its end,
+ * where no via lies behind it; a stop taken off a day or put back in the
+ * middle of one carries the day's vias along (`viaKeeper`). The undo runs
+ * later, and is handed the keeper of its own run.
+ */
+async function runStep(
+ tripId: number,
+ placeId: number,
+ step: SpreadStep,
+ road: ViaKeeper
+): 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);
+ await road.takeOff(step.fromDayId, step.assignmentId, () =>
+ store.moveAssignment(tripId, step.assignmentId, step.fromDayId, step.toDayId)
+ );
+ return (back) =>
+ back.takeOff(step.toDayId, step.assignmentId, () =>
+ 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);
+ return async (back) => {
+ const id = created?.id;
+ if (!id) return;
+ await back.takeOff(step.dayId, id, () => useTripStore.getState().removeAssignment(tripId, step.dayId, id));
};
}
const item = (store.assignments[String(step.dayId)] ?? []).find((entry) => entry.id === step.assignmentId);
- await store.removeAssignment(tripId, step.dayId, step.assignmentId);
- return async () => {
+ await road.takeOff(step.dayId, step.assignmentId, () =>
+ store.removeAssignment(tripId, step.dayId, step.assignmentId)
+ );
+ return async (back) => {
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);
+ const restored = await back.putOn(step.dayId, visit.orderIndex, item.place, () =>
+ actions.assignPlaceToDay(tripId, step.dayId, placeId, visit.orderIndex, key)
+ );
if (restored?.id) await restoreVisit(tripId, actions, visit, restored.id);
};
}
@@ -71,7 +174,9 @@ function spreadMessage(plan: StageSpread, days: readonly Day[], t: Translate): s
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(', ') }));
+ // A tour can sit whole on several days, once on each; the sentence then names them all.
+ const key = off.length > 1 ? 'tours.stages.placedReplacedMany' : 'tours.stages.placedReplaced';
+ parts.push(t(key, { list: off.join(', ') }));
}
return parts.join(' ');
}
@@ -91,6 +196,9 @@ export function useTourDayChoice(options: TourDayChoiceOptions) {
const { pushUndo, assignWhole, updateRouteForDay, onToursChanged } = options;
const [tourDayQuestion, setTourDayQuestion] = useState<TourDayQuestion | null>(null);
const answer = useRef<((how: TourDayHow | null) => void) | null>(null);
+ // The vias as the plan has them now: an undo runs long after the spread that pushed it.
+ const viaFeed = useRef<ViaFeed>(options);
+ viaFeed.current = { roadtripVias: options.roadtripVias, viaLiesBefore: options.viaLiesBefore };
const answerTourDay = useCallback((how: TourDayHow | null) => {
const resolve = answer.current;
@@ -115,11 +223,21 @@ export function useTourDayChoice(options: TourDayChoiceOptions) {
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;
+ // Said once per run of writes, the way the plan says a road it could not keep.
+ const keeper = () => {
+ let said = false;
+ return viaKeeper(viaFeed.current, (err) => {
+ if (said) return;
+ said = true;
+ toast.error(err instanceof Error ? err.message : t('common.unknownError'));
+ });
+ };
+ const road = keeper();
const undos: Undo[] = [];
let failed = false;
for (const step of plan.steps) {
try {
- undos.unshift(await runStep(tripId, placeId, step));
+ undos.unshift(await runStep(tripId, placeId, step, road));
} catch {
// The store has put back the write that failed; what went before stays, and the undo takes it back.
failed = true;
@@ -137,7 +255,8 @@ export function useTourDayChoice(options: TourDayChoiceOptions) {
pushUndo(
t('tours.stages.placeUndo'),
async () => {
- for (const undo of undos) await undo();
+ const back = keeper();
+ for (const undo of undos) await undo(back);
await onToursChanged();
redraw();
},
diff --git a/client/src/pages/tripPlanner/useTripPlanner.ts b/client/src/pages/tripPlanner/useTripPlanner.ts
index 6c12dfee4..8eca48cf7 100644
--- a/client/src/pages/tripPlanner/useTripPlanner.ts
+++ b/client/src/pages/tripPlanner/useTripPlanner.ts
@@ -580,7 +580,7 @@ export function useTripPlanner() {
// 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,
+ onToursChanged: reloadTourPlaceIds, roadtripVias, viaLiesBefore,
})
const { handleAddDay, dayAdd } = useDayAdd({
diff --git a/client/tests/unit/mobile/trip/MBrowseActionsSheet.tours.test.tsx b/client/tests/unit/mobile/trip/MBrowseActionsSheet.tours.test.tsx
index 1bb6dff71..10a3f65e5 100644
--- a/client/tests/unit/mobile/trip/MBrowseActionsSheet.tours.test.tsx
+++ b/client/tests/unit/mobile/trip/MBrowseActionsSheet.tours.test.tsx
@@ -95,6 +95,24 @@ describe('MBrowseActionsSheet Tour assignment picker', () => {
expect(screen.getByRole('button', { name: /Day three/ })).toBeEnabled();
});
+ it('FE-TOUR-STAGE-SPREAD-027: a multi-day tour still goes from a day that holds it, and the plan asks which way', async () => {
+ resetAllStores();
+ seedStore(useTripStore, { assignments: { '7': [{ id: 70, day_id: 7, place_id: 42 }] } as never });
+ const handleAssignToDay = vi.fn().mockResolvedValue(true);
+ const stageStops = ['stop-a', 'stop-b', 'stop-c'].map((key) => ({ key, lat: 48, lng: 11 }));
+ const planner = mobilePlanner({
+ handleAssignToDay,
+ tours: [{ place_id: 42, name: 'Ridge walk', stage_stops: stageStops }] as never,
+ });
+ const { shell } = renderDayPicker(planner);
+ const dayOne = screen.getByRole('button', { name: /Day one/ });
+ expect(dayOne).toBeEnabled();
+ fireEvent.click(dayOne);
+ // No way is passed, so the plan opens the choice; on this day only the stages are left.
+ expect(handleAssignToDay).toHaveBeenCalledWith(42, 7);
+ await waitFor(() => expect(shell.closeSheet).toHaveBeenCalledOnce());
+ });
+
it('leaves ordinary Place day choices enabled and preserves their assignment write behavior', () => {
resetAllStores();
const place = { ...tourPlace(), tour_place_id: undefined };
diff --git a/shared/src/i18n/ar/tours.ts b/shared/src/i18n/ar/tours.ts
index 12924376b..1120b5a39 100644
--- a/shared/src/i18n/ar/tours.ts
+++ b/shared/src/i18n/ar/tours.ts
@@ -1450,6 +1450,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': 'تنتهي الرحلة بعد المرحلة {last}. تبقى المراحل التالية بلا يوم.',
'tours.stages.placed': 'المراحل بدءًا من اليوم {from}.',
'tours.stages.placedReplaced': 'لم تعد الجولة كاملة في اليوم {list}.',
+ 'tours.stages.placedReplacedMany': 'لم تعد الجولة كاملة في الأيام {list}.',
'tours.stages.placeFailed': 'تعذّر وضع كل مرحلة في يومها. التراجع يعيد ما تم بالفعل.',
'tours.stages.placeUndo': 'توزيع المراحل على الأيام',
'tours.estimate.label': 'الوقت المقدَّر',
diff --git a/shared/src/i18n/az/tours.ts b/shared/src/i18n/az/tours.ts
index d44d924ab..1adc16a29 100644
--- a/shared/src/i18n/az/tours.ts
+++ b/shared/src/i18n/az/tours.ts
@@ -1392,6 +1392,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Bütün tur artıq bu günlərdə deyil: {list}.',
'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',
diff --git a/shared/src/i18n/br/tours.ts b/shared/src/i18n/br/tours.ts
index befad2018..efbff802c 100644
--- a/shared/src/i18n/br/tours.ts
+++ b/shared/src/i18n/br/tours.ts
@@ -1406,6 +1406,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'O roteiro completo não está mais nos dias {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',
diff --git a/shared/src/i18n/ca/tours.ts b/shared/src/i18n/ca/tours.ts
index 4340140cd..772256ded 100644
--- a/shared/src/i18n/ca/tours.ts
+++ b/shared/src/i18n/ca/tours.ts
@@ -1413,6 +1413,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'La ruta sencera ja no és als dies {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',
diff --git a/shared/src/i18n/cs/tours.ts b/shared/src/i18n/cs/tours.ts
index 6ed02a4e0..1c8fffdc6 100644
--- a/shared/src/i18n/cs/tours.ts
+++ b/shared/src/i18n/cs/tours.ts
@@ -1396,6 +1396,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Celá trasa už není ve dnech {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',
diff --git a/shared/src/i18n/de/tours.ts b/shared/src/i18n/de/tours.ts
index 979e65c55..758cfca0b 100644
--- a/shared/src/i18n/de/tours.ts
+++ b/shared/src/i18n/de/tours.ts
@@ -1424,6 +1424,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Die ganze Tour liegt nicht mehr an den Tagen {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',
diff --git a/shared/src/i18n/en/tours.ts b/shared/src/i18n/en/tours.ts
index 6c677067e..0cc4f117a 100644
--- a/shared/src/i18n/en/tours.ts
+++ b/shared/src/i18n/en/tours.ts
@@ -1378,6 +1378,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'The whole tour is no longer on days {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',
diff --git a/shared/src/i18n/es/tours.ts b/shared/src/i18n/es/tours.ts
index fabe6ec5c..588776f2d 100644
--- a/shared/src/i18n/es/tours.ts
+++ b/shared/src/i18n/es/tours.ts
@@ -1406,6 +1406,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'La ruta completa ya no está en los días {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',
diff --git a/shared/src/i18n/et/tours.ts b/shared/src/i18n/et/tours.ts
index 092f5e887..4558916b6 100644
--- a/shared/src/i18n/et/tours.ts
+++ b/shared/src/i18n/et/tours.ts
@@ -1386,6 +1386,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Kogu matk pole enam päevadel {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',
diff --git a/shared/src/i18n/fr/tours.ts b/shared/src/i18n/fr/tours.ts
index b5f931c3c..47d4cb1e6 100644
--- a/shared/src/i18n/fr/tours.ts
+++ b/shared/src/i18n/fr/tours.ts
@@ -1433,6 +1433,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'L’itinéraire complet n’est plus sur les jours {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é',
diff --git a/shared/src/i18n/gr/tours.ts b/shared/src/i18n/gr/tours.ts
index 7d54166ec..46c90a3dd 100644
--- a/shared/src/i18n/gr/tours.ts
+++ b/shared/src/i18n/gr/tours.ts
@@ -1435,6 +1435,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': 'Το ταξίδι τελειώνει μετά το σκέλος {last}. Τα επόμενα σκέλη μένουν χωρίς ημέρα.',
'tours.stages.placed': 'Σκέλη από την ημέρα {from}.',
'tours.stages.placedReplaced': 'Όλη η διαδρομή δεν είναι πια στην ημέρα {list}.',
+ 'tours.stages.placedReplacedMany': 'Όλη η διαδρομή δεν είναι πια στις ημέρες {list}.',
'tours.stages.placeFailed': 'Δεν μπήκε κάθε σκέλος στην ημέρα του. Η αναίρεση επαναφέρει ό,τι έγινε ήδη.',
'tours.stages.placeUndo': 'Τα σκέλη μοιράστηκαν σε ημέρες',
'tours.estimate.label': 'Εκτιμώμενος χρόνος',
diff --git a/shared/src/i18n/hu/tours.ts b/shared/src/i18n/hu/tours.ts
index 4ce3e248d..4e2fbc91e 100644
--- a/shared/src/i18n/hu/tours.ts
+++ b/shared/src/i18n/hu/tours.ts
@@ -1411,6 +1411,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'A teljes túra lekerült ezekről a napokról: {list}.',
'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',
diff --git a/shared/src/i18n/id/tours.ts b/shared/src/i18n/id/tours.ts
index 418254634..acbbab520 100644
--- a/shared/src/i18n/id/tours.ts
+++ b/shared/src/i18n/id/tours.ts
@@ -1387,6 +1387,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': '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',
diff --git a/shared/src/i18n/it/tours.ts b/shared/src/i18n/it/tours.ts
index 0f4f19b52..918a1925e 100644
--- a/shared/src/i18n/it/tours.ts
+++ b/shared/src/i18n/it/tours.ts
@@ -1418,6 +1418,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Il tour completo non è più nei giorni {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',
diff --git a/shared/src/i18n/ja/tours.ts b/shared/src/i18n/ja/tours.ts
index fb9766550..3ba9e23fa 100644
--- a/shared/src/i18n/ja/tours.ts
+++ b/shared/src/i18n/ja/tours.ts
@@ -1352,6 +1352,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': '旅行はステージ {last} の後で終わります。それ以降のステージは日なしのままです。',
'tours.stages.placed': '{from}日目からステージを配置しました。',
'tours.stages.placedReplaced': 'ツアー全体は {list}日目から外れました。',
+ 'tours.stages.placedReplacedMany': 'ツアー全体は {list} 日目から外れました。',
'tours.stages.placeFailed': '一部のステージを日に入れられませんでした。元に戻すと、行った変更を取り消せます。',
'tours.stages.placeUndo': 'ステージを日ごとに配置',
'tours.estimate.label': '推定時間',
diff --git a/shared/src/i18n/ko/tours.ts b/shared/src/i18n/ko/tours.ts
index 5941f7495..8dde2fbd1 100644
--- a/shared/src/i18n/ko/tours.ts
+++ b/shared/src/i18n/ko/tours.ts
@@ -1348,6 +1348,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': '여행이 {last}구간 뒤에 끝납니다. 그 뒤 구간은 날짜 없이 남습니다.',
'tours.stages.placed': '{from}일차부터 구간을 배치했습니다.',
'tours.stages.placedReplaced': '전체 투어가 더 이상 {list}일차에 없습니다.',
+ 'tours.stages.placedReplacedMany': '전체 투어가 더 이상 {list}일차에 없습니다.',
'tours.stages.placeFailed': '일부 구간을 해당 날에 넣지 못했습니다. 실행 취소로 이미 한 변경을 되돌릴 수 있습니다.',
'tours.stages.placeUndo': '구간을 날짜별로 배치',
'tours.estimate.label': '예상 시간',
diff --git a/shared/src/i18n/nl/tours.ts b/shared/src/i18n/nl/tours.ts
index f44e3dc89..c0d23a20d 100644
--- a/shared/src/i18n/nl/tours.ts
+++ b/shared/src/i18n/nl/tours.ts
@@ -1413,6 +1413,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'De hele tocht staat niet meer op de dagen {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',
diff --git a/shared/src/i18n/pl/tours.ts b/shared/src/i18n/pl/tours.ts
index 545203812..2e0479b87 100644
--- a/shared/src/i18n/pl/tours.ts
+++ b/shared/src/i18n/pl/tours.ts
@@ -1447,6 +1447,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Cała trasa nie jest już w dniach {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',
diff --git a/shared/src/i18n/ru/tours.ts b/shared/src/i18n/ru/tours.ts
index e1a171644..92f5dd2c5 100644
--- a/shared/src/i18n/ru/tours.ts
+++ b/shared/src/i18n/ru/tours.ts
@@ -1453,6 +1453,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': 'Поездка заканчивается после этапа {last}. Следующие этапы останутся без дня.',
'tours.stages.placed': 'Этапы начиная со дня {from}.',
'tours.stages.placedReplaced': 'Весь маршрут убран из дня {list}.',
+ 'tours.stages.placedReplacedMany': 'Весь маршрут убран из дней {list}.',
'tours.stages.placeFailed': 'Не все этапы удалось назначить на свои дни. Отмена вернёт то, что уже сделано.',
'tours.stages.placeUndo': 'Этапы распределены по дням',
'tours.estimate.label': 'Расчётное время',
diff --git a/shared/src/i18n/sk/tours.ts b/shared/src/i18n/sk/tours.ts
index 778ee4771..e380fe44a 100644
--- a/shared/src/i18n/sk/tours.ts
+++ b/shared/src/i18n/sk/tours.ts
@@ -1400,6 +1400,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Celá trasa už nie je v dňoch {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',
diff --git a/shared/src/i18n/sv/tours.ts b/shared/src/i18n/sv/tours.ts
index a0e69747f..22886afde 100644
--- a/shared/src/i18n/sv/tours.ts
+++ b/shared/src/i18n/sv/tours.ts
@@ -1382,6 +1382,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Hela turen ligger inte längre på dagarna {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',
diff --git a/shared/src/i18n/th/tours.ts b/shared/src/i18n/th/tours.ts
index b6b7f076b..3c3ebba42 100644
--- a/shared/src/i18n/th/tours.ts
+++ b/shared/src/i18n/th/tours.ts
@@ -1327,6 +1327,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': 'ทริปจบหลังช่วงที่ {last} ช่วงหลังจากนั้นจะยังไม่มีวัน',
'tours.stages.placed': 'ช่วงต่าง ๆ ตั้งแต่วันที่ {from}',
'tours.stages.placedReplaced': 'ทั้งเส้นทางไม่ได้อยู่ในวันที่ {list} แล้ว',
+ 'tours.stages.placedReplacedMany': 'ทั้งเส้นทางไม่ได้อยู่ในวันที่ {list} แล้ว',
'tours.stages.placeFailed': 'ใส่บางช่วงลงในวันของมันไม่ได้ การเลิกทำจะย้อนสิ่งที่ทำไปแล้ว',
'tours.stages.placeUndo': 'แบ่งช่วงลงในวันต่าง ๆ แล้ว',
'tours.estimate.label': 'เวลาโดยประมาณ',
diff --git a/shared/src/i18n/tours-locales.spec.ts b/shared/src/i18n/tours-locales.spec.ts
index fb9aae727..c5f3354b0 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: 1277,
+ generalKeyCount: 1278,
modules: toursModules,
},
{
diff --git a/shared/src/i18n/tr/tours.ts b/shared/src/i18n/tr/tours.ts
index a5432cdf7..9ff11256a 100644
--- a/shared/src/i18n/tr/tours.ts
+++ b/shared/src/i18n/tr/tours.ts
@@ -1390,6 +1390,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Tüm tur artık şu günlerde değil: {list}.',
'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',
diff --git a/shared/src/i18n/uk/tours.ts b/shared/src/i18n/uk/tours.ts
index 19655fa52..75865b767 100644
--- a/shared/src/i18n/uk/tours.ts
+++ b/shared/src/i18n/uk/tours.ts
@@ -1438,6 +1438,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': 'Подорож закінчується після етапу {last}. Наступні етапи залишаться без дня.',
'tours.stages.placed': 'Етапи починаючи з дня {from}.',
'tours.stages.placedReplaced': 'Увесь маршрут прибрано з дня {list}.',
+ 'tours.stages.placedReplacedMany': 'Увесь маршрут прибрано з днів {list}.',
'tours.stages.placeFailed': 'Не всі етапи вдалося призначити на їхні дні. Скасування поверне те, що вже зроблено.',
'tours.stages.placeUndo': 'Етапи розподілено по днях',
'tours.estimate.label': 'Орієнтовний час',
diff --git a/shared/src/i18n/vi/tours.ts b/shared/src/i18n/vi/tours.ts
index 0d22ca399..ca420a5de 100644
--- a/shared/src/i18n/vi/tours.ts
+++ b/shared/src/i18n/vi/tours.ts
@@ -1372,6 +1372,7 @@ const tours: TranslationStrings = {
'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.placedReplacedMany': 'Cả hành trình không còn ở các 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',
diff --git a/shared/src/i18n/zh-TW/tours.ts b/shared/src/i18n/zh-TW/tours.ts
index 8ae5c5d8b..6e82666db 100644
--- a/shared/src/i18n/zh-TW/tours.ts
+++ b/shared/src/i18n/zh-TW/tours.ts
@@ -1290,6 +1290,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': '行程在第 {last} 階段之後結束。之後的階段暫無日期。',
'tours.stages.placed': '已從第 {from} 天起安排各階段。',
'tours.stages.placedReplaced': '整條路線已不在第 {list} 天。',
+ 'tours.stages.placedReplacedMany': '整條路線已不在第 {list} 天。',
'tours.stages.placeFailed': '並非所有階段都排進了對應的日期。復原可還原已完成的部分。',
'tours.stages.placeUndo': '已按天安排各階段',
'tours.estimate.label': '預估時間',
diff --git a/shared/src/i18n/zh/tours.ts b/shared/src/i18n/zh/tours.ts
index 05f92b67d..2414389fd 100644
--- a/shared/src/i18n/zh/tours.ts
+++ b/shared/src/i18n/zh/tours.ts
@@ -1291,6 +1291,7 @@ const tours: TranslationStrings = {
'tours.stages.placeStagesShort': '行程在第 {last} 阶段之后结束。之后的阶段暂无日期。',
'tours.stages.placed': '已从第 {from} 天起安排各阶段。',
'tours.stages.placedReplaced': '整条路线已不在第 {list} 天。',
+ 'tours.stages.placedReplacedMany': '整条路线已不在第 {list} 天。',
'tours.stages.placeFailed': '并非所有阶段都排进了对应的日期。撤销可还原已完成的部分。',
'tours.stages.placeUndo': '已按天安排各阶段',
'tours.estimate.label': '预计用时',