mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 22:57:32 +00:00
feat(assistant): road trip, charging, corridor and transit cards
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
import type { ChargingCard as ChargingCardData } from '@trek/shared';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { ChargingBadges } from '../../../Roadtrip/ChargingInfo';
|
||||
import { CardFacts } from '../parts/CardFacts';
|
||||
import CardFrame from '../parts/CardFrame';
|
||||
import { CardRow, CardRows } from '../parts/CardRows';
|
||||
import { useCardFormat } from '../parts/useCardFormat';
|
||||
import ServiceDisc from './ServiceDisc';
|
||||
import { useRoadtripCardMap } from './useRoadtripCardMap';
|
||||
|
||||
/**
|
||||
* A charger as one look at it found it: the planner's own two badges (free
|
||||
* points, the cheapest energy price) drawn from the snapshot, never asked
|
||||
* again in the chat, how many other prices it publishes, when it was
|
||||
* checked, and where the figures come from, since the source asks to be
|
||||
* named. A charger on a stop the drive card shows sits in that stop's row
|
||||
* instead (`ChargerBadges`), which says when it was
|
||||
* checked when pointed at. A count stays green for as long as the planner
|
||||
* keeps one green, two minutes; an older one is shown in the neutral colour,
|
||||
* with the day it was checked when that was not today.
|
||||
*/
|
||||
|
||||
/** How long a free count reads as current, as in the planner. */
|
||||
const FRESH_MS = 120_000;
|
||||
|
||||
/** What an unknown availability reads as: an old figure, or none to trust. */
|
||||
const NOT_KNOWN = {
|
||||
stale: { labelKey: 'roadtrip.charging.stale' },
|
||||
unknown: { labelKey: 'roadtrip.charging.unknown' },
|
||||
} as const;
|
||||
|
||||
const two = (value: number) => String(value).padStart(2, '0');
|
||||
|
||||
/** The local clock of a moment, `HH:MM`. */
|
||||
function localClock(instant: string): string {
|
||||
const date = new Date(instant);
|
||||
return `${two(date.getHours())}:${two(date.getMinutes())}`;
|
||||
}
|
||||
|
||||
/** The local day of a moment, `YYYY-MM-DD`. */
|
||||
function localDay(at: number): string {
|
||||
const date = new Date(at);
|
||||
return `${date.getFullYear()}-${two(date.getMonth() + 1)}-${two(date.getDate())}`;
|
||||
}
|
||||
|
||||
/** The moment a check happened as the user reads it: its clock, after its day when that is not today. */
|
||||
function useCheckedTime(instant: string | null) {
|
||||
const format = useCardFormat();
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
const left = instant ? Date.parse(instant) + FRESH_MS - now : Number.NaN;
|
||||
// Turns the count neutral the moment it ages past two minutes.
|
||||
useEffect(() => {
|
||||
if (!(left > 0)) return undefined;
|
||||
const timer = window.setTimeout(() => setNow(Date.now()), left + 50);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [left]);
|
||||
if (!instant) return { fresh: false, time: null };
|
||||
const clock = format.clock(localClock(instant));
|
||||
const day = localDay(Date.parse(instant));
|
||||
return { fresh: left > 0, time: day === localDay(now) ? clock : `${format.date(day)} ${clock}` };
|
||||
}
|
||||
|
||||
/** The planner's charger badges, from the card's snapshot, with when it was taken. */
|
||||
export function ChargerBadges({ card }: { card: ChargingCardData }) {
|
||||
const { t } = useTranslation();
|
||||
const checked = useCheckedTime(card.checkedAt);
|
||||
const known = card.status === 'ok' && card.available !== null && !card.stale;
|
||||
const status = known
|
||||
? `${card.available}/${card.total} ${t('roadtrip.charging.available')}`
|
||||
: t(NOT_KNOWN[card.stale ? 'stale' : 'unknown'].labelKey);
|
||||
const label = checked.time
|
||||
? `${status} (${t('assistant.card.roadtrip.charging.checked', { time: checked.time })})`
|
||||
: status;
|
||||
const energy = card.energy ? { price: card.energy.amount, currency: card.energy.currency } : null;
|
||||
return (
|
||||
<ChargingBadges
|
||||
label={label}
|
||||
known={known}
|
||||
fresh={checked.fresh}
|
||||
available={card.available}
|
||||
total={card.total}
|
||||
energy={energy}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ChargingCard({ toolCallId, card }: { toolCallId: string; card: ChargingCardData }) {
|
||||
const { t } = useTranslation();
|
||||
const format = useCardFormat();
|
||||
const checked = useCheckedTime(card.checkedAt);
|
||||
const map = useRoadtripCardMap();
|
||||
const title = card.name ?? card.station ?? t('roadtrip.poi.charging');
|
||||
const where = card.placeId ? { placeId: card.placeId } : {};
|
||||
const { lat, lng } = card;
|
||||
const point = lat !== null && lng !== null ? { ref: toolCallId, lat, lng, name: title, ...where } : null;
|
||||
const source = card.source
|
||||
? card.license
|
||||
? t('assistant.card.roadtrip.charging.source', { source: card.source, license: card.license })
|
||||
: t('assistant.card.roadtrip.charging.sourceOnly', { source: card.source })
|
||||
: null;
|
||||
return (
|
||||
<CardFrame label={t('roadtrip.poi.charging')}>
|
||||
<CardRows>
|
||||
<CardRow
|
||||
lead={<ServiceDisc category="charging" />}
|
||||
title={<bdi title={title}>{title}</bdi>}
|
||||
facts={
|
||||
<CardFacts>
|
||||
<ChargerBadges card={card} />
|
||||
{card.otherPrices > 0 && (
|
||||
<span className="text-caption text-content-muted">
|
||||
{t('assistant.card.roadtrip.charging.otherPrices', { count: card.otherPrices })}
|
||||
</span>
|
||||
)}
|
||||
{checked.time && (
|
||||
<span className={`text-caption ${card.stale ? 'text-warning' : 'text-content-muted'}`}>
|
||||
{t('assistant.card.roadtrip.charging.checked', { time: checked.time })}
|
||||
</span>
|
||||
)}
|
||||
</CardFacts>
|
||||
}
|
||||
onActivate={point ? () => map.showPoint(point) : undefined}
|
||||
onHover={point ? (on) => map.hoverPoint(on ? point : null) : undefined}
|
||||
/>
|
||||
</CardRows>
|
||||
<p className="m-0 mt-1 text-caption text-content-faint">
|
||||
{source && <bdi>{source}</bdi>}
|
||||
{card.updatedAt && (
|
||||
<span className="ms-1">
|
||||
{t('assistant.card.roadtrip.charging.updated', { time: format.clock(localClock(card.updatedAt)) })}
|
||||
</span>
|
||||
)}
|
||||
<span className="ms-1">{t('roadtrip.charging.note')}</span>
|
||||
</p>
|
||||
</CardFrame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
import type { CorridorCard as CorridorCardData, CorridorCardHit } from '@trek/shared';
|
||||
import { ArrowRight, Route, Search } from 'lucide-react';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { useSettingsStore } from '../../../../store/settingsStore';
|
||||
import { formatDistance } from '../../../../utils/units';
|
||||
import { SoftPill } from '../../../Planner/planParts';
|
||||
import { alongLabel, offRouteLabel } from '../../../Roadtrip/corridorSearchModel';
|
||||
import { CORRIDOR_CATEGORY_BY_KEY } from '../../../Roadtrip/stopKinds';
|
||||
import { TourNotice } from '../../../Tours/tourParts';
|
||||
import type { CardEntry } from '../cardTypes';
|
||||
import { CardFacts } from '../parts/CardFacts';
|
||||
import CardFrame from '../parts/CardFrame';
|
||||
import CardHeader from '../parts/CardHeader';
|
||||
import { CardOpenButton } from '../parts/CardOpen';
|
||||
import { CardMore, CardRow, CardRows } from '../parts/CardRows';
|
||||
import { roadtripTarget } from './roadtripLook';
|
||||
import ServiceDisc from './ServiceDisc';
|
||||
import { useRoadtripCardMap } from './useRoadtripCardMap';
|
||||
|
||||
/**
|
||||
* What a corridor search found along a day's drive, worded as the planner's
|
||||
* corridor panel words it: each hit with its category's icon in its tint,
|
||||
* how far off the road and how far into the drive it lies, the two stops it
|
||||
* lies between and, for a charger, its sockets. Resting on a hit shows its
|
||||
* pin, a click moves the map there. A search that is not done says how much
|
||||
* of the road it covered.
|
||||
*/
|
||||
|
||||
/** Socket names as drivers know them; any other is spelled from its key. */
|
||||
const SOCKET_NAMES: Readonly<Record<string, string>> = { ccs: 'CCS', type2_combo: 'CCS', chademo: 'CHAdeMO' };
|
||||
|
||||
function socketName(type: string): string {
|
||||
const known = SOCKET_NAMES[type];
|
||||
if (known) return known;
|
||||
const words = type.replace(/_/g, ' ');
|
||||
return words.charAt(0).toUpperCase() + words.slice(1);
|
||||
}
|
||||
|
||||
function HitFacts({ hit }: { hit: CorridorCardHit }) {
|
||||
const { t } = useTranslation();
|
||||
const unit = useSettingsStore((s) => s.settings.distance_unit ?? 'metric');
|
||||
return (
|
||||
<CardFacts>
|
||||
<SoftPill icon={<Route size={10} aria-hidden="true" className="text-content-faint" />}>
|
||||
{alongLabel(hit.alongKm, unit, t)}
|
||||
</SoftPill>
|
||||
<SoftPill>{offRouteLabel(hit.offKm, unit, t)}</SoftPill>
|
||||
{hit.between && (
|
||||
<SoftPill className="max-w-full">
|
||||
<bdi className="truncate">{hit.between[0]}</bdi>
|
||||
<ArrowRight size={9} aria-hidden="true" className="flex-none text-content-faint rtl:-scale-x-100" />
|
||||
<bdi className="truncate">{hit.between[1]}</bdi>
|
||||
</SoftPill>
|
||||
)}
|
||||
{hit.sockets.map((socket) => (
|
||||
<SoftPill key={socket.type} className="tabular-nums">
|
||||
{socketName(socket.type)}
|
||||
{socket.kw !== null && ` ${socket.kw} kW`}
|
||||
{socket.count !== null && socket.count > 1 && ` ×${socket.count}`}
|
||||
</SoftPill>
|
||||
))}
|
||||
</CardFacts>
|
||||
);
|
||||
}
|
||||
|
||||
function CorridorCardView({ card }: { card: CorridorCardData }) {
|
||||
const { t } = useTranslation();
|
||||
const unit = useSettingsStore((s) => s.settings.distance_unit ?? 'metric');
|
||||
const map = useRoadtripCardMap();
|
||||
const category = CORRIDOR_CATEGORY_BY_KEY[card.category];
|
||||
const target = roadtripTarget({ dayId: card.dayId });
|
||||
const kind = t(category?.labelKey ?? 'roadtrip.window.onRoute');
|
||||
return (
|
||||
<CardFrame label={t('roadtrip.window.onRoute')}>
|
||||
<CardHeader
|
||||
icon={category?.Icon ?? Search}
|
||||
tone="info"
|
||||
title={t('roadtrip.window.onRoute')}
|
||||
count={card.hits.length + card.more}
|
||||
meta={
|
||||
<span className="flex flex-wrap items-center gap-1">
|
||||
<SoftPill>{t('roadtrip.day', { number: card.dayNumber })}</SoftPill>
|
||||
<SoftPill>{kind}</SoftPill>
|
||||
</span>
|
||||
}
|
||||
actions={<CardOpenButton target={target} labelKey="assistant.card.roadtrip.open" />}
|
||||
/>
|
||||
{card.hits.length === 0 ? (
|
||||
<p className="m-0 mt-2 text-caption text-content-muted">
|
||||
{t('assistant.card.roadtrip.corridor.none', { distance: formatDistance(card.widthKm, unit) })}
|
||||
</p>
|
||||
) : (
|
||||
<CardRows>
|
||||
{card.hits.map((hit) => {
|
||||
const name = hit.name ?? hit.brand ?? kind;
|
||||
const point = { ref: hit.ref, lat: hit.lat, lng: hit.lng, name };
|
||||
return (
|
||||
<CardRow
|
||||
key={hit.ref}
|
||||
lead={<ServiceDisc category={card.category} />}
|
||||
title={<bdi title={name}>{name}</bdi>}
|
||||
facts={<HitFacts hit={hit} />}
|
||||
onActivate={() => map.showPoint(point)}
|
||||
onHover={(on) => map.hoverPoint(on ? point : null)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardRows>
|
||||
)}
|
||||
<CardMore count={card.more} labelKey="assistant.card.roadtrip.corridor.more" target={target} />
|
||||
{card.partial && (
|
||||
<div className="mt-2">
|
||||
<TourNotice tone="warning" role="status">
|
||||
{t('assistant.card.roadtrip.corridor.partial', { count: card.searched.total, done: card.searched.done })}
|
||||
</TourNotice>
|
||||
</div>
|
||||
)}
|
||||
</CardFrame>
|
||||
);
|
||||
}
|
||||
|
||||
/** The corridor searches of one answer, one card each. */
|
||||
export default function CorridorCard({ cards }: { cards: readonly CardEntry[] }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{cards.map(({ toolCallId, card }) =>
|
||||
card.kind === 'corridor' ? <CorridorCardView key={toolCallId} card={card} /> : null
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import type { DayRouteCard } from '@trek/shared';
|
||||
import { MapPinPlus, Spline, Waypoints } from 'lucide-react';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { SoftPill } from '../../../Planner/planParts';
|
||||
import { TourNotice } from '../../../Tours/tourParts';
|
||||
import type { ChangeItem } from '../../assistantParts';
|
||||
import { useAssistantView } from '../../assistantViewContext';
|
||||
import { CardFacts, Fact } from '../parts/CardFacts';
|
||||
import RouteSketch from '../parts/RouteSketch';
|
||||
import { dayRouteSketch } from './roadtripCardModel';
|
||||
import { useRoadtripCardMap } from './useRoadtripCardMap';
|
||||
|
||||
/**
|
||||
* What a change does to a day's drive, under its change row: the day's stops
|
||||
* joined by straight dashed lines, the stops it adds and the via points it
|
||||
* sends the drive through, moves, takes out or pins again, marked as the map
|
||||
* marks them. Straight on purpose, and it says so: TREK works out the road
|
||||
* once the change is applied. Waiting, the new marks are dashed; applied,
|
||||
* solid; discarded or expired, the whole sketch fades.
|
||||
*/
|
||||
export default function DayRouteBody({ card, item }: { card: DayRouteCard; item: ChangeItem }) {
|
||||
const { t } = useTranslation();
|
||||
const { variant } = useAssistantView();
|
||||
const map = useRoadtripCardMap();
|
||||
const pending = item.state === 'pending' || item.state === 'applying';
|
||||
const settled = item.state === 'discarded' || item.state === 'expired' || item.state === 'failed';
|
||||
const { lines, marks } = dayRouteSketch(card, pending);
|
||||
const points = [...card.stops, ...card.vias].map((spot): [number, number] => [spot.lat, spot.lng]);
|
||||
const added = card.stops.filter((stop) => stop.added);
|
||||
const vias = card.vias.filter((via) => via.state !== 'removed').length;
|
||||
const removed = card.vias.length - vias;
|
||||
return (
|
||||
<div className={`mt-1.5 flex flex-col gap-1.5 ${settled ? 'opacity-50' : ''}`}>
|
||||
<RouteSketch
|
||||
lines={lines}
|
||||
marks={marks}
|
||||
height={variant === 'fullscreen' ? 128 : 96}
|
||||
ariaLabel={t('assistant.card.roadtrip.sketch')}
|
||||
onActivate={points.length > 0 ? () => map.showPoints(points) : undefined}
|
||||
/>
|
||||
<CardFacts>
|
||||
{vias > 0 && <Fact icon={Waypoints} label={t('assistant.card.roadtrip.dayRoute.vias', { count: vias })} />}
|
||||
{removed > 0 && (
|
||||
<SoftPill tone="danger">{t('assistant.card.roadtrip.dayRoute.removed', { count: removed })}</SoftPill>
|
||||
)}
|
||||
{card.afterName && (
|
||||
<SoftPill className="max-w-full">
|
||||
<bdi className="truncate">{t('assistant.card.roadtrip.dayRoute.after', { name: card.afterName })}</bdi>
|
||||
</SoftPill>
|
||||
)}
|
||||
{card.track && (
|
||||
<Fact icon={Spline} label={t('assistant.card.roadtrip.dayRoute.follows', { name: card.track })} />
|
||||
)}
|
||||
{added.length > 0 && (
|
||||
<Fact icon={MapPinPlus} label={t('assistant.card.roadtrip.dayRoute.newStops', { count: added.length })} />
|
||||
)}
|
||||
</CardFacts>
|
||||
{added.length > 0 && (
|
||||
<span className="flex flex-wrap items-center gap-1">
|
||||
{added.map((stop, index) => (
|
||||
<SoftPill key={`${stop.name}:${index}`} tone={pending ? 'success' : 'neutral'} className="max-w-full">
|
||||
<span className="tabular-nums text-content-faint">{index + 1}</span>
|
||||
<bdi className="truncate">{stop.name}</bdi>
|
||||
</SoftPill>
|
||||
))}
|
||||
</span>
|
||||
)}
|
||||
{card.unresolved.length > 0 && (
|
||||
<TourNotice tone="warning">
|
||||
<span className="block">
|
||||
{t('assistant.card.roadtrip.dayRoute.unresolved', { count: card.unresolved.length })}
|
||||
</span>
|
||||
<bdi className="block">{card.unresolved.join(', ')}</bdi>
|
||||
</TourNotice>
|
||||
)}
|
||||
<p className="m-0 text-caption text-content-faint">{t('assistant.card.roadtrip.dayRoute.sketch')}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import type { RoadtripCardDay } from '@trek/shared';
|
||||
import type { RoadtripDay } from '@trek/shared/roadtrip';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { dayColor } from '../../../Roadtrip/dayColors';
|
||||
import { DayTile } from '../../../Roadtrip/RoadtripSidebarHeaders';
|
||||
import { useAssistantView } from '../../assistantViewContext';
|
||||
import { useCardFormat } from '../parts/useCardFormat';
|
||||
import { dayHasWarning } from './roadtripCardModel';
|
||||
|
||||
/**
|
||||
* The days of a drive as a row of chips, each the planner's day tile with
|
||||
* how far that day drives (or "No drive"), a small dot where something on it
|
||||
* needs a look. A tap shows that day's rail below; resting on a chip draws
|
||||
* that day's drive over the plan.
|
||||
*/
|
||||
export default function DriveDayStrip({
|
||||
days,
|
||||
tiles,
|
||||
selected,
|
||||
dayColors,
|
||||
onSelect,
|
||||
onHover,
|
||||
}: {
|
||||
days: readonly RoadtripCardDay[];
|
||||
/** The same days as the planner's day tile reads them. */
|
||||
tiles: readonly RoadtripDay[];
|
||||
selected: number;
|
||||
dayColors: boolean;
|
||||
onSelect: (index: number) => void;
|
||||
onHover: (day: RoadtripCardDay | null) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { variant } = useAssistantView();
|
||||
const format = useCardFormat();
|
||||
const warning = t('assistant.card.roadtrip.dayWarning');
|
||||
const tall = variant === 'fullscreen' ? 'min-h-11' : '';
|
||||
return (
|
||||
<ul
|
||||
aria-label={t('assistant.card.roadtrip.days')}
|
||||
className="trek-assistant-strip -mx-3 mt-2 flex list-none gap-1.5 overflow-x-auto px-3 pb-1 pt-0.5"
|
||||
>
|
||||
{days.map((day, index) => {
|
||||
const tile = tiles[index];
|
||||
const active = index === selected;
|
||||
const look = active ? 'bg-surface-card ring-1 ring-edge' : 'bg-surface-secondary hover:bg-surface-hover';
|
||||
return (
|
||||
<li key={day.dayId} className="flex-none">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onSelect(index)}
|
||||
onMouseEnter={() => onHover(day)}
|
||||
onMouseLeave={() => onHover(null)}
|
||||
onFocus={() => onHover(day)}
|
||||
onBlur={() => onHover(null)}
|
||||
aria-pressed={active}
|
||||
className={`relative flex items-center gap-1.5 rounded-xl p-1 pe-2 transition-colors ${tall} ${look}`}
|
||||
>
|
||||
{tile && <DayTile day={tile} tint={dayColors ? dayColor(day.dayNumber).line : null} />}
|
||||
<span className="whitespace-nowrap text-caption tabular-nums text-content-muted">
|
||||
{day.legs.length > 0 ? format.distance(day.distanceM / 1000) : t('assistant.card.roadtrip.noDrive')}
|
||||
</span>
|
||||
{dayHasWarning(day) && (
|
||||
<span
|
||||
role="img"
|
||||
aria-label={warning}
|
||||
title={warning}
|
||||
className="absolute end-1 top-1 h-1.5 w-1.5 rounded-full bg-warning"
|
||||
/>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
* FE-AI-RT-010 to FE-AI-RT-016
|
||||
*
|
||||
* The drive in the chat is the road trip's own card: its totals as badges,
|
||||
* the days as a strip that switches the rail below, the chosen day as the
|
||||
* planner's day card with its rows and findings but none of its controls, a
|
||||
* charger checked beside it in the row of its stop, the ways of driving it
|
||||
* an answer worked out to pick from, what the totals leave out said, the
|
||||
* day the chat was opened on chosen first and where the battery runs dry.
|
||||
*/
|
||||
import type { TrekCard } from '@trek/shared';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { charger, DRIVE, FLORENCE_DAY, MUNICH_DAY } from '../../../../../tests/helpers/assistantRoadtrip';
|
||||
import { fireEvent, render, screen } from '../../../../../tests/helpers/render';
|
||||
import { useAssistantStore } from '../../../../store/assistantStore';
|
||||
import { type AssistantView, AssistantViewContext } from '../../assistantViewContext';
|
||||
import RoadtripBlock from './RoadtripBlock';
|
||||
|
||||
vi.mock('../../../../hooks/useElementSize', () => ({
|
||||
useElementSize: () => ({ ref: () => undefined, width: 0, height: 0 }),
|
||||
}));
|
||||
|
||||
const INITIAL = useAssistantStore.getState();
|
||||
|
||||
afterEach(() => {
|
||||
useAssistantStore.setState(INITIAL, true);
|
||||
});
|
||||
|
||||
function renderBlock(cards: { toolCallId: string; card: TrekCard }[], view: Partial<AssistantView> = {}) {
|
||||
const value: AssistantView = { tripId: 4, variant: 'window', onOpen: vi.fn(), ...view };
|
||||
return render(
|
||||
<AssistantViewContext.Provider value={value}>
|
||||
<RoadtripBlock cards={cards} />
|
||||
</AssistantViewContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
describe('RoadtripBlock', () => {
|
||||
it('FE-AI-RT-010: states the totals and draws the chosen day as the planner day card, read only', () => {
|
||||
renderBlock([{ toolCallId: 'call_1', card: DRIVE }]);
|
||||
expect(screen.getByText('7 stops')).toBeInTheDocument();
|
||||
expect(screen.getByText('1 charging stop')).toBeInTheDocument();
|
||||
expect(screen.getByText('Munich to Rome')).toBeInTheDocument();
|
||||
expect(screen.getByText('Ionity Holzkirchen')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('LH 1840').length).toBeGreaterThan(0);
|
||||
expect(screen.getByText('Hotel Roma')).toBeInTheDocument();
|
||||
expect(screen.getByText('2 more stops on this day')).toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: 'Change what kind of stop this is' })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: 'Make it a stop on the way' })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '3 more days in the road trip' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-011: a day of the strip switches the rail and draws its drive over the plan while pointed at', () => {
|
||||
renderBlock([{ toolCallId: 'call_1', card: DRIVE }]);
|
||||
const strip = screen.getByRole('list', { name: 'Days of the drive' });
|
||||
const chips = strip.querySelectorAll('button');
|
||||
expect(chips).toHaveLength(2);
|
||||
expect(chips[0]).toHaveAttribute('aria-pressed', 'true');
|
||||
expect(screen.getByRole('img', { name: 'Something on this day needs a look' })).toBeInTheDocument();
|
||||
fireEvent.mouseEnter(chips[1] as HTMLElement);
|
||||
const preview = useAssistantStore.getState().routePreview;
|
||||
expect(preview).toMatchObject({ tripId: 4, ref: 'call_1', lines: FLORENCE_DAY.lines });
|
||||
fireEvent.mouseLeave(chips[1] as HTMLElement);
|
||||
expect(useAssistantStore.getState().routePreview).toBeNull();
|
||||
fireEvent.click(chips[1] as HTMLElement);
|
||||
expect(screen.getByText('Florence')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Ionity Holzkirchen')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-012: a charger checked beside the drive shows in its stop, one elsewhere stands on its own', () => {
|
||||
renderBlock([
|
||||
{ toolCallId: 'call_1', card: DRIVE },
|
||||
{ toolCallId: 'call_2', card: charger() },
|
||||
{ toolCallId: 'call_3', card: charger({ placeId: null, name: 'Supercharger Chur' }) },
|
||||
]);
|
||||
expect(screen.getAllByText('4/6')).toHaveLength(2);
|
||||
expect(screen.getByText('Supercharger Chur')).toBeInTheDocument();
|
||||
expect(screen.getAllByRole('region', { name: 'Charging' })).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('FE-AI-RT-013: several ways of driving it are rows to pick, and the picked one drives the card', () => {
|
||||
const preview: TrekCard = {
|
||||
...DRIVE,
|
||||
previewKeys: ['roadtrip_hotel_bookends'],
|
||||
days: [FLORENCE_DAY],
|
||||
moreDays: 0,
|
||||
};
|
||||
renderBlock([
|
||||
{ toolCallId: 'call_1', card: DRIVE },
|
||||
{ toolCallId: 'call_2', card: preview },
|
||||
]);
|
||||
const rows = screen.getByRole('list', { name: 'Ways to drive it' }).querySelectorAll('button');
|
||||
expect(rows[0]).toHaveTextContent('Saved settings');
|
||||
expect(rows[1]).toHaveTextContent('Preview: Start and end each day at your stay');
|
||||
expect(screen.getByText('Munich to Rome')).toBeInTheDocument();
|
||||
fireEvent.click(rows[1] as HTMLElement);
|
||||
expect(screen.getByText('Florence')).toBeInTheDocument();
|
||||
expect(screen.getByText('Preview')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-014: says why the totals are not the whole drive, and the bookings on none of the days', () => {
|
||||
const card = { ...DRIVE, complete: false, problem: 'routing' as const, undatedRides: 2, quietDays: 2 };
|
||||
renderBlock([{ toolCallId: 'call_1', card }]);
|
||||
const notice = 'Some legs could not be routed, so these totals are not the whole drive.';
|
||||
expect(screen.getByText(notice)).toBeInTheDocument();
|
||||
expect(screen.getByText('2 bookings are on none of the days')).toBeInTheDocument();
|
||||
expect(screen.getByText('2 days without a drive')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-015: the sketch and the crosshair move the map to the day and the drive; open goes to the road trip', () => {
|
||||
const onOpen = vi.fn();
|
||||
const onFocusDay = vi.fn();
|
||||
renderBlock([{ toolCallId: 'call_1', card: DRIVE }], { onOpen, onFocusDay });
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Show day 1 on the map' }));
|
||||
expect(onFocusDay).toHaveBeenCalledWith(MUNICH_DAY.dayId);
|
||||
expect(useAssistantStore.getState().camera).toMatchObject({ tripId: 4, mode: 'fit', why: 'user' });
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Show the drive on the map' }));
|
||||
expect(useAssistantStore.getState().camera?.points.length).toBe(7);
|
||||
fireEvent.click(screen.getByRole('button', { name: /Open in the road trip/ }));
|
||||
expect(onOpen).toHaveBeenCalledWith({ kind: 'tab', tab: 'roadtrip', params: { day: '31' } });
|
||||
});
|
||||
|
||||
it('FE-AI-RT-016: opens on the day the chat was opened on and says where the battery runs dry', () => {
|
||||
useAssistantStore.setState({ focus: { dayId: FLORENCE_DAY.dayId } });
|
||||
const dry = { ...DRIVE, days: [MUNICH_DAY, { ...FLORENCE_DAY, dryKm: 280 }] };
|
||||
renderBlock([{ toolCallId: 'call_1', card: dry }]);
|
||||
expect(screen.getByText('Florence')).toBeInTheDocument();
|
||||
expect(screen.getByText(/Battery runs out here after 280/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,105 @@
|
||||
import type { RoadtripCard } from '@trek/shared';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { formatDurationShort } from '../../../Roadtrip/roadtripModel';
|
||||
import type { CardEntry } from '../cardTypes';
|
||||
import { useCardFormat } from '../parts/useCardFormat';
|
||||
import ChargingCard from './ChargingCard';
|
||||
import { dayHasWarning, splitDriveEntries } from './roadtripCardModel';
|
||||
import RoadtripDrive from './RoadtripDrive';
|
||||
import { settingLabel } from './roadtripSettings';
|
||||
|
||||
/**
|
||||
* The drives and chargers of one answer. A drive is the road trip's card; an
|
||||
* answer that worked out the drive more than once (the saved settings and a
|
||||
* preview of others) shows one card with a row per way to drive it, and the
|
||||
* picked one drives the sketch, the strip and the rail. Chargers join the
|
||||
* row of their stop where the drive shows it, and stand on their own
|
||||
* otherwise.
|
||||
*/
|
||||
|
||||
/** One way of driving it, as a row to pick: saved or tried, how far and how long, how much to look at. */
|
||||
function VariantRow({
|
||||
card,
|
||||
picked,
|
||||
onPick,
|
||||
}: {
|
||||
card: RoadtripCard;
|
||||
picked: boolean;
|
||||
onPick: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const format = useCardFormat();
|
||||
const warnings = card.days.filter(dayHasWarning).length;
|
||||
const tone = picked ? 'bg-surface-hover text-content' : 'text-content-secondary hover:bg-surface-hover';
|
||||
const label =
|
||||
card.previewKeys.length > 0
|
||||
? `${t('assistant.card.roadtrip.preview')}: ${card.previewKeys.map((key) => settingLabel(key, t)).join(', ')}`
|
||||
: t('assistant.card.roadtrip.saved');
|
||||
return (
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onPick}
|
||||
aria-pressed={picked}
|
||||
className={`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-caption transition-colors ${tone}`}
|
||||
>
|
||||
<bdi className="min-w-0 flex-1 truncate" title={label}>
|
||||
{label}
|
||||
</bdi>
|
||||
<span className="flex-none tabular-nums">
|
||||
{t('roadtrip.leg.driveText', {
|
||||
distance: format.distance(card.distanceM / 1000),
|
||||
time: formatDurationShort(card.durationS),
|
||||
})}
|
||||
</span>
|
||||
{warnings > 0 && (
|
||||
<span className="flex-none text-warning">
|
||||
{t('assistant.card.roadtrip.warnings', { count: warnings })}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
export default function RoadtripBlock({ cards }: { cards: readonly CardEntry[] }) {
|
||||
const { t } = useTranslation();
|
||||
const { drives, chargers } = splitDriveEntries(cards);
|
||||
const [picked, setPicked] = useState(0);
|
||||
const drive = drives[Math.min(picked, drives.length - 1)];
|
||||
if (!drive) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{chargers.map(({ toolCallId, card }) => (
|
||||
<ChargingCard key={toolCallId} toolCallId={toolCallId} card={card} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const variants =
|
||||
drives.length > 1 ? (
|
||||
<ul aria-label={t('assistant.card.roadtrip.variants')} className="mt-1.5 flex list-none flex-col gap-0.5 p-0">
|
||||
{drives.map(({ toolCallId, card }, index) => (
|
||||
<VariantRow
|
||||
key={toolCallId}
|
||||
card={card}
|
||||
picked={drive.toolCallId === toolCallId}
|
||||
onPick={() => setPicked(index)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
) : undefined;
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
<RoadtripDrive
|
||||
key={drive.toolCallId}
|
||||
toolCallId={drive.toolCallId}
|
||||
card={drive.card}
|
||||
chargers={chargers}
|
||||
variants={variants}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
/**
|
||||
* FE-AI-RT-020 to FE-AI-RT-029, FE-AI-RT-033
|
||||
*
|
||||
* The road trip's other cards: corridor hits worded as the corridor panel
|
||||
* words them, a charger as checked with its source and no link, green only
|
||||
* while its count is fresh and dated once it is not from today, transit
|
||||
* connections that open one at a time and the journey a change adds, the day
|
||||
* route a change bends in its three states, and the rules a change sets.
|
||||
*/
|
||||
import type {
|
||||
CorridorCard as CorridorCardData,
|
||||
DayRouteCard,
|
||||
RoadtripRulesCard,
|
||||
TransitCard as TransitCardData,
|
||||
} from '@trek/shared';
|
||||
import type { ReactNode } from 'react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { charger } from '../../../../../tests/helpers/assistantRoadtrip';
|
||||
import { fireEvent, render, screen } from '../../../../../tests/helpers/render';
|
||||
import { useAssistantStore } from '../../../../store/assistantStore';
|
||||
import type { ChangeItem } from '../../assistantParts';
|
||||
import { type AssistantView, AssistantViewContext } from '../../assistantViewContext';
|
||||
import ChargingCard from './ChargingCard';
|
||||
import CorridorCard from './CorridorCard';
|
||||
import DayRouteBody from './DayRouteBody';
|
||||
import RulesBody from './RulesBody';
|
||||
import TransitCard, { TransitBody } from './TransitCard';
|
||||
|
||||
const INITIAL = useAssistantStore.getState();
|
||||
|
||||
afterEach(() => {
|
||||
useAssistantStore.setState(INITIAL, true);
|
||||
});
|
||||
|
||||
function inView(ui: ReactNode, view: Partial<AssistantView> = {}) {
|
||||
const value: AssistantView = { tripId: 4, variant: 'window', onOpen: vi.fn(), ...view };
|
||||
return render(<AssistantViewContext.Provider value={value}>{ui}</AssistantViewContext.Provider>);
|
||||
}
|
||||
|
||||
function item(state: ChangeItem['state']): ChangeItem {
|
||||
return { toolCallId: 'call_9', preview: null, applied: null, state, card: null };
|
||||
}
|
||||
|
||||
const CORRIDOR: CorridorCardData = {
|
||||
kind: 'corridor',
|
||||
dayId: 31,
|
||||
dayNumber: 2,
|
||||
category: 'charging',
|
||||
widthKm: 5,
|
||||
hits: [
|
||||
{
|
||||
ref: 'call_1:0',
|
||||
name: 'Ionity Holzkirchen',
|
||||
brand: 'Ionity',
|
||||
lat: 47.88,
|
||||
lng: 11.7,
|
||||
alongKm: 31.4,
|
||||
offKm: 0.4,
|
||||
between: ['Munich', 'Verona'],
|
||||
sockets: [{ type: 'ccs', kw: 350, count: 6 }],
|
||||
},
|
||||
],
|
||||
more: 4,
|
||||
searched: { done: 6, total: 9 },
|
||||
partial: true,
|
||||
};
|
||||
|
||||
const leg = {
|
||||
mode: 'RAIL',
|
||||
line: 'RE 4',
|
||||
lineColor: '#ff0000',
|
||||
lineTextColor: null,
|
||||
from: { name: 'Munich Hbf', time: '08:04', track: '12' },
|
||||
to: { name: 'Rosenheim', time: '08:41', track: null },
|
||||
durationS: 2220,
|
||||
stops: 3,
|
||||
headsign: 'Salzburg',
|
||||
agency: null,
|
||||
};
|
||||
const itinerary = {
|
||||
date: '2026-10-01',
|
||||
start: '08:04',
|
||||
end: '08:41',
|
||||
endDayOffset: 0,
|
||||
durationS: 2220,
|
||||
transfers: 0,
|
||||
walkS: 0,
|
||||
legs: [leg],
|
||||
};
|
||||
const TRANSIT: TransitCardData = {
|
||||
kind: 'transit',
|
||||
from: 'Munich',
|
||||
to: 'Rosenheim',
|
||||
dayId: null,
|
||||
itineraries: [itinerary, { ...itinerary, start: '09:04', end: '09:41', legs: [{ ...leg, line: 'RE 5' }] }],
|
||||
more: 2,
|
||||
dropped: 1,
|
||||
};
|
||||
|
||||
describe('road trip cards', () => {
|
||||
it('FE-AI-RT-020: lists corridor hits with how far along and off the road they lie and the stops around them', () => {
|
||||
inView(<CorridorCard cards={[{ toolCallId: 'call_1', card: CORRIDOR }]} />);
|
||||
expect(screen.getByText('Ionity Holzkirchen')).toBeInTheDocument();
|
||||
expect(screen.getByText('Munich')).toBeInTheDocument();
|
||||
expect(screen.getByText('Verona')).toBeInTheDocument();
|
||||
expect(screen.getByText(/CCS/)).toHaveTextContent('CCS 350 kW ×6');
|
||||
expect(screen.getByText('Searched 6 of 9 areas so far.')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '4 more found along the route' })).toBeInTheDocument();
|
||||
fireEvent.mouseEnter(screen.getByRole('button', { name: /Ionity Holzkirchen/ }));
|
||||
expect(useAssistantStore.getState().preview).toMatchObject({ tripId: 4, ref: 'call_1:0', lat: 47.88 });
|
||||
});
|
||||
|
||||
it('FE-AI-RT-021: a corridor search that found nothing says so', () => {
|
||||
const empty: CorridorCardData = { ...CORRIDOR, hits: [], more: 0, partial: false };
|
||||
inView(<CorridorCard cards={[{ toolCallId: 'call_1', card: empty }]} />);
|
||||
expect(screen.getByText(/Nothing found within 5/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-022: a charger shows its snapshot, when it was checked and its source, and links nowhere', () => {
|
||||
const { container } = inView(<ChargingCard toolCallId="call_2" card={charger({ updatedAt: null })} />);
|
||||
expect(screen.getByText('4/6')).toBeInTheDocument();
|
||||
expect(screen.getByText(/Checked at/)).toBeInTheDocument();
|
||||
expect(screen.getByText('1 other price')).toBeInTheDocument();
|
||||
expect(screen.getByText('Data from MobiData BW under CC BY 4.0.')).toBeInTheDocument();
|
||||
expect(container.querySelector('a')).toBeNull();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-023: a stale charger warns, and an unknown one shows no figure', () => {
|
||||
inView(<ChargingCard toolCallId="call_2" card={charger({ stale: true, available: null, energy: null })} />);
|
||||
expect(screen.getByText('?')).toBeInTheDocument();
|
||||
expect(screen.getByText(/Checked at/)).toHaveClass('text-warning');
|
||||
});
|
||||
|
||||
it('FE-AI-RT-028: a count checked just now is green; one from another day is neutral and says the day', () => {
|
||||
const fresh = inView(<ChargingCard toolCallId="call_2" card={charger({ checkedAt: new Date().toISOString() })} />);
|
||||
expect(screen.getByText('4/6')).toHaveClass('bg-success-soft');
|
||||
expect(screen.getByText(/Checked at/)).not.toHaveTextContent(/2025/);
|
||||
fresh.unmount();
|
||||
inView(<ChargingCard toolCallId="call_2" card={charger({ checkedAt: '2025-03-04T07:38:00Z' })} />);
|
||||
expect(screen.getByText('4/6')).not.toHaveClass('bg-success-soft');
|
||||
expect(screen.getByText(/Checked at/)).toHaveTextContent(/Mar.*2025/);
|
||||
});
|
||||
|
||||
it('FE-AI-RT-024: transit connections open one at a time and count what the card leaves out', () => {
|
||||
inView(<TransitCard cards={[{ toolCallId: 'call_3', card: TRANSIT }]} />);
|
||||
expect(screen.getByText('Munich → Rosenheim')).toBeInTheDocument();
|
||||
expect(screen.getAllByRole('button', { expanded: true })).toHaveLength(1);
|
||||
expect(screen.getAllByRole('button', { expanded: false })).toHaveLength(1);
|
||||
expect(screen.getByText('Munich Hbf')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { expanded: false }));
|
||||
expect(screen.getAllByRole('button', { expanded: true })).toHaveLength(1);
|
||||
expect(screen.getByText('2 more connections')).toBeInTheDocument();
|
||||
expect(screen.getByText('1 connection could not be shown')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-033: a title of Arabic names points its arrow left, from the first name to the second', () => {
|
||||
inView(<TransitCard cards={[{ toolCallId: 'call_3', card: { ...TRANSIT, from: 'الرياض', to: 'جدة' } }]} />);
|
||||
expect(screen.getByText('الرياض ← جدة')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-025: a held journey shows its one connection leg by leg', () => {
|
||||
inView(<TransitBody card={{ ...TRANSIT, itineraries: [itinerary], more: 0, dropped: 0 }} item={item('pending')} />);
|
||||
expect(screen.getByText('Munich Hbf')).toBeInTheDocument();
|
||||
expect(screen.getByText('Rosenheim')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-026: the day route dashes what waits, fades once discarded and names its new stops and vias', () => {
|
||||
const route: DayRouteCard = {
|
||||
kind: 'dayRoute',
|
||||
dayId: 31,
|
||||
dayNumber: 1,
|
||||
stops: [
|
||||
{ placeId: 1, name: 'Munich', lat: 48.1, lng: 11.6, added: false },
|
||||
{ placeId: null, name: 'Garmisch', lat: 47.5, lng: 11.1, added: true },
|
||||
],
|
||||
vias: [{ lat: 47.8, lng: 11.3, after: 0, state: 'added', from: null }],
|
||||
afterName: 'Munich',
|
||||
track: 'Romantic Road',
|
||||
unresolved: ['My location'],
|
||||
};
|
||||
const { container, rerender } = inView(<DayRouteBody card={route} item={item('pending')} />);
|
||||
expect(screen.getByText('1 via point')).toBeInTheDocument();
|
||||
expect(screen.getByText('After Munich')).toBeInTheDocument();
|
||||
expect(screen.getByText('Follows Romantic Road')).toBeInTheDocument();
|
||||
expect(screen.getByText('1 new stop')).toBeInTheDocument();
|
||||
expect(screen.getByText('1 stop could not be placed')).toBeInTheDocument();
|
||||
expect(container.querySelector('[stroke-dasharray]')).not.toBeNull();
|
||||
rerender(
|
||||
<AssistantViewContext.Provider value={{ tripId: 4, variant: 'window' }}>
|
||||
<DayRouteBody card={route} item={item('discarded')} />
|
||||
</AssistantViewContext.Provider>
|
||||
);
|
||||
expect(container.firstElementChild).toHaveClass('opacity-50');
|
||||
});
|
||||
|
||||
it('FE-AI-RT-027: the rules a change sets read from the saved value to the new one, and where a day ends', () => {
|
||||
const rules: RoadtripRulesCard = {
|
||||
kind: 'roadtripRules',
|
||||
settings: [
|
||||
{ key: 'roadtrip_hotel_bookends', before: false, after: true },
|
||||
{ key: 'roadtrip_day_start', before: null, after: '09:30' },
|
||||
],
|
||||
dayEnd: { dayId: 31, dayNumber: 2, mode: 'along', from: 'Garmisch', to: 'Innsbruck', percent: 40 },
|
||||
};
|
||||
inView(<RulesBody card={rules} item={item('pending')} />);
|
||||
expect(screen.getByText('Start and end each day at your stay')).toBeInTheDocument();
|
||||
expect(screen.getByText('Off')).toHaveClass('line-through');
|
||||
expect(screen.getByText('On')).toBeInTheDocument();
|
||||
expect(screen.getByText('Day start time')).toBeInTheDocument();
|
||||
expect(screen.getByText('The day ends 40 % along the drive after Garmisch')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Day 2')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-029: a day end without the stop it names says nothing rather than half a sentence', () => {
|
||||
const blank: RoadtripRulesCard = {
|
||||
kind: 'roadtripRules',
|
||||
settings: [],
|
||||
dayEnd: { dayId: 31, dayNumber: 2, mode: 'stop', from: null, to: null, percent: null },
|
||||
};
|
||||
const first = inView(<RulesBody card={blank} item={item('pending')} />);
|
||||
expect(first.container).not.toHaveTextContent(/The day ends/);
|
||||
first.unmount();
|
||||
const auto: RoadtripRulesCard = {
|
||||
...blank,
|
||||
dayEnd: { dayId: 31, dayNumber: 2, mode: 'auto', from: null, to: null, percent: null },
|
||||
};
|
||||
inView(<RulesBody card={auto} item={item('pending')} />);
|
||||
expect(screen.getByText('The day ends automatically again')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,196 @@
|
||||
import type { ChargingCard as ChargingCardData, RoadtripCard } from '@trek/shared';
|
||||
import { CalendarDays, CarFront, Crosshair, MapPin, Route, TriangleAlert, Zap } from 'lucide-react';
|
||||
import { type ReactNode, useMemo, useState } from 'react';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { useAssistantStore } from '../../../../store/assistantStore';
|
||||
import { SoftPill } from '../../../Planner/planParts';
|
||||
import { dayColor } from '../../../Roadtrip/dayColors';
|
||||
import { formatDurationShort } from '../../../Roadtrip/roadtripModel';
|
||||
import { DaySection, type DragState } from '../../../Roadtrip/RoadtripSidebar';
|
||||
import { Tooltip } from '../../../shared/Tooltip';
|
||||
import { TourNotice } from '../../../Tours/tourParts';
|
||||
import { useAssistantView } from '../../assistantViewContext';
|
||||
import { ICON_BUTTON } from '../parts/assistantTones';
|
||||
import { CardFacts, Fact } from '../parts/CardFacts';
|
||||
import CardFrame from '../parts/CardFrame';
|
||||
import CardHeader from '../parts/CardHeader';
|
||||
import { CardOpenButton } from '../parts/CardOpen';
|
||||
import { CardMore } from '../parts/CardRows';
|
||||
import RouteSketch from '../parts/RouteSketch';
|
||||
import { useCardFormat } from '../parts/useCardFormat';
|
||||
import ChargingCard, { ChargerBadges } from './ChargingCard';
|
||||
import DriveDayStrip from './DriveDayStrip';
|
||||
import { chargersOnDay, defaultDayIndex, driveSketch, toRoadtripDay } from './roadtripCardModel';
|
||||
import { roadtripTarget } from './roadtripLook';
|
||||
import { useRoadtripCardMap } from './useRoadtripCardMap';
|
||||
|
||||
/**
|
||||
* The drive calculate_roadtrip worked out, as the road trip draws it: its
|
||||
* totals as the planner's badges, a sketch of every day with the chosen one
|
||||
* bold, the days as a strip of the planner's day tiles, and the chosen day
|
||||
* as the planner's own day card, read only: the same stops, service stops,
|
||||
* terminals, booked nights, drive bands and findings, in the same rows. A
|
||||
* charger checked in the same answer shows in the row of its stop. Where the
|
||||
* tank or the battery runs dry on the chosen day, the planner's own words
|
||||
* say so and how far in. What the card leaves out is counted as a way into
|
||||
* the road trip.
|
||||
*/
|
||||
|
||||
/** The chat's day card never drags: nothing is held, nothing can be dropped. */
|
||||
const NO_DRAG: DragState = { from: null, setFrom: () => undefined, dropAt: null, setDropAt: () => undefined };
|
||||
|
||||
/** Why a drive's totals are not the whole drive, each a literal key. */
|
||||
const PROBLEM = {
|
||||
routing: { labelKey: 'assistant.card.roadtrip.problem.routing' },
|
||||
coordinates: { labelKey: 'assistant.card.roadtrip.problem.coordinates' },
|
||||
dayWindow: { labelKey: 'assistant.card.roadtrip.problem.dayWindow' },
|
||||
} as const;
|
||||
|
||||
export default function RoadtripDrive({
|
||||
toolCallId,
|
||||
card,
|
||||
chargers,
|
||||
variants,
|
||||
}: {
|
||||
toolCallId: string;
|
||||
card: RoadtripCard;
|
||||
chargers: readonly { toolCallId: string; card: ChargingCardData }[];
|
||||
/** The other ways of driving it the answer worked out, to pick from. */
|
||||
variants?: ReactNode;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { variant } = useAssistantView();
|
||||
const format = useCardFormat();
|
||||
const map = useRoadtripCardMap();
|
||||
// The day the chat was opened on, read once: the card opens there, and on the first driving day otherwise.
|
||||
const [selected, setSelected] = useState(() => defaultDayIndex(card, useAssistantStore.getState().focus?.dayId));
|
||||
const tiles = useMemo(() => card.days.map(toRoadtripDay), [card]);
|
||||
const day = card.days[selected] ?? card.days[0];
|
||||
const railDay = tiles[selected] ?? tiles[0];
|
||||
const { joined, apart } = chargersOnDay(day, chargers);
|
||||
const sketch = driveSketch(card, selected, dayColor);
|
||||
const paint = (dayNumber: number) => dayColor(card.dayColors ? dayNumber : 1).line;
|
||||
const vehicle = { kind: card.vehicle, fill: card.defaultFill };
|
||||
const showDrive = t('assistant.card.roadtrip.showDrive');
|
||||
if (!day || !railDay) return null;
|
||||
return (
|
||||
<>
|
||||
<CardFrame label={t('roadtrip.title')}>
|
||||
<CardHeader
|
||||
icon={Route}
|
||||
tone="info"
|
||||
title={t('roadtrip.title')}
|
||||
meta={
|
||||
card.previewKeys.length > 0 ? (
|
||||
<SoftPill tone="accent" caps>
|
||||
{t('assistant.card.roadtrip.preview')}
|
||||
</SoftPill>
|
||||
) : undefined
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<Tooltip label={showDrive}>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={showDrive}
|
||||
onClick={() => map.showDrive(card.days)}
|
||||
className={`${ICON_BUTTON} ${variant === 'fullscreen' ? 'h-9 w-9' : ''}`}
|
||||
>
|
||||
<Crosshair size={14} aria-hidden="true" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
<CardOpenButton target={roadtripTarget({ dayId: day.dayId })} labelKey="assistant.card.roadtrip.open" />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
{variants}
|
||||
<CardFacts>
|
||||
<Fact
|
||||
icon={CarFront}
|
||||
label={t('roadtrip.leg.driveText', {
|
||||
distance: format.distance(card.distanceM / 1000),
|
||||
time: formatDurationShort(card.durationS),
|
||||
})}
|
||||
/>
|
||||
<Fact icon={MapPin} label={t('roadtrip.day.stopCount', { count: card.stopCount })} />
|
||||
{card.chargingCount > 0 && (
|
||||
<Fact icon={Zap} label={t('assistant.card.roadtrip.chargingStops', { count: card.chargingCount })} />
|
||||
)}
|
||||
{card.quietDays > 0 && (
|
||||
<Fact icon={CalendarDays} label={t('assistant.card.roadtrip.quietDays', { count: card.quietDays })} />
|
||||
)}
|
||||
</CardFacts>
|
||||
<div className="mt-2">
|
||||
<RouteSketch
|
||||
lines={sketch.lines}
|
||||
marks={sketch.marks}
|
||||
height={variant === 'fullscreen' ? 128 : 104}
|
||||
ariaLabel={t('assistant.card.roadtrip.showDay', { number: day.dayNumber })}
|
||||
onActivate={() => map.showDay(day)}
|
||||
/>
|
||||
</div>
|
||||
{card.days.length > 1 && (
|
||||
<DriveDayStrip
|
||||
days={card.days}
|
||||
tiles={tiles}
|
||||
selected={selected}
|
||||
dayColors={card.dayColors}
|
||||
onSelect={setSelected}
|
||||
onHover={(hovered) => map.hoverDay(toolCallId, hovered, hovered ? paint(hovered.dayNumber) : '')}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
className="mt-2"
|
||||
onMouseEnter={() => map.hoverDay(toolCallId, day, paint(day.dayNumber))}
|
||||
onMouseLeave={() => map.hoverDay(toolCallId, null, '')}
|
||||
>
|
||||
<DaySection
|
||||
day={railDay}
|
||||
drag={NO_DRAG}
|
||||
flush
|
||||
dayColors={card.dayColors}
|
||||
vehicle={vehicle}
|
||||
chargingOf={(stop) => {
|
||||
const charger = joined.get(stop.placeId);
|
||||
return charger ? <ChargerBadges card={charger} /> : null;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{day.moreStops > 0 && (
|
||||
<p className="m-0 mt-1 px-1.5 text-caption text-content-muted">
|
||||
{t('assistant.card.roadtrip.moreStops', { count: day.moreStops })}
|
||||
</p>
|
||||
)}
|
||||
{day.dryKm !== null && (
|
||||
<div className="mt-2">
|
||||
<TourNotice tone="warning" role="status" icon={<TriangleAlert size={13} aria-hidden="true" />}>
|
||||
{t(card.vehicle === 'electric' ? 'roadtrip.refuel.dryElectric' : 'roadtrip.refuel.dry')}{' '}
|
||||
{t('roadtrip.refuel.after', { distance: format.distance(day.dryKm) })}
|
||||
</TourNotice>
|
||||
</div>
|
||||
)}
|
||||
{card.problem && (
|
||||
<div className="mt-2">
|
||||
<TourNotice tone="warning" role="status" icon={<TriangleAlert size={13} aria-hidden="true" />}>
|
||||
{t(PROBLEM[card.problem].labelKey)}
|
||||
</TourNotice>
|
||||
</div>
|
||||
)}
|
||||
{card.undatedRides > 0 && (
|
||||
<div className="mt-2">
|
||||
<TourNotice>{t('assistant.card.roadtrip.undated', { count: card.undatedRides })}</TourNotice>
|
||||
</div>
|
||||
)}
|
||||
<CardMore
|
||||
count={card.moreDays}
|
||||
labelKey="assistant.card.roadtrip.moreDays"
|
||||
target={roadtripTarget({ dayId: null })}
|
||||
/>
|
||||
</CardFrame>
|
||||
{apart.map((charger) => (
|
||||
<ChargingCard key={charger.toolCallId} toolCallId={charger.toolCallId} card={charger.card} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { RoadtripRulesCard } from '@trek/shared';
|
||||
import { Flag, SlidersHorizontal } from 'lucide-react';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import type { ChangeItem } from '../../assistantParts';
|
||||
import { CardFacts, Fact, FactChange } from '../parts/CardFacts';
|
||||
import { useCardFormat } from '../parts/useCardFormat';
|
||||
import { settingLabel, settingValueText, type SettingWords } from './roadtripSettings';
|
||||
|
||||
/**
|
||||
* What a change to the road trip's rules does, under its change row: each
|
||||
* driving setting it changes, named as the settings dialog names it, from
|
||||
* what is saved to what it sets; or where it makes a day end, at a stop,
|
||||
* part way along a drive, or back at the automatic end. The day itself is
|
||||
* the change row's own fact, so it is not said twice.
|
||||
*/
|
||||
|
||||
/** The three ways a day can end, each a literal key. */
|
||||
const DAY_END = {
|
||||
stop: { labelKey: 'assistant.card.roadtrip.dayEnd.at' },
|
||||
along: { labelKey: 'assistant.card.roadtrip.dayEnd.along' },
|
||||
auto: { labelKey: 'assistant.card.roadtrip.dayEnd.auto' },
|
||||
} as const;
|
||||
|
||||
/** Where the day ends in words; null when the change names no stop to end at, or no share of the drive. */
|
||||
function dayEndLabel(dayEnd: NonNullable<RoadtripRulesCard['dayEnd']>, t: SettingWords['t']): string | null {
|
||||
if (dayEnd.mode === 'auto') return t(DAY_END.auto.labelKey);
|
||||
if (!dayEnd.from) return null;
|
||||
if (dayEnd.mode === 'stop') return t(DAY_END.stop.labelKey, { name: dayEnd.from });
|
||||
return dayEnd.percent === null ? null : t(DAY_END.along.labelKey, { name: dayEnd.from, percent: dayEnd.percent });
|
||||
}
|
||||
|
||||
function DayEnd({ dayEnd }: { dayEnd: NonNullable<RoadtripRulesCard['dayEnd']> }) {
|
||||
const { t } = useTranslation();
|
||||
const label = dayEndLabel(dayEnd, t);
|
||||
if (!label) return null;
|
||||
return (
|
||||
<CardFacts>
|
||||
<Fact icon={Flag} tone={dayEnd.mode === 'auto' ? 'neutral' : 'info'} label={label} />
|
||||
</CardFacts>
|
||||
);
|
||||
}
|
||||
|
||||
export default function RulesBody({ card }: { card: RoadtripRulesCard; item: ChangeItem }) {
|
||||
const { t } = useTranslation();
|
||||
const format = useCardFormat();
|
||||
const words: SettingWords = {
|
||||
t,
|
||||
minutes: format.minutes,
|
||||
clock: format.clock,
|
||||
distance: format.distance,
|
||||
number: format.count,
|
||||
};
|
||||
return (
|
||||
<div className="mt-1.5 flex flex-col gap-1">
|
||||
{card.settings.length > 0 && (
|
||||
<ul className="m-0 flex list-none flex-col gap-1 p-0">
|
||||
{card.settings.map((setting) => (
|
||||
<li key={setting.key} className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="text-caption text-content-muted">{settingLabel(setting.key, t)}</span>
|
||||
<FactChange
|
||||
icon={SlidersHorizontal}
|
||||
tone="info"
|
||||
before={
|
||||
setting.before === null || setting.before === setting.after
|
||||
? null
|
||||
: settingValueText(setting.key, setting.before, words)
|
||||
}
|
||||
after={settingValueText(setting.key, setting.after, words)}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{card.dayEnd && <DayEnd dayEnd={card.dayEnd} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { MapPin } from 'lucide-react';
|
||||
|
||||
import { serviceColor } from '../../../Roadtrip/roadtripModel';
|
||||
import { CORRIDOR_CATEGORY_BY_KEY } from '../../../Roadtrip/stopKinds';
|
||||
|
||||
/**
|
||||
* A kind of stop on the way (a charger, a pump, a rest area) as the road
|
||||
* trip draws it in its corridor list and on the map: its icon on its own
|
||||
* tint, in the road signage colours the rail and the pins share.
|
||||
*/
|
||||
export default function ServiceDisc({ category }: { category: string }) {
|
||||
const Icon = CORRIDOR_CATEGORY_BY_KEY[category]?.Icon ?? MapPin;
|
||||
const color = serviceColor(category);
|
||||
return (
|
||||
<span
|
||||
className="grid h-6 w-6 flex-none place-items-center rounded-full"
|
||||
style={{ background: `color-mix(in srgb, ${color} 14%, transparent)`, color }}
|
||||
>
|
||||
<Icon size={12} strokeWidth={2} aria-hidden="true" />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
import type { TransitCard as TransitCardData, TransitCardItinerary } from '@trek/shared';
|
||||
import { ArrowRight, TrainFront } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { safeHexColor } from '../../../../utils/safeColor';
|
||||
import {
|
||||
fmtTransitDuration,
|
||||
TransitItineraryInline,
|
||||
TransitLegChips,
|
||||
type TransitLegDisplay,
|
||||
} from '../../../Planner/transitDisplay';
|
||||
import { DayCarry } from '../../../Roadtrip/RoadtripSidebarBadges';
|
||||
import type { ChangeItem } from '../../assistantParts';
|
||||
import type { CardEntry } from '../cardTypes';
|
||||
import CardFrame from '../parts/CardFrame';
|
||||
import CardHeader from '../parts/CardHeader';
|
||||
import { useCardFormat } from '../parts/useCardFormat';
|
||||
|
||||
/**
|
||||
* Public transport connections, drawn with the planner's own transit pieces:
|
||||
* per connection its two clocks (a later day marked as the rail marks it),
|
||||
* how long it takes and its legs as line chips; the chosen one opens into
|
||||
* the planner's leg by leg itinerary. A held journey shows its one
|
||||
* connection that way inside its change row.
|
||||
*/
|
||||
|
||||
/** The first letter of a text is one of a script written right to left. */
|
||||
const STARTS_RIGHT_TO_LEFT = /^[^\p{L}]*[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}]/u;
|
||||
|
||||
/**
|
||||
* From and to as one title. The title takes its direction from its first
|
||||
* letter, so the arrow points left after an Arabic or Hebrew name and right
|
||||
* after any other, always from the start to the end of the journey.
|
||||
*/
|
||||
function routeTitle(from: string, to: string): string {
|
||||
return STARTS_RIGHT_TO_LEFT.test(from) ? `${from} ← ${to}` : `${from} → ${to}`;
|
||||
}
|
||||
|
||||
/** A line's colour as the transit pieces paint it, allow-listed; none for a line without one. */
|
||||
function lineColour(value: string | null): string | null {
|
||||
return value ? safeHexColor(value, '') || null : null;
|
||||
}
|
||||
|
||||
/** A card leg as the planner's transit pieces read one, its clocks in the user's format. */
|
||||
function legsOf(itinerary: TransitCardItinerary, clock: (value: string) => string): TransitLegDisplay[] {
|
||||
return itinerary.legs.map((leg) => ({
|
||||
mode: leg.mode,
|
||||
line: leg.line,
|
||||
line_color: lineColour(leg.lineColor),
|
||||
line_text_color: lineColour(leg.lineTextColor),
|
||||
duration: leg.durationS,
|
||||
headsign: leg.headsign,
|
||||
agency: leg.agency,
|
||||
stops: leg.stops,
|
||||
from: { name: leg.from.name, time: leg.from.time ? clock(leg.from.time) : null, track: leg.from.track },
|
||||
to: { name: leg.to.name, time: leg.to.time ? clock(leg.to.time) : null, track: leg.to.track },
|
||||
}));
|
||||
}
|
||||
|
||||
/** "08:04 → 08:41 +1", the arrival a day or more later marked as the rail marks it. */
|
||||
function Clocks({ itinerary }: { itinerary: TransitCardItinerary }) {
|
||||
const format = useCardFormat();
|
||||
return (
|
||||
<span dir="ltr" className="inline-flex items-center gap-1 whitespace-nowrap tabular-nums">
|
||||
{format.clock(itinerary.start)}
|
||||
<ArrowRight size={11} aria-hidden="true" className="text-content-faint" />
|
||||
{format.clock(itinerary.end)}
|
||||
<DayCarry days={itinerary.endDayOffset} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function ItineraryRow({
|
||||
itinerary,
|
||||
open,
|
||||
onOpen,
|
||||
}: {
|
||||
itinerary: TransitCardItinerary;
|
||||
open: boolean;
|
||||
onOpen: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const format = useCardFormat();
|
||||
const lit = open ? 'bg-surface-hover' : '';
|
||||
return (
|
||||
<li className="-mx-1.5">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpen}
|
||||
aria-expanded={open}
|
||||
className={`flex w-full flex-col gap-1 rounded-[12px] px-1.5 py-2 text-start transition-colors hover:bg-surface-hover ${lit}`}
|
||||
>
|
||||
<span className="flex w-full items-baseline gap-2">
|
||||
<span className="text-body font-semibold text-content">
|
||||
<Clocks itinerary={itinerary} />
|
||||
</span>
|
||||
<span className="ms-auto text-caption tabular-nums text-content-secondary">
|
||||
{fmtTransitDuration(itinerary.durationS, t)}
|
||||
</span>
|
||||
</span>
|
||||
<TransitLegChips legs={legsOf(itinerary, format.clock)} transfers={itinerary.transfers} t={t} />
|
||||
</button>
|
||||
{open && (
|
||||
<div className="px-1.5 pb-2 pt-1">
|
||||
<TransitItineraryInline legs={legsOf(itinerary, format.clock)} t={t} />
|
||||
</div>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function TransitCardView({ card }: { card: TransitCardData }) {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(0);
|
||||
const title = routeTitle(card.from, card.to);
|
||||
return (
|
||||
<CardFrame label={title}>
|
||||
<CardHeader icon={TrainFront} tone="info" title={title} count={card.itineraries.length + card.more} />
|
||||
<ul className="m-0 mt-1 flex list-none flex-col p-0">
|
||||
{card.itineraries.map((itinerary, index) => (
|
||||
<ItineraryRow
|
||||
key={`${itinerary.date}:${itinerary.start}:${index}`}
|
||||
itinerary={itinerary}
|
||||
open={open === index}
|
||||
onOpen={() => setOpen(open === index ? -1 : index)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
{(card.more > 0 || card.dropped > 0) && (
|
||||
<p className="m-0 mt-1 px-1.5 text-caption text-content-muted">
|
||||
{card.more > 0 && <span>{t('assistant.card.roadtrip.transit.more', { count: card.more })}</span>}
|
||||
{card.dropped > 0 && (
|
||||
<span className="ms-1">{t('assistant.card.roadtrip.transit.dropped', { count: card.dropped })}</span>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</CardFrame>
|
||||
);
|
||||
}
|
||||
|
||||
/** The transit searches of one answer, one card each. */
|
||||
export default function TransitCard({ cards }: { cards: readonly CardEntry[] }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{cards.map(({ toolCallId, card }) =>
|
||||
card.kind === 'transit' ? <TransitCardView key={toolCallId} card={card} /> : null
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A held journey inside its change row: its one connection, leg by leg. The
|
||||
* row already states when it leaves and arrives, so only an arrival on a
|
||||
* later day is marked here.
|
||||
*/
|
||||
export function TransitBody({ card }: { card: TransitCardData; item: ChangeItem }) {
|
||||
const { t } = useTranslation();
|
||||
const format = useCardFormat();
|
||||
const [itinerary] = card.itineraries;
|
||||
if (!itinerary) return null;
|
||||
return (
|
||||
<div className="mt-1.5 flex flex-col gap-1.5">
|
||||
{itinerary.endDayOffset > 0 && (
|
||||
<span className="text-caption font-medium text-content-secondary">
|
||||
<Clocks itinerary={itinerary} />
|
||||
</span>
|
||||
)}
|
||||
<TransitItineraryInline legs={legsOf(itinerary, format.clock)} t={t} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* FE-AI-RT-001 to FE-AI-RT-008
|
||||
*
|
||||
* The road trip cards read for drawing: a card's day rebuilt as the planner's
|
||||
* own day (stops, legs, schedule, findings), the day an answer opens on, the
|
||||
* days that carry a warning, a charger joined to its stop, the sketch of a
|
||||
* drive and of a day route, the settings in words, and the look's map hooks.
|
||||
*/
|
||||
import type { DayRouteCard } from '@trek/shared';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { charger, DRIVE, FLORENCE_DAY, MUNICH_DAY } from '../../../../../tests/helpers/assistantRoadtrip';
|
||||
import { dayColor } from '../../../Roadtrip/dayColors';
|
||||
import { CARD_RULES } from '../cardLooks';
|
||||
import {
|
||||
chargersOnDay,
|
||||
dayHasWarning,
|
||||
dayRouteSketch,
|
||||
defaultDayIndex,
|
||||
driveSketch,
|
||||
splitDriveEntries,
|
||||
toRoadtripDay,
|
||||
} from './roadtripCardModel';
|
||||
import { dayRouteGhosts, dayRouteLines, ROADTRIP_LOOK, roadtripTarget } from './roadtripLook';
|
||||
import { settingLabel, settingValueText, type SettingWords } from './roadtripSettings';
|
||||
|
||||
const ROUTE: DayRouteCard = {
|
||||
kind: 'dayRoute',
|
||||
dayId: 31,
|
||||
dayNumber: 1,
|
||||
stops: [
|
||||
{ placeId: 1, name: 'Munich', lat: 48.1, lng: 11.6, added: false },
|
||||
{ placeId: null, name: 'Garmisch', lat: 47.5, lng: 11.1, added: true },
|
||||
],
|
||||
vias: [
|
||||
{ lat: 47.8, lng: 11.3, after: 0, state: 'moved', from: [47.7, 11.4] },
|
||||
{ lat: 47.6, lng: 11.2, after: 0, state: 'removed', from: null },
|
||||
],
|
||||
afterName: 'Munich',
|
||||
track: null,
|
||||
unresolved: [],
|
||||
};
|
||||
|
||||
describe('roadtripCardModel', () => {
|
||||
it('FE-AI-RT-001: rebuilds a card day as the planner day: stops, terminals, the booked night, legs and schedule', () => {
|
||||
const day = toRoadtripDay(MUNICH_DAY);
|
||||
expect(day.stops.map((stop) => stop.name)).toEqual([
|
||||
'Munich',
|
||||
'Ionity Holzkirchen',
|
||||
'Munich Airport',
|
||||
'Rome Fiumicino',
|
||||
'Hotel Roma',
|
||||
]);
|
||||
expect(day.stops[2]).toMatchObject({
|
||||
assignmentId: -3,
|
||||
placeId: -3,
|
||||
carrier: { reservationId: 9, role: 'departure' },
|
||||
});
|
||||
expect(day.stops[4]).toMatchObject({
|
||||
assignmentId: -5,
|
||||
placeId: 5,
|
||||
bookend: { phase: 'evening', checkingIn: true, checkIn: '15:00', reservationId: null },
|
||||
});
|
||||
expect(day.stops.every((stop, index) => stop.ownerDayId === 31 && stop.ownerIndex === index)).toBe(true);
|
||||
expect(day.legs.map((leg) => leg?.mode)).toEqual(['driving', 'driving', 'flight', 'driving']);
|
||||
expect(day.legs[0]).toMatchObject({ distance: 30_000, duration: 1800, from: [48.137, 11.575] });
|
||||
expect(day.schedule.entries[1]).toEqual({ arrival: '09:00', departure: '09:30', anchored: false, dayOffset: 0 });
|
||||
expect(day.schedule.warnings).toEqual([{ index: 2, code: 'late', minutes: 15 }]);
|
||||
expect(day.driveWarnings).toEqual([{ index: 1, code: 'leg', overMinutes: 25 }]);
|
||||
expect(day.dayWarning).toEqual({ code: 'dayDriving', minutes: 400, limitMinutes: 360 });
|
||||
expect(day.legVias).toHaveLength(5);
|
||||
});
|
||||
|
||||
it('FE-AI-RT-002: opens on the day the chat is about, else the first that drives; flags the days to look at', () => {
|
||||
expect(defaultDayIndex(DRIVE, 32)).toBe(1);
|
||||
expect(defaultDayIndex(DRIVE, null)).toBe(0);
|
||||
expect(defaultDayIndex({ ...DRIVE, days: [{ ...MUNICH_DAY, legs: [] }, FLORENCE_DAY] }, null)).toBe(1);
|
||||
expect(dayHasWarning(MUNICH_DAY)).toBe(true);
|
||||
expect(dayHasWarning(FLORENCE_DAY)).toBe(false);
|
||||
expect(dayHasWarning({ ...FLORENCE_DAY, dryKm: 280 })).toBe(true);
|
||||
});
|
||||
|
||||
it('FE-AI-RT-003: a charger on a stop of the shown day joins its row, any other stands apart', () => {
|
||||
const entries = [
|
||||
{ toolCallId: 'call_1', card: DRIVE },
|
||||
{ toolCallId: 'call_2', card: charger() },
|
||||
{ toolCallId: 'call_3', card: charger({ placeId: null, name: 'Elsewhere' }) },
|
||||
];
|
||||
const { drives, chargers } = splitDriveEntries(entries);
|
||||
expect(drives.map((drive) => drive.toolCallId)).toEqual(['call_1']);
|
||||
const { joined, apart } = chargersOnDay(MUNICH_DAY, chargers);
|
||||
expect([...joined.keys()]).toEqual([2]);
|
||||
expect(apart.map((entry) => entry.toolCallId)).toEqual(['call_3']);
|
||||
expect(chargersOnDay(FLORENCE_DAY, chargers).joined.size).toBe(0);
|
||||
});
|
||||
|
||||
it('FE-AI-RT-004: the drive sketch draws every day in its colour, the chosen one bold, and marks its stops', () => {
|
||||
const { lines, marks } = driveSketch(DRIVE, 1, dayColor);
|
||||
expect(lines.map((line) => [line.id, line.dim])).toEqual([
|
||||
['31:0', true],
|
||||
['31:1', true],
|
||||
['32:0', false],
|
||||
]);
|
||||
expect(lines[2]?.color).toBe(dayColor(2).line);
|
||||
expect(marks.map((mark) => mark.id)).toEqual(['32:0', '32:1']);
|
||||
const oneColour = driveSketch({ ...DRIVE, dayColors: false }, 0, dayColor);
|
||||
expect(new Set(oneColour.lines.map((line) => line.color))).toEqual(new Set([dayColor(1).line]));
|
||||
expect(driveSketch(DRIVE, 0, dayColor).marks.find((mark) => mark.id === '31:1')?.shape).toBe('service');
|
||||
});
|
||||
|
||||
it('FE-AI-RT-005: the day route sketch dashes what waits, fades what goes and shows where a via came from', () => {
|
||||
const waiting = dayRouteSketch(ROUTE, true);
|
||||
expect(waiting.lines.map((line) => line.id)).toEqual(['stops', 'move:0']);
|
||||
expect(waiting.marks.find((mark) => mark.id === 'stop:1')).toMatchObject({ shape: 'new', state: 'pending' });
|
||||
expect(waiting.marks.find((mark) => mark.id === 'via:0')).toMatchObject({ shape: 'via', state: 'pending' });
|
||||
expect(waiting.marks.find((mark) => mark.id === 'via:1')?.state).toBe('removed');
|
||||
expect(waiting.marks.find((mark) => mark.id === 'from:0')).toMatchObject({ lat: 47.7, state: 'removed' });
|
||||
const applied = dayRouteSketch(ROUTE, false);
|
||||
expect(applied.marks.find((mark) => mark.id === 'via:0')?.state).toBeUndefined();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-006: names the settings as the settings dialog does and words their values', () => {
|
||||
const words: SettingWords = {
|
||||
t: (key) => `<${key}>`,
|
||||
minutes: (value) => `${value} min`,
|
||||
clock: (value) => `@${value}`,
|
||||
distance: (km) => `${km} km`,
|
||||
number: (value) => String(value),
|
||||
};
|
||||
expect(settingLabel('roadtrip_day_start', words.t)).toBe('<roadtrip.window.start>');
|
||||
expect(settingLabel('roadtrip_new_thing', words.t)).toBe('roadtrip_new_thing');
|
||||
expect(settingValueText('roadtrip_day_start', '09:30', words)).toBe('@09:30');
|
||||
expect(settingValueText('roadtrip_day_start', '', words)).toBe('<assistant.card.roadtrip.setting.off>');
|
||||
expect(settingValueText('roadtrip_leg_minutes', 0, words)).toBe('<assistant.card.roadtrip.setting.off>');
|
||||
expect(settingValueText('roadtrip_leg_minutes', 150, words)).toBe('150 min');
|
||||
expect(settingValueText('roadtrip_range_km', 420, words)).toBe('420 km');
|
||||
expect(settingValueText('roadtrip_fill_percent', 80, words)).toBe('80 %');
|
||||
expect(settingValueText('roadtrip_hotel_bookends', true, words)).toBe('<assistant.card.roadtrip.setting.on>');
|
||||
expect(settingValueText('roadtrip_vehicle', 'electric', words)).toBe('<roadtrip.limit.vehicleElectric>');
|
||||
const avoided = settingValueText('roadtrip_avoid', 'toll,ferry', words);
|
||||
expect(avoided).toBe('<roadtrip.avoid.toll>, <roadtrip.avoid.ferry>');
|
||||
expect(settingValueText('roadtrip_day_end_mode', 'stop', words)).toBe('<roadtrip.window.atStop>');
|
||||
});
|
||||
|
||||
it('FE-AI-RT-007: an applied road trip change opens its day in the road trip and shows the day on the map', () => {
|
||||
const look = ROADTRIP_LOOK.entities.roadtrip;
|
||||
const applied = { toolCallId: 'call_1', entity: 'roadtrip' as const, ids: [], dayId: 31, undoUntil: null };
|
||||
expect(look.onMap?.(applied, null)).toEqual({ placeId: null, dayId: 31 });
|
||||
expect(look.open?.(applied, null)).toEqual({ kind: 'tab', tab: 'roadtrip', params: { day: '31' } });
|
||||
expect(look.onMap?.({ ...applied, dayId: null }, null)).toBeNull();
|
||||
expect(roadtripTarget({ dayId: null })).toEqual({ kind: 'tab', tab: 'roadtrip' });
|
||||
expect(CARD_RULES.group(DRIVE)).toBe('drive');
|
||||
expect(CARD_RULES.group(charger())).toBe('drive');
|
||||
expect(ROADTRIP_LOOK.cards.transit.followUps?.find((followUp) => followUp.id === 'addTransit')?.edits).toBe(true);
|
||||
});
|
||||
|
||||
it('FE-AI-RT-008: a waiting day route marks its new stops and vias on the map and draws where a via moves', () => {
|
||||
expect(dayRouteGhosts(ROUTE)).toEqual([
|
||||
{ id: 'stop:1', lat: 47.5, lng: 11.1, name: 'Garmisch', variant: 'pin' },
|
||||
{ id: 'via:0', lat: 47.8, lng: 11.3, name: 'Munich', variant: 'point' },
|
||||
]);
|
||||
expect(dayRouteLines(ROUTE, 'pending')).toEqual([
|
||||
{
|
||||
id: 'via-moves',
|
||||
lines: [
|
||||
[
|
||||
[47.7, 11.4],
|
||||
[47.8, 11.3],
|
||||
],
|
||||
],
|
||||
color: 'var(--accent)',
|
||||
dashed: true,
|
||||
},
|
||||
]);
|
||||
expect(dayRouteLines(ROUTE, 'look')).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,237 @@
|
||||
import type { ChargingCard, DayRouteCard, RoadtripCard, RoadtripCardDay, RoadtripCardStop } from '@trek/shared';
|
||||
import type { RoadtripDay, RoadtripStop, RouteSegment } from '@trek/shared/roadtrip';
|
||||
|
||||
import type { CardEntry } from '../cardTypes';
|
||||
import type { SketchLine, SketchMark } from '../parts/routeSketchModel';
|
||||
|
||||
/**
|
||||
* The road trip cards read for drawing, pure: a card's day rebuilt as the
|
||||
* planner's own `RoadtripDay`, so the chat hands it to the planner's day card
|
||||
* and gets the planner's rows; the day an answer opens on; which days carry
|
||||
* a warning; the sketch of a drive or of a day route; and the chargers of an
|
||||
* answer that belong to a stop the drive shows.
|
||||
*/
|
||||
|
||||
/** A leg as the rail reads it, rebuilt from the card's metres, seconds and mode. */
|
||||
function legOf(leg: RoadtripCardDay['legs'][number], from: RoadtripCardStop, to: RoadtripCardStop) {
|
||||
if (!leg) return undefined;
|
||||
const segment: RouteSegment = {
|
||||
mid: [(from.lat + to.lat) / 2, (from.lng + to.lng) / 2],
|
||||
from: [from.lat, from.lng],
|
||||
to: [to.lat, to.lng],
|
||||
distance: leg.distanceM,
|
||||
duration: leg.durationS,
|
||||
walkingText: '',
|
||||
drivingText: '',
|
||||
distanceText: '',
|
||||
mode: leg.mode,
|
||||
};
|
||||
return segment;
|
||||
}
|
||||
|
||||
/** One stop as the rail reads it; a terminal or a booked night, no place or assignment, gets ids of its own. */
|
||||
function stopOf(stop: RoadtripCardStop, index: number, dayId: number): RoadtripStop {
|
||||
const own = -(index + 1);
|
||||
return {
|
||||
assignmentId: stop.assignmentId ?? own,
|
||||
ownerDayId: dayId,
|
||||
ownerIndex: index,
|
||||
placeId: stop.placeId ?? own,
|
||||
name: stop.name,
|
||||
lat: stop.lat,
|
||||
lng: stop.lng,
|
||||
time: stop.time,
|
||||
leaveAt: stop.leaveAt,
|
||||
dwellMinutes: stop.dwellMinutes,
|
||||
checkInTime: stop.night?.checkIn ?? null,
|
||||
night: stop.night !== null,
|
||||
legMode: null,
|
||||
incomingLegMode: null,
|
||||
stopType: stop.stopType,
|
||||
fillPercent: stop.fillPercent,
|
||||
offRoadMeters: stop.offRoadM,
|
||||
...(stop.carrier ? { carrier: stop.carrier } : {}),
|
||||
...(stop.autoNight ? { automaticNight: stop.autoNight } : {}),
|
||||
...(stop.bookend
|
||||
? {
|
||||
bookend: {
|
||||
phase: stop.bookend.phase,
|
||||
accommodationId: 0,
|
||||
reservationId: stop.bookend.reservationId,
|
||||
checkingIn: stop.bookend.checkingIn,
|
||||
checkingOut: stop.bookend.checkingOut,
|
||||
checkIn: stop.bookend.checkIn,
|
||||
checkOut: stop.bookend.checkOut,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
/** A card's day as the planner's day card takes it: the same stops, schedule, findings and warnings. */
|
||||
export function toRoadtripDay(day: RoadtripCardDay): RoadtripDay {
|
||||
const stops = day.stops.map((stop, index) => stopOf(stop, index, day.dayId));
|
||||
return {
|
||||
dayId: day.dayId,
|
||||
dayNumber: day.dayNumber,
|
||||
date: day.date,
|
||||
title: day.title,
|
||||
stops,
|
||||
legs: day.stops.slice(1).map((to, index) => {
|
||||
const from = day.stops[index];
|
||||
return from ? legOf(day.legs[index] ?? null, from, to) : undefined;
|
||||
}),
|
||||
schedule: {
|
||||
entries: day.stops.map((stop) => ({
|
||||
arrival: stop.arrival,
|
||||
departure: stop.departure,
|
||||
anchored: stop.anchored,
|
||||
dayOffset: stop.dayOffset,
|
||||
})),
|
||||
warnings: day.stops.flatMap((stop, index) =>
|
||||
stop.late.map((late) => ({ index, code: late.code, minutes: late.minutes }))
|
||||
),
|
||||
},
|
||||
legVias: day.stops.map(() => []),
|
||||
geometry: [],
|
||||
distance: day.distanceM,
|
||||
duration: day.durationS,
|
||||
driveWarnings: day.stops.flatMap((stop, index) =>
|
||||
stop.findings.map((finding) => ({
|
||||
index,
|
||||
code: finding.code,
|
||||
...(finding.overMinutes !== null ? { overMinutes: finding.overMinutes } : {}),
|
||||
...(finding.sinceKm !== null ? { sinceKm: finding.sinceKm } : {}),
|
||||
}))
|
||||
),
|
||||
dayWarning: day.dayOver ? { code: 'dayDriving', ...day.dayOver } : null,
|
||||
avoidMissed: day.avoidMissed,
|
||||
};
|
||||
}
|
||||
|
||||
/** Whether a day carries something to look at: lateness, a finding on a drive, too long a day, a dry tank. */
|
||||
export function dayHasWarning(day: RoadtripCardDay): boolean {
|
||||
return (
|
||||
day.dayOver !== null || day.dryKm !== null || day.stops.some((stop) => stop.late.length + stop.findings.length > 0)
|
||||
);
|
||||
}
|
||||
|
||||
/** The day an answer opens on: the day the chat is about when the drive holds it, else the first that drives. */
|
||||
export function defaultDayIndex(card: RoadtripCard, focusDayId: number | null | undefined): number {
|
||||
const focused = card.days.findIndex((day) => day.dayId === focusDayId);
|
||||
if (focused >= 0) return focused;
|
||||
const driving = card.days.findIndex((day) => day.legs.length > 0);
|
||||
return driving >= 0 ? driving : 0;
|
||||
}
|
||||
|
||||
/** The colours a day is drawn in: the day's own, or day 1's for every day when the trip draws one colour. */
|
||||
type DayPaint = (dayNumber: number) => { line: string; casing: string };
|
||||
|
||||
/** The sketch of a drive: every day's lines, the selected day bold and the others faded, its stops marked. */
|
||||
export function driveSketch(
|
||||
card: RoadtripCard,
|
||||
selected: number,
|
||||
paint: DayPaint
|
||||
): { lines: SketchLine[]; marks: SketchMark[] } {
|
||||
const lines = card.days.flatMap((day, dayIndex) => {
|
||||
const colour = paint(card.dayColors ? day.dayNumber : 1);
|
||||
return day.lines.map((points, index) => ({
|
||||
id: `${day.dayId}:${index}`,
|
||||
points,
|
||||
color: colour.line,
|
||||
casing: colour.casing,
|
||||
dim: dayIndex !== selected,
|
||||
}));
|
||||
});
|
||||
const shown = card.days[selected];
|
||||
const marks = (shown?.stops ?? [])
|
||||
.filter((stop) => stop.autoNight === null)
|
||||
.map((stop, index): SketchMark => ({
|
||||
id: `${shown?.dayId ?? 0}:${index}`,
|
||||
lat: stop.lat,
|
||||
lng: stop.lng,
|
||||
shape: stop.stopType && stop.stopType !== 'hotel' ? 'service' : 'stop',
|
||||
}));
|
||||
return { lines, marks };
|
||||
}
|
||||
|
||||
/** Where a moved via stood, faint. */
|
||||
function fromMark(index: number, [lat, lng]: [number, number]): SketchMark {
|
||||
return { id: `from:${index}`, lat, lng, shape: 'via', state: 'removed' };
|
||||
}
|
||||
|
||||
/** A day route's sketch: its stops joined by straight dashed lines, new stops and vias marked by their change. */
|
||||
export function dayRouteSketch(card: DayRouteCard, pending: boolean): { lines: SketchLine[]; marks: SketchMark[] } {
|
||||
const points = card.stops.map((stop): [number, number] => [stop.lat, stop.lng]);
|
||||
const lines: SketchLine[] =
|
||||
points.length >= 2
|
||||
? [{ id: 'stops', points, color: 'var(--border-primary)', casing: 'transparent', dashed: true }]
|
||||
: [];
|
||||
for (const [index, via] of card.vias.entries()) {
|
||||
if (via.state === 'moved' && via.from) {
|
||||
lines.push({
|
||||
id: `move:${index}`,
|
||||
points: [via.from, [via.lat, via.lng]],
|
||||
color: 'var(--accent)',
|
||||
casing: 'transparent',
|
||||
dashed: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
const marks: SketchMark[] = [
|
||||
...card.stops.map((stop, index): SketchMark => ({
|
||||
id: `stop:${index}`,
|
||||
lat: stop.lat,
|
||||
lng: stop.lng,
|
||||
shape: stop.added ? 'new' : 'stop',
|
||||
...(stop.added && pending ? { state: 'pending' } : {}),
|
||||
})),
|
||||
...card.vias.flatMap((via, index): SketchMark[] => [
|
||||
...(via.from ? [fromMark(index, via.from)] : []),
|
||||
{
|
||||
id: `via:${index}`,
|
||||
lat: via.lat,
|
||||
lng: via.lng,
|
||||
shape: 'via',
|
||||
...(via.state === 'removed' ? { state: 'removed' } : pending ? { state: 'pending' } : {}),
|
||||
},
|
||||
]),
|
||||
];
|
||||
return { lines, marks };
|
||||
}
|
||||
|
||||
/** The roadtrip and charging cards of an answer group, apart. */
|
||||
export function splitDriveEntries(entries: readonly CardEntry[]): {
|
||||
drives: { toolCallId: string; card: RoadtripCard }[];
|
||||
chargers: { toolCallId: string; card: ChargingCard }[];
|
||||
} {
|
||||
const drives: { toolCallId: string; card: RoadtripCard }[] = [];
|
||||
const chargers: { toolCallId: string; card: ChargingCard }[] = [];
|
||||
for (const { toolCallId, card } of entries) {
|
||||
if (card.kind === 'roadtrip') drives.push({ toolCallId, card });
|
||||
if (card.kind === 'charging') chargers.push({ toolCallId, card });
|
||||
}
|
||||
return { drives, chargers };
|
||||
}
|
||||
|
||||
/** The chargers that belong to a stop of the shown day, by its place; the rest stand on their own. */
|
||||
export function chargersOnDay(
|
||||
day: RoadtripCardDay | undefined,
|
||||
chargers: readonly { toolCallId: string; card: ChargingCard }[]
|
||||
): { joined: Map<number, ChargingCard>; apart: { toolCallId: string; card: ChargingCard }[] } {
|
||||
const places = new Set((day?.stops ?? []).flatMap((stop) => (stop.placeId === null ? [] : [stop.placeId])));
|
||||
const joined = new Map<number, ChargingCard>();
|
||||
const apart: { toolCallId: string; card: ChargingCard }[] = [];
|
||||
for (const charger of chargers) {
|
||||
const placeId = charger.card.placeId;
|
||||
if (placeId !== null && places.has(placeId)) joined.set(placeId, charger.card);
|
||||
else apart.push(charger);
|
||||
}
|
||||
return { joined, apart };
|
||||
}
|
||||
|
||||
/** Every point of a drive's day, for the map to fit the camera to. */
|
||||
export function dayPoints(day: RoadtripCardDay): [number, number][] {
|
||||
const linePoints = day.lines.flat();
|
||||
return linePoints.length > 0 ? linePoints : day.stops.map((stop): [number, number] => [stop.lat, stop.lng]);
|
||||
}
|
||||
@@ -1,22 +1,109 @@
|
||||
import type { PackLook } from '../cardTypes';
|
||||
import type { AssistantApplied, DayRouteCard } from '@trek/shared';
|
||||
import { Flag, Move, Pin, Route, RouteOff, SlidersHorizontal, Spline, TrainFront, Waypoints } from 'lucide-react';
|
||||
|
||||
import type { GhostPoint, RouteLineSpec, RouteUse } from '../../../../types/assistantMap';
|
||||
import type { EntityTarget, PackLook } from '../cardTypes';
|
||||
|
||||
/**
|
||||
* What the road trip brings to the chat's pure look: the verbs, tool names and
|
||||
* steps it adds, what an applied change of its own opens, and the look of each
|
||||
* of its kinds. Empty until the road trip cards fill it. A look stays pure,
|
||||
* icons and literals only: the chat's main chunk reads every look, so whatever
|
||||
* a look imports ships with it.
|
||||
* What the road trip brings to the chat's pure look: the verbs of its
|
||||
* changes (vias, settings, day endings, a Google Maps route, a transit
|
||||
* connection), the names of its tools and reading steps, what an applied
|
||||
* change of the road trip opens (its day on the map, the road trip view on
|
||||
* that day), and the look of each of its kinds. A look stays pure, icons and
|
||||
* literals only: the chat's main chunk reads every look, so whatever a look
|
||||
* imports ships with it.
|
||||
*/
|
||||
|
||||
/** The road trip on the day a change touched; the planner switches its road trip view on for it. */
|
||||
export function roadtripTarget(applied: Pick<AssistantApplied, 'dayId'>): EntityTarget {
|
||||
return applied.dayId === null
|
||||
? { kind: 'tab', tab: 'roadtrip' }
|
||||
: { kind: 'tab', tab: 'roadtrip', params: { day: String(applied.dayId) } };
|
||||
}
|
||||
|
||||
/** The spots a waiting day route marks on the map: its new stops as pins, the vias it adds or moves as points. */
|
||||
export function dayRouteGhosts(card: DayRouteCard): GhostPoint[] {
|
||||
const stops = card.stops.flatMap((stop, index): GhostPoint[] =>
|
||||
stop.added ? [{ id: `stop:${index}`, lat: stop.lat, lng: stop.lng, name: stop.name, variant: 'pin' }] : []
|
||||
);
|
||||
const vias = card.vias.flatMap((via, index): GhostPoint[] =>
|
||||
via.state === 'removed'
|
||||
? []
|
||||
: [{ id: `via:${index}`, lat: via.lat, lng: via.lng, name: card.afterName ?? '', variant: 'point' }]
|
||||
);
|
||||
return [...stops, ...vias];
|
||||
}
|
||||
|
||||
/** Where a waiting via move goes: a dashed line from where it stands to where it will. */
|
||||
export function dayRouteLines(card: DayRouteCard, use: RouteUse): RouteLineSpec[] {
|
||||
if (use !== 'pending') return [];
|
||||
const moves = card.vias.flatMap((via): [number, number][][] =>
|
||||
via.state === 'moved' && via.from ? [[via.from, [via.lat, via.lng]]] : []
|
||||
);
|
||||
return moves.length > 0 ? [{ id: 'via-moves', lines: moves, color: 'var(--accent)', dashed: true }] : [];
|
||||
}
|
||||
|
||||
export const ROADTRIP_LOOK = {
|
||||
verbs: {},
|
||||
tools: {},
|
||||
steps: {},
|
||||
entities: {},
|
||||
cards: {
|
||||
roadtrip: {},
|
||||
corridor: {},
|
||||
charging: {},
|
||||
transit: {},
|
||||
dayRoute: {},
|
||||
verbs: {
|
||||
addRouteVia: { Icon: Waypoints, tone: 'success', labelKey: 'assistant.change.verb.addRouteVia' },
|
||||
shapeRoute: { Icon: Spline, tone: 'info', labelKey: 'assistant.change.verb.shapeRoute' },
|
||||
moveRouteVia: { Icon: Move, tone: 'warning', labelKey: 'assistant.change.verb.moveRouteVia' },
|
||||
removeRouteVia: { Icon: RouteOff, tone: 'danger', labelKey: 'assistant.change.verb.removeRouteVia' },
|
||||
repinRouteVias: { Icon: Pin, tone: 'info', labelKey: 'assistant.change.verb.repinRouteVias' },
|
||||
updateDriveSettings: {
|
||||
Icon: SlidersHorizontal,
|
||||
tone: 'info',
|
||||
labelKey: 'assistant.change.verb.updateDriveSettings',
|
||||
},
|
||||
setDayBoundary: { Icon: Flag, tone: 'info', labelKey: 'assistant.change.verb.setDayBoundary' },
|
||||
importRoute: { Icon: Route, tone: 'success', labelKey: 'assistant.change.verb.importRoute' },
|
||||
addTransit: { Icon: TrainFront, tone: 'success', labelKey: 'assistant.change.verb.addTransit' },
|
||||
},
|
||||
} satisfies PackLook<'roadtrip' | 'corridor' | 'charging' | 'transit' | 'dayRoute'>;
|
||||
tools: {
|
||||
add_route_via: { labelKey: 'assistant.tool.add_route_via' },
|
||||
add_route_vias: { labelKey: 'assistant.tool.add_route_vias' },
|
||||
update_route_via: { labelKey: 'assistant.tool.update_route_via' },
|
||||
remove_route_via: { labelKey: 'assistant.tool.remove_route_via' },
|
||||
reanchor_route_vias: { labelKey: 'assistant.tool.reanchor_route_vias' },
|
||||
update_roadtrip_settings: { labelKey: 'assistant.tool.update_roadtrip_settings' },
|
||||
set_day_boundary: { labelKey: 'assistant.tool.set_day_boundary' },
|
||||
import_google_maps_route: { labelKey: 'assistant.tool.import_google_maps_route' },
|
||||
preview_google_maps_route: { labelKey: 'assistant.tool.preview_google_maps_route' },
|
||||
create_transit_journey: { labelKey: 'assistant.tool.create_transit_journey' },
|
||||
},
|
||||
steps: {
|
||||
calculate_roadtrip: { stepKey: 'assistant.step.roadtrip' },
|
||||
search_roadtrip_corridor: { stepKey: 'assistant.step.corridor' },
|
||||
get_roadtrip_charging_info: { stepKey: 'assistant.step.charging' },
|
||||
lookup_roadtrip_charging_info: { stepKey: 'assistant.step.charging' },
|
||||
search_transit_routes: { stepKey: 'assistant.step.transit' },
|
||||
},
|
||||
entities: {
|
||||
roadtrip: {
|
||||
Icon: Route,
|
||||
openLabelKey: 'assistant.card.roadtrip.open',
|
||||
onMap: (applied) => (applied.dayId === null ? null : { placeId: null, dayId: applied.dayId }),
|
||||
open: (applied) => roadtripTarget(applied),
|
||||
},
|
||||
},
|
||||
cards: {
|
||||
// A charger checked beside a drive joins the drive's card, in the row of its stop.
|
||||
roadtrip: {
|
||||
group: () => 'drive',
|
||||
followUps: [
|
||||
{ id: 'chargers', labelKey: 'assistant.followUp.chargers' },
|
||||
{ id: 'stays', labelKey: 'assistant.followUp.stays' },
|
||||
],
|
||||
},
|
||||
charging: { group: () => 'drive' },
|
||||
corridor: { followUps: [{ id: 'corridorMore', labelKey: 'assistant.followUp.corridorMore' }] },
|
||||
transit: {
|
||||
followUps: [
|
||||
{ id: 'laterTransit', labelKey: 'assistant.followUp.laterTransit' },
|
||||
{ id: 'addTransit', labelKey: 'assistant.followUp.addTransit', edits: true },
|
||||
],
|
||||
},
|
||||
dayRoute: { ghosts: dayRouteGhosts, lines: dayRouteLines },
|
||||
roadtripRules: {},
|
||||
},
|
||||
} satisfies PackLook<'roadtrip' | 'corridor' | 'charging' | 'transit' | 'dayRoute' | 'roadtripRules'>;
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
import type { RoadtripSettingChange } from '@trek/shared';
|
||||
|
||||
/**
|
||||
* The road trip's driving settings as the planner's settings name them: the
|
||||
* label of each and how its value reads (a duration, a clock, a distance, a
|
||||
* switch, a choice). A table of literal keys, so the cards name a setting the
|
||||
* way the settings dialog does and the i18n check sees every key; a setting
|
||||
* this build does not know reads by its key.
|
||||
*/
|
||||
|
||||
type SettingValue = RoadtripSettingChange['after'];
|
||||
|
||||
type ValueKind =
|
||||
| 'minutes'
|
||||
| 'clock'
|
||||
| 'km'
|
||||
| 'percent'
|
||||
| 'litres'
|
||||
| 'litresPer100'
|
||||
| 'kwh'
|
||||
| 'kwhPer100'
|
||||
| 'switch'
|
||||
| 'endMode'
|
||||
| 'vehicle'
|
||||
| 'avoid';
|
||||
|
||||
const SETTING_LOOK: Readonly<Record<string, { labelKey: string; kind: ValueKind }>> = {
|
||||
roadtrip_leg_minutes: { labelKey: 'roadtrip.limit.legLabel', kind: 'minutes' },
|
||||
roadtrip_day_minutes: { labelKey: 'roadtrip.limit.dayLabel', kind: 'minutes' },
|
||||
roadtrip_day_start: { labelKey: 'roadtrip.window.start', kind: 'clock' },
|
||||
roadtrip_day_end: { labelKey: 'roadtrip.window.end', kind: 'clock' },
|
||||
roadtrip_day_end_mode: { labelKey: 'roadtrip.window.endAt', kind: 'endMode' },
|
||||
roadtrip_range_km: { labelKey: 'roadtrip.limit.rangeLabel', kind: 'km' },
|
||||
roadtrip_vehicle: { labelKey: 'roadtrip.limit.vehicleLabel', kind: 'vehicle' },
|
||||
roadtrip_fill_percent: { labelKey: 'roadtrip.limit.fillLabel', kind: 'percent' },
|
||||
roadtrip_tank_litres: { labelKey: 'roadtrip.limit.tankLabel', kind: 'litres' },
|
||||
roadtrip_litres_per_100: { labelKey: 'roadtrip.limit.useLabel', kind: 'litresPer100' },
|
||||
roadtrip_battery_kwh: { labelKey: 'roadtrip.limit.batteryLabel', kind: 'kwh' },
|
||||
roadtrip_kwh_per_100: { labelKey: 'roadtrip.limit.useLabel', kind: 'kwhPer100' },
|
||||
roadtrip_battery_degradation: { labelKey: 'roadtrip.limit.wearLabel', kind: 'percent' },
|
||||
roadtrip_connect_days: { labelKey: 'roadtrip.line.connect', kind: 'switch' },
|
||||
roadtrip_service_stops_in_days: { labelKey: 'roadtrip.stops.inDays', kind: 'switch' },
|
||||
roadtrip_day_colors: { labelKey: 'roadtrip.line.dayColors', kind: 'switch' },
|
||||
roadtrip_show_hazards: { labelKey: 'roadtrip.hazards.show', kind: 'switch' },
|
||||
roadtrip_hotel_bookends: { labelKey: 'roadtrip.line.hotelBookends', kind: 'switch' },
|
||||
roadtrip_avoid: { labelKey: 'roadtrip.avoid.section', kind: 'avoid' },
|
||||
};
|
||||
|
||||
const SWITCH: Readonly<Record<'on' | 'off', { labelKey: string }>> = {
|
||||
on: { labelKey: 'assistant.card.roadtrip.setting.on' },
|
||||
off: { labelKey: 'assistant.card.roadtrip.setting.off' },
|
||||
};
|
||||
|
||||
const END_MODE: Readonly<Record<string, { labelKey: string }>> = {
|
||||
route: { labelKey: 'roadtrip.window.onRoute' },
|
||||
stop: { labelKey: 'roadtrip.window.atStop' },
|
||||
};
|
||||
|
||||
const VEHICLE: Readonly<Record<string, { labelKey: string }>> = {
|
||||
'': { labelKey: 'roadtrip.limit.vehicleAny' },
|
||||
combustion: { labelKey: 'roadtrip.limit.vehicleCombustion' },
|
||||
electric: { labelKey: 'roadtrip.limit.vehicleElectric' },
|
||||
};
|
||||
|
||||
const AVOID: Readonly<Record<string, { labelKey: string }>> = {
|
||||
toll: { labelKey: 'roadtrip.avoid.toll' },
|
||||
motorway: { labelKey: 'roadtrip.avoid.motorway' },
|
||||
ferry: { labelKey: 'roadtrip.avoid.ferry' },
|
||||
};
|
||||
|
||||
/** What a setting's value is written with: the words, and the user's own numbers and units. */
|
||||
export interface SettingWords {
|
||||
t: (key: string, params?: Record<string, string | number>) => string;
|
||||
minutes: (value: number) => string;
|
||||
clock: (value: string) => string;
|
||||
distance: (km: number) => string;
|
||||
number: (value: number) => string;
|
||||
}
|
||||
|
||||
/** The name of a setting, its key when this build has none for it. */
|
||||
export function settingLabel(key: string, t: SettingWords['t']): string {
|
||||
const look = SETTING_LOOK[key];
|
||||
return look ? t(look.labelKey) : key;
|
||||
}
|
||||
|
||||
function chosen(table: Readonly<Record<string, { labelKey: string }>>, value: string, t: SettingWords['t']): string {
|
||||
const look = table[value];
|
||||
return look ? t(look.labelKey) : value;
|
||||
}
|
||||
|
||||
/** A setting held as text: a clock, a choice, a list of road classes. */
|
||||
function textValue(kind: ValueKind | undefined, value: string, words: SettingWords, off: string): string {
|
||||
const { t } = words;
|
||||
if (kind === 'clock') return value === '' ? off : words.clock(value);
|
||||
if (kind === 'endMode') return chosen(END_MODE, value, t);
|
||||
if (kind === 'vehicle') return chosen(VEHICLE, value, t);
|
||||
if (kind !== 'avoid') return value;
|
||||
const classes = value.split(',').filter((part) => part !== '');
|
||||
return classes.length === 0 ? off : classes.map((part) => chosen(AVOID, part, t)).join(', ');
|
||||
}
|
||||
|
||||
/** A setting's value in words; "off" for a cleared one (an empty clock, a zero limit). */
|
||||
export function settingValueText(key: string, value: SettingValue, words: SettingWords): string {
|
||||
const off = words.t(SWITCH.off.labelKey);
|
||||
const kind = SETTING_LOOK[key]?.kind;
|
||||
if (value === null) return off;
|
||||
if (typeof value === 'boolean') return words.t(value ? SWITCH.on.labelKey : SWITCH.off.labelKey);
|
||||
if (typeof value === 'string') return textValue(kind, value, words, off);
|
||||
if (value === 0 && (kind === 'minutes' || kind === 'km')) return off;
|
||||
if (kind === 'minutes') return words.minutes(value);
|
||||
if (kind === 'km') return words.distance(value);
|
||||
const unit: Partial<Record<ValueKind, string>> = {
|
||||
percent: '%',
|
||||
litres: 'l',
|
||||
litresPer100: 'l/100 km',
|
||||
kwh: 'kWh',
|
||||
kwhPer100: 'kWh/100 km',
|
||||
};
|
||||
const symbol = kind ? unit[kind] : undefined;
|
||||
return symbol ? `${words.number(value)} ${symbol}` : words.number(value);
|
||||
}
|
||||
@@ -1,16 +1,25 @@
|
||||
import { type CardView, PENDING_VIEW } from '../cardTypes';
|
||||
import type { CardView } from '../cardTypes';
|
||||
import CorridorCard from './CorridorCard';
|
||||
import DayRouteBody from './DayRouteBody';
|
||||
import RoadtripBlock from './RoadtripBlock';
|
||||
import RulesBody from './RulesBody';
|
||||
import TransitCard, { TransitBody } from './TransitCard';
|
||||
|
||||
/**
|
||||
* How the kinds of the road trip draw in the chat; each one draws nothing until
|
||||
* its cards are built. This file only maps each kind to its view: the
|
||||
* components live in sibling files, since a file that exports anything besides
|
||||
* components breaks fast refresh, and lint:warnings holds
|
||||
* react-refresh/only-export-components at zero for a new file.
|
||||
* How the kinds of the road trip draw in the chat: a drive (with the
|
||||
* chargers checked beside it) as the road trip's own card and day rail,
|
||||
* corridor hits and transit connections as answer cards, and under a change
|
||||
* row the day route it bends, the connection it adds or the rules it sets.
|
||||
* This file only maps each kind to its view: the components live in sibling
|
||||
* files, since a file that exports anything besides components breaks fast
|
||||
* refresh, and lint:warnings holds react-refresh/only-export-components at
|
||||
* zero for a new file.
|
||||
*/
|
||||
export const ROADTRIP_VIEWS = {
|
||||
roadtrip: PENDING_VIEW,
|
||||
corridor: PENDING_VIEW,
|
||||
charging: PENDING_VIEW,
|
||||
transit: PENDING_VIEW,
|
||||
dayRoute: PENDING_VIEW,
|
||||
} satisfies { [K in 'roadtrip' | 'corridor' | 'charging' | 'transit' | 'dayRoute']: CardView<K> };
|
||||
roadtrip: { Block: RoadtripBlock },
|
||||
charging: { Block: RoadtripBlock },
|
||||
corridor: { Block: CorridorCard },
|
||||
transit: { Block: TransitCard, Body: TransitBody },
|
||||
dayRoute: { Body: DayRouteBody },
|
||||
roadtripRules: { Body: RulesBody },
|
||||
} satisfies { [K in 'roadtrip' | 'corridor' | 'charging' | 'transit' | 'dayRoute' | 'roadtripRules']: CardView<K> };
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* FE-AI-RT-030 to FE-AI-RT-032
|
||||
*
|
||||
* The road trip cards' part of the map: a day pointed at draws its drive,
|
||||
* the drive goes when the pointer does and when the card goes; showing a
|
||||
* day selects it in the planner, steps the chat aside and fits the map.
|
||||
*/
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { FLORENCE_DAY } from '../../../../../tests/helpers/assistantRoadtrip';
|
||||
import { useAssistantStore } from '../../../../store/assistantStore';
|
||||
import { type AssistantView, AssistantViewContext } from '../../assistantViewContext';
|
||||
import { useRoadtripCardMap } from './useRoadtripCardMap';
|
||||
|
||||
const INITIAL = useAssistantStore.getState();
|
||||
|
||||
afterEach(() => {
|
||||
useAssistantStore.setState(INITIAL, true);
|
||||
});
|
||||
|
||||
function wrapper(view: AssistantView) {
|
||||
return function Wrapper({ children }: { children: ReactNode }) {
|
||||
return <AssistantViewContext.Provider value={view}>{children}</AssistantViewContext.Provider>;
|
||||
};
|
||||
}
|
||||
|
||||
describe('useRoadtripCardMap', () => {
|
||||
it('FE-AI-RT-030: a day pointed at draws its drive, which goes with the pointer and with the card', () => {
|
||||
const { result, unmount } = renderHook(() => useRoadtripCardMap(), {
|
||||
wrapper: wrapper({ tripId: 4, variant: 'window' }),
|
||||
});
|
||||
act(() => result.current.hoverDay('call_1', FLORENCE_DAY, '#0a84ff'));
|
||||
expect(useAssistantStore.getState().routePreview).toEqual({
|
||||
tripId: 4,
|
||||
ref: 'call_1',
|
||||
lines: FLORENCE_DAY.lines,
|
||||
color: '#0a84ff',
|
||||
});
|
||||
act(() => result.current.hoverDay('call_1', null, ''));
|
||||
expect(useAssistantStore.getState().routePreview).toBeNull();
|
||||
act(() => result.current.hoverDay('call_1', FLORENCE_DAY, '#0a84ff'));
|
||||
unmount();
|
||||
expect(useAssistantStore.getState().routePreview).toBeNull();
|
||||
});
|
||||
|
||||
it('FE-AI-RT-032: a card going or its pointer leaving never takes away a drive another card drew', () => {
|
||||
const { result, unmount } = renderHook(() => useRoadtripCardMap(), {
|
||||
wrapper: wrapper({ tripId: 4, variant: 'window' }),
|
||||
});
|
||||
act(() => result.current.hoverDay('call_1', FLORENCE_DAY, '#0a84ff'));
|
||||
const other = { tripId: 4, ref: 'tour_9', lines: FLORENCE_DAY.lines, color: '#ff9f0a' };
|
||||
act(() => useAssistantStore.getState().setRoutePreview(other));
|
||||
act(() => result.current.hoverDay('call_1', null, ''));
|
||||
expect(useAssistantStore.getState().routePreview).toEqual(other);
|
||||
unmount();
|
||||
expect(useAssistantStore.getState().routePreview).toEqual(other);
|
||||
});
|
||||
|
||||
it('FE-AI-RT-031: showing a day selects it, steps the chat aside and fits the map to its drive', () => {
|
||||
const onFocusDay = vi.fn();
|
||||
const onRevealMap = vi.fn();
|
||||
const { result } = renderHook(() => useRoadtripCardMap(), {
|
||||
wrapper: wrapper({ tripId: 4, variant: 'fullscreen', onFocusDay, onRevealMap }),
|
||||
});
|
||||
act(() => result.current.showDay(FLORENCE_DAY));
|
||||
expect(onFocusDay).toHaveBeenCalledWith(32);
|
||||
expect(onRevealMap).toHaveBeenCalledTimes(1);
|
||||
expect(useAssistantStore.getState().camera).toMatchObject({
|
||||
tripId: 4,
|
||||
points: FLORENCE_DAY.lines[0],
|
||||
mode: 'fit',
|
||||
why: 'user',
|
||||
});
|
||||
act(() => result.current.showPoints([]));
|
||||
expect(onRevealMap).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
import type { RoadtripCardDay } from '@trek/shared';
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
|
||||
import { useAssistantStore } from '../../../../store/assistantStore';
|
||||
import { useAssistantView } from '../../assistantViewContext';
|
||||
import { useCardPoint } from '../parts/useCardPoint';
|
||||
import { dayPoints } from './roadtripCardModel';
|
||||
|
||||
/**
|
||||
* The road trip cards' part of the map. Resting on a day draws that day's
|
||||
* drive over the plan in its colour, resting on a stop or a hit shows its
|
||||
* pin; a click selects the day in the planner and fits the map to it, or
|
||||
* moves the map to a spot. On the phone, where the chat covers the map, the
|
||||
* chat steps aside first. Whatever a card drew goes when the card does,
|
||||
* and only that: a drive another card drew since stays.
|
||||
*/
|
||||
export function useRoadtripCardMap() {
|
||||
const { tripId, onRevealMap, onFocusDay } = useAssistantView();
|
||||
const setRoutePreview = useAssistantStore((s) => s.setRoutePreview);
|
||||
const requestCamera = useAssistantStore((s) => s.requestCamera);
|
||||
const point = useCardPoint();
|
||||
/** The drive this card drew last, so it takes away its own and never another card's. */
|
||||
const drawn = useRef<string | null>(null);
|
||||
|
||||
const clearOwn = useCallback(() => {
|
||||
const ref = drawn.current;
|
||||
drawn.current = null;
|
||||
if (ref !== null && useAssistantStore.getState().routePreview?.ref === ref) setRoutePreview(null);
|
||||
}, [setRoutePreview]);
|
||||
|
||||
/** Draws a day's drive while it is pointed at; null takes it away. */
|
||||
const hoverDay = useCallback(
|
||||
(ref: string, day: RoadtripCardDay | null, color: string) => {
|
||||
if (!day || day.lines.length === 0) {
|
||||
clearOwn();
|
||||
return;
|
||||
}
|
||||
drawn.current = ref;
|
||||
setRoutePreview({ tripId, ref, lines: day.lines, color });
|
||||
},
|
||||
[tripId, setRoutePreview, clearOwn]
|
||||
);
|
||||
|
||||
/** Selects the day in the planner and fits the map to its drive. */
|
||||
const showDay = useCallback(
|
||||
(day: RoadtripCardDay) => {
|
||||
onFocusDay?.(day.dayId);
|
||||
onRevealMap?.();
|
||||
requestCamera(tripId, dayPoints(day), 'fit', 'user');
|
||||
},
|
||||
[tripId, onFocusDay, onRevealMap, requestCamera]
|
||||
);
|
||||
|
||||
/** Fits the map to these points; on the phone the chat steps aside first. */
|
||||
const showPoints = useCallback(
|
||||
(points: [number, number][]) => {
|
||||
if (points.length === 0) return;
|
||||
onRevealMap?.();
|
||||
requestCamera(tripId, points, 'fit', 'user');
|
||||
},
|
||||
[tripId, onRevealMap, requestCamera]
|
||||
);
|
||||
|
||||
/** Fits the map to every day the card holds. */
|
||||
const showDrive = useCallback(
|
||||
(days: readonly RoadtripCardDay[]) => showPoints(days.flatMap((day) => dayPoints(day))),
|
||||
[showPoints]
|
||||
);
|
||||
|
||||
useEffect(() => clearOwn, [clearOwn]);
|
||||
|
||||
return { hoverDay, showDay, showDrive, showPoints, hoverPoint: point.hover, showPoint: point.show };
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { PlugZap, Coins, ChevronDown } from 'lucide-react'
|
||||
import type { ChargingInfo as Info } from '@trek/shared'
|
||||
import { cheapestEnergy, type ChargingEnergyPrice, type ChargingInfo as Info } from '@trek/shared'
|
||||
import { useTranslation } from '../../i18n/TranslationContext'
|
||||
import { useTripStore } from '../../store/tripStore'
|
||||
import { chargingRepo } from '../../repo/chargingRepo'
|
||||
@@ -20,6 +20,29 @@ type ChargingTarget =
|
||||
| { placeId: number; lat?: undefined; lng?: undefined; name?: undefined }
|
||||
| { placeId?: undefined; lat: number; lng: number; name: string }
|
||||
|
||||
/**
|
||||
* A charger's two compact badges: the free points of all its points, when that is known
|
||||
* and fresh, and its cheapest energy price. The live badge on the rail draws them, and so
|
||||
* does the assistant's card of one look at the charger, which never asks again.
|
||||
*/
|
||||
export function ChargingBadges({ label, known, fresh = true, available, total, energy }: {
|
||||
/** What the availability badge says when it is pointed at. */
|
||||
label: string
|
||||
known: boolean
|
||||
/** False for a count checked a while ago: still shown, but no longer green. */
|
||||
fresh?: boolean
|
||||
available: number | null
|
||||
total: number | null
|
||||
energy: ChargingEnergyPrice | null
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const price = (value: number, currency: string) => new Intl.NumberFormat(undefined, { style: 'currency', currency }).format(value)
|
||||
return <span className="inline-flex shrink-0 items-center gap-1 align-middle whitespace-nowrap font-medium text-[length:calc(10px*var(--fs-scale-caption,1))] leading-none">
|
||||
<Tooltip label={label}><span tabIndex={0} className={`inline-flex items-center gap-1 rounded px-1 py-0.5 ${known && fresh && available! > 0 ? 'bg-success-soft text-success' : 'bg-surface-secondary text-content-muted'}`}><PlugZap size={10} />{known ? `${available}/${total}` : '?'}</span></Tooltip>
|
||||
{energy && <Tooltip label={t('roadtrip.charging.note')}><span tabIndex={0} className="inline-flex items-center gap-1 rounded bg-surface-secondary px-1 py-0.5 text-content-muted"><Coins size={10} />{price(energy.price, energy.currency)}/kWh*</span></Tooltip>}
|
||||
</span>
|
||||
}
|
||||
|
||||
export default function ChargingInfo({ placeId, lat, lng, name, compact = false }: ChargingTarget & { compact?: boolean }) {
|
||||
const tripId = useTripStore(s => s.trip?.id)
|
||||
const { t } = useTranslation()
|
||||
@@ -52,15 +75,11 @@ export default function ChargingInfo({ placeId, lat, lng, name, compact = false
|
||||
const known = !isEffectivelyOffline() && info?.available != null && !info.stale && Date.now() - Date.parse(info.checkedAt) < 120000
|
||||
const status = loading ? t('common.loading') : known ? `${info.available}/${info.total} ${t('roadtrip.charging.available')}` : t(info?.stale ? 'roadtrip.charging.stale' : 'roadtrip.charging.unknown')
|
||||
const components = info?.tariffs.flatMap(tariff => tariff.components.map(component => ({ ...component, currency: tariff.currency }))) ?? []
|
||||
const energy = components.filter(component => component.kind === 'ENERGY' && component.taxIncluded && !component.conditional)
|
||||
const sameCurrency = new Set(energy.map(component => component.currency)).size === 1
|
||||
const cheapest = sameCurrency ? energy.reduce<typeof energy[number] | null>((best, component) => !best || component.price < best.price ? component : best, null) : null
|
||||
// The same price the assistant's card shows: tax included, no condition, one currency.
|
||||
const cheapest = info ? cheapestEnergy(info.tariffs) : null
|
||||
const price = (value: number, currency: string) => new Intl.NumberFormat(undefined, { style: 'currency', currency }).format(value)
|
||||
const badges = <span className="inline-flex shrink-0 items-center gap-1 align-middle whitespace-nowrap font-medium text-[length:calc(10px*var(--fs-scale-caption,1))] leading-none">
|
||||
<Tooltip label={`${status}${info?.updatedAt ? ` (${new Date(info.updatedAt).toLocaleString()})` : ''}`}><span tabIndex={0} className={`inline-flex items-center gap-1 rounded px-1 py-0.5 ${known && info.available! > 0 ? 'bg-success-soft text-success' : 'bg-surface-secondary text-content-muted'}`}><PlugZap size={10} />{known ? `${info.available}/${info.total}` : '?'}</span></Tooltip>
|
||||
{cheapest && <Tooltip label={t('roadtrip.charging.note')}><span tabIndex={0} className="inline-flex items-center gap-1 rounded bg-surface-secondary px-1 py-0.5 text-content-muted"><Coins size={10} />{price(cheapest.price, cheapest.currency)}/kWh*</span></Tooltip>}
|
||||
</span>
|
||||
if (compact) return badges
|
||||
const label = `${status}${info?.updatedAt ? ` (${new Date(info.updatedAt).toLocaleString()})` : ''}`
|
||||
if (compact) return <ChargingBadges label={label} known={known} available={info?.available ?? null} total={info?.total ?? null} energy={cheapest} />
|
||||
return <details className="group rounded-[10px] bg-surface-hover text-[length:calc(12px*var(--fs-scale-body,1))] text-content-secondary">
|
||||
<summary className="flex cursor-pointer list-none items-center gap-1.5 px-3 py-2 [&::-webkit-details-marker]:hidden">
|
||||
<PlugZap size={13} className="shrink-0 text-content-faint" />
|
||||
|
||||
@@ -26,7 +26,7 @@ import { RAIL_GRID, STAT_LABEL } from './RoadtripSidebar.constants'
|
||||
import { RefuelBand } from './RoadtripSidebarRefuelBand'
|
||||
import { DriveBand, SpillBlock } from './RoadtripSidebarDriveBands'
|
||||
import { BookendStop, BookingChips, RideBlock, TerminalStop, UndatedRides } from './RoadtripSidebarBookingRows'
|
||||
import { RouteViaStop, ServiceStop, Stop } from './RoadtripSidebarStopRows'
|
||||
import { RouteViaStop, ServiceStop, Stop, type StopVehicle } from './RoadtripSidebarStopRows'
|
||||
import { DayHeader, TripSummary } from './RoadtripSidebarHeaders'
|
||||
|
||||
interface RoadtripSidebarProps {
|
||||
@@ -138,8 +138,19 @@ const RAIL_NARROW_PX = 330
|
||||
* move, a stay edit or a refuel offer still names the day the server knows it by. See
|
||||
* `nightSpill.ts`.
|
||||
*/
|
||||
function DaySection({ day, selectedAssignmentId, onSelectStop, onOpenBooking, canEditBookings, reservations, dayOrder, stopDays, onReorderStop, onMoveStopToDay, drag, onAskAlternatives, openAlternatives, onEditStay, onSetStopKind, onSetStopFill, onFollowTrack, viaCount, trackName, refuel, onAskRefuel, onAcceptRefuel, loading, collapsed, onToggle, onFocusPoint, narrow }: {
|
||||
export function DaySection({ day, selectedAssignmentId, onSelectStop, onOpenBooking, canEditBookings, reservations, dayOrder, stopDays, onReorderStop, onMoveStopToDay, drag, onAskAlternatives, openAlternatives, onEditStay, onSetStopKind, onSetStopFill, onFollowTrack, viaCount, trackName, refuel, onAskRefuel, onAcceptRefuel, loading, collapsed, onToggle, onFocusPoint, narrow, chargingOf, vehicle, dayColors, flush }: {
|
||||
onFocusPoint?: RoadtripSidebarProps['onFocusPoint']
|
||||
/**
|
||||
* What a charger's row shows of its availability, for a day that is a snapshot (the
|
||||
* assistant's card). Absent asks the live badge, as the rail does.
|
||||
*/
|
||||
chargingOf?: (stop: RoadtripStop) => React.ReactNode
|
||||
/** The vehicle the day was worked out for, when it is not the trip's saved one. */
|
||||
vehicle?: StopVehicle
|
||||
/** Whether days wear their own colour, when the day is not drawn from the saved settings. */
|
||||
dayColors?: boolean
|
||||
/** Without the rail's side margins, for a card that sits inside another surface. */
|
||||
flush?: boolean
|
||||
/** The rail is pulled too narrow for every badge; the stop count gives way. */
|
||||
narrow?: boolean
|
||||
day: RoadtripDay
|
||||
@@ -378,6 +389,8 @@ function DaySection({ day, selectedAssignmentId, onSelectStop, onOpenBooking, ca
|
||||
{service ? (
|
||||
<ServiceStop
|
||||
stop={stop}
|
||||
charging={chargingOf?.(stop)}
|
||||
vehicle={vehicle}
|
||||
entry={day.schedule.entries[i]}
|
||||
late={lateness}
|
||||
driveFindings={findingsFor(i)}
|
||||
@@ -393,6 +406,8 @@ function DaySection({ day, selectedAssignmentId, onSelectStop, onOpenBooking, ca
|
||||
) : (
|
||||
<Stop
|
||||
stop={stop}
|
||||
charging={chargingOf?.(stop)}
|
||||
vehicle={vehicle}
|
||||
number={counted}
|
||||
entry={day.schedule.entries[i]}
|
||||
late={lateness}
|
||||
@@ -456,8 +471,8 @@ function DaySection({ day, selectedAssignmentId, onSelectStop, onOpenBooking, ca
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="mx-3.5 shrink-0 overflow-hidden rounded-2xl border border-edge-faint bg-surface-card">
|
||||
<DayHeader day={day} collapsed={collapsed} onToggle={onToggle} narrow={narrow} onFollowTrack={onFollowTrack} viaCount={viaCount} trackName={trackName} />
|
||||
<section className={`${flush ? '' : 'mx-3.5 '}shrink-0 overflow-hidden rounded-2xl border border-edge-faint bg-surface-card`}>
|
||||
<DayHeader day={day} collapsed={collapsed} onToggle={onToggle} narrow={narrow} onFollowTrack={onFollowTrack} viaCount={viaCount} trackName={trackName} dayColors={dayColors} />
|
||||
{/* One list item per stop, with the drive that follows it inside — the chain is a
|
||||
list of places, not of alternating places and connectors. A service stop owns
|
||||
the drive leaving it in exactly the same way, which is what splits its leg into
|
||||
@@ -532,7 +547,7 @@ function DaySection({ day, selectedAssignmentId, onSelectStop, onOpenBooking, ca
|
||||
}
|
||||
|
||||
/** The stop in flight and the row it is hovering, shared by every day in the rail. */
|
||||
interface DragState {
|
||||
export interface DragState {
|
||||
from: { dayId: number; index: number; assignmentId: number } | null
|
||||
setFrom: (v: DragState['from']) => void
|
||||
dropAt: { dayId: number; index: number } | null
|
||||
|
||||
@@ -136,7 +136,7 @@ function flagTexts(day: RoadtripDay, followable: boolean, t: ReturnType<typeof u
|
||||
* The day's number on a raised tile, the way the day plan badges a day, with its date
|
||||
* folded in under it where the day plan keeps the weather.
|
||||
*/
|
||||
function DayTile({ day, tint }: { day: RoadtripDay; tint: string | null }): React.ReactElement {
|
||||
export function DayTile({ day, tint }: { day: RoadtripDay; tint: string | null }): React.ReactElement {
|
||||
const { language } = useTranslation()
|
||||
const is12h = useSettingsStore(s => s.settings.time_format) === "12h"
|
||||
return (
|
||||
@@ -229,8 +229,10 @@ const HEAD_HOVER = 'color-mix(in srgb, var(--accent) 10%, transparent)'
|
||||
* At module scope on purpose: declared inside the card it would remount on every render
|
||||
* and drop the keyboard focus on the fold control.
|
||||
*/
|
||||
export function DayHeader({ day, collapsed, onToggle, onFollowTrack, viaCount, trackName }: Readonly<{
|
||||
export function DayHeader({ day, collapsed, onToggle, onFollowTrack, viaCount, trackName, dayColors }: Readonly<{
|
||||
day: RoadtripDay
|
||||
/** Whether days wear their own colour, when the drive shown is not the trip's saved one. Absent reads the setting. */
|
||||
dayColors?: boolean
|
||||
/** Folded down to the header, and off the map with it. */
|
||||
collapsed?: boolean
|
||||
onToggle?: () => void
|
||||
@@ -245,7 +247,7 @@ export function DayHeader({ day, collapsed, onToggle, onFollowTrack, viaCount, t
|
||||
// The colour the map draws this day in, or none while the map draws one blue line for
|
||||
// the whole trip. With it on, the tile wears the colour and the band a tenth of it, so
|
||||
// a green line on the map finds its card.
|
||||
const dayColorsOn = useRoadtripSettings(s => !!s.roadtrip_day_colors)
|
||||
const dayColorsOn = useRoadtripSettings(s => dayColors ?? !!s.roadtrip_day_colors)
|
||||
const tint = dayColorsOn ? dayColor(day.dayNumber).line : null
|
||||
const rest = tint ? `color-mix(in srgb, ${tint} 11%, transparent)` : HEAD_REST
|
||||
const hover = tint ? `color-mix(in srgb, ${tint} 17%, transparent)` : HEAD_HOVER
|
||||
|
||||
@@ -4,7 +4,7 @@ import ChargingInfo from './ChargingInfo'
|
||||
import { useRoadtripSettings } from '../../hooks/useRoadtripSettings'
|
||||
import { useTranslation } from '../../i18n/TranslationContext'
|
||||
import { Tooltip } from '../shared/Tooltip'
|
||||
import { formatDurationShort, refuelsRange, serviceColor, type ScheduleEntry, type ScheduleWarning } from './roadtripModel'
|
||||
import { formatDurationShort, refuelsRange, serviceColor, type ScheduleEntry, type ScheduleWarning, type VehicleKind } from './roadtripModel'
|
||||
import { STOP_KIND_BY_KEY } from './stopKinds'
|
||||
import { spurWorthLabelling } from './accessSpur'
|
||||
import { useVehicleRange } from './useVehicleRange'
|
||||
@@ -26,6 +26,23 @@ export interface StopBookings {
|
||||
onOpenBooking?: (reservationId: number) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* The vehicle a drive was worked out for, when the row is not about the trip's saved
|
||||
* settings: the assistant's card of a preview carries its own. Absent reads the settings.
|
||||
*/
|
||||
export interface StopVehicle {
|
||||
kind: VehicleKind | null
|
||||
/** The fill the trip's setting gives every stop without one of its own, 1 to 100. */
|
||||
fill: number | null
|
||||
}
|
||||
|
||||
/** What a stop's row takes besides its bookings: the charger's badges and the vehicle, both read live when absent. */
|
||||
interface StopSnapshot {
|
||||
/** What a charger shows of its availability. Absent asks the live badge; null shows none. */
|
||||
charging?: React.ReactNode
|
||||
vehicle?: StopVehicle
|
||||
}
|
||||
|
||||
/**
|
||||
* What a stop will actually fill to: its own figure, else the traveller's default.
|
||||
*
|
||||
@@ -44,7 +61,7 @@ function effectiveFill(own: number | null | undefined, setting: number | undefin
|
||||
* apart. It renders the bare span and nothing around it, so a stop's markup is exactly
|
||||
* what it was when each shape drew the row itself.
|
||||
*/
|
||||
function StopBadgeRow({ stop, entry, late, driveFindings, onEditStay, onPickFill, bookings, canEditBookings, onOpenBooking }: Readonly<StopBookings & {
|
||||
function StopBadgeRow({ stop, entry, late, driveFindings, onEditStay, onPickFill, bookings, canEditBookings, onOpenBooking, vehicle }: Readonly<StopBookings & Pick<StopSnapshot, 'vehicle'> & {
|
||||
stop: RoadtripStop
|
||||
entry: ScheduleEntry | undefined
|
||||
late: ScheduleWarning[]
|
||||
@@ -54,8 +71,10 @@ function StopBadgeRow({ stop, entry, late, driveFindings, onEditStay, onPickFill
|
||||
}>): React.ReactElement {
|
||||
// Read here rather than threaded down from the rail: the fill badge is the only thing in
|
||||
// it that depends on them.
|
||||
const fillPercent = useRoadtripSettings(s => s.roadtrip_fill_percent)
|
||||
const { vehicleKind } = useVehicleRange()
|
||||
const savedFill = useRoadtripSettings(s => s.roadtrip_fill_percent)
|
||||
const { vehicleKind: savedKind } = useVehicleRange()
|
||||
const fillPercent = vehicle ? vehicle.fill ?? undefined : savedFill
|
||||
const vehicleKind = vehicle ? vehicle.kind : savedKind
|
||||
const is12h = useSettingsStore(s => s.settings.time_format) === '12h'
|
||||
const arrival = entry?.arrival ? formatClockTime(entry.arrival, is12h) : null
|
||||
return (
|
||||
@@ -87,7 +106,7 @@ function StopBadgeRow({ stop, entry, late, driveFindings, onEditStay, onPickFill
|
||||
* the trip is actually for. Its own icon on one flat disc: three kinds of pause that all
|
||||
* mean "we are still driving", and the icon is what tells them apart.
|
||||
*/
|
||||
export function ServiceStop({ stop, entry, late, driveFindings, selected, onSelect, onEditStay, onPickKind, onPickFill, bookings, canEditBookings, onOpenBooking }: StopBookings & {
|
||||
export function ServiceStop({ stop, entry, late, driveFindings, selected, onSelect, onEditStay, onPickKind, onPickFill, bookings, canEditBookings, onOpenBooking, charging, vehicle }: StopBookings & StopSnapshot & {
|
||||
stop: RoadtripStop
|
||||
entry: ScheduleEntry | undefined
|
||||
/** How late the drive reaches a time pinned on this pause, or the time it was set to
|
||||
@@ -171,9 +190,9 @@ export function ServiceStop({ stop, entry, late, driveFindings, selected, onSele
|
||||
className="flex min-w-0 items-center gap-2 font-semibold leading-6 tracking-[-0.012em] text-content-secondary"
|
||||
style={{ fontSize: FS.name }}
|
||||
>
|
||||
<span className="min-w-0 truncate">{stop.name}</span>{stop.stopType === 'charging' && <ChargingInfo placeId={stop.placeId} compact />}
|
||||
<span className="min-w-0 truncate">{stop.name}</span>{stop.stopType === 'charging' && (charging === undefined ? <ChargingInfo placeId={stop.placeId} compact /> : charging)}
|
||||
</span>
|
||||
<StopBadgeRow stop={stop} entry={entry} late={late} driveFindings={driveFindings} onEditStay={onEditStay} onPickFill={onPickFill} bookings={bookings} canEditBookings={canEditBookings} onOpenBooking={onOpenBooking} />
|
||||
<StopBadgeRow stop={stop} entry={entry} late={late} driveFindings={driveFindings} onEditStay={onEditStay} onPickFill={onPickFill} bookings={bookings} canEditBookings={canEditBookings} onOpenBooking={onOpenBooking} vehicle={vehicle} />
|
||||
</span>
|
||||
{entry?.arrival ? <Arrival entry={entry} /> : null}
|
||||
</button>
|
||||
@@ -227,7 +246,7 @@ export function RouteViaStop({ via }: { via: RouteVia }): React.ReactElement {
|
||||
)
|
||||
}
|
||||
|
||||
export function Stop({ stop, number, entry, late, driveFindings, selected, continues, starts, onSelect, onMove, canMove, onEditStay, onPickKind, onPickFill, bookings, canEditBookings, onOpenBooking }: StopBookings & {
|
||||
export function Stop({ stop, number, entry, late, driveFindings, selected, continues, starts, onSelect, onMove, canMove, onEditStay, onPickKind, onPickFill, bookings, canEditBookings, onOpenBooking, charging, vehicle }: StopBookings & StopSnapshot & {
|
||||
stop: RoadtripStop
|
||||
/** Position within the day: the same count the map badges its markers with. */
|
||||
number: number
|
||||
@@ -324,7 +343,7 @@ export function Stop({ stop, number, entry, late, driveFindings, selected, conti
|
||||
className="flex min-w-0 items-center gap-2 font-semibold leading-6 tracking-[-0.012em] text-content"
|
||||
style={{ fontSize: FS.name }}
|
||||
>
|
||||
<span className={stop.stopType === 'charging' ? 'min-w-0 truncate' : 'min-w-0 break-words'}>{stop.name}</span>{stop.stopType === 'charging' && <ChargingInfo placeId={stop.placeId} compact />}
|
||||
<span className={stop.stopType === 'charging' ? 'min-w-0 truncate' : 'min-w-0 break-words'}>{stop.name}</span>{stop.stopType === 'charging' && (charging === undefined ? <ChargingInfo placeId={stop.placeId} compact /> : charging)}
|
||||
</span>
|
||||
{/* Two halves under one border: the word says what the number means, so the
|
||||
number needs no unit of explanation beside it. */}
|
||||
@@ -332,7 +351,7 @@ export function Stop({ stop, number, entry, late, driveFindings, selected, conti
|
||||
"what does this stop cost", and the second only appears when the gap is far
|
||||
enough to change the plan. The dashed line on the map already says there is
|
||||
one; the number is for luggage, a gate, a track a hire car should not be on. */}
|
||||
<StopBadgeRow stop={stop} entry={entry} late={late} driveFindings={driveFindings} onEditStay={onEditStay} onPickFill={onPickFill} bookings={bookings} canEditBookings={canEditBookings} onOpenBooking={onOpenBooking} />
|
||||
<StopBadgeRow stop={stop} entry={entry} late={late} driveFindings={driveFindings} onEditStay={onEditStay} onPickFill={onPickFill} bookings={bookings} canEditBookings={canEditBookings} onOpenBooking={onOpenBooking} vehicle={vehicle} />
|
||||
</span>
|
||||
{entry?.arrival ? <Arrival entry={entry} /> : null}
|
||||
</span>
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
/**
|
||||
* FE-ROADTRIP-SNAPSHOT-001 to FE-ROADTRIP-SNAPSHOT-005
|
||||
*
|
||||
* The rail's pieces drawn from a snapshot, as the assistant's road trip card
|
||||
* draws them: a charger's badges handed in instead of asked live, the
|
||||
* vehicle the drive was worked out for instead of the saved one, the day's
|
||||
* colour as the drive had it, and the day card without the rail's margins.
|
||||
*/
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import type { ReactElement } from 'react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { preferences, resetRailStores, seedRailSettings } from '../../../tests/helpers/roadtripRail';
|
||||
import { TranslationProvider } from '../../i18n';
|
||||
import { ChargingBadges } from './ChargingInfo';
|
||||
import { DaySection } from './RoadtripSidebar';
|
||||
import { DayHeader } from './RoadtripSidebarHeaders';
|
||||
import { ServiceStop, Stop } from './RoadtripSidebarStopRows';
|
||||
import type { RoadtripDay, RoadtripStop } from './useRoadtripRoutes';
|
||||
|
||||
vi.mock('../../hooks/useElementSize', () => ({
|
||||
useElementSize: () => ({ ref: () => undefined, width: 0, height: 0 }),
|
||||
}));
|
||||
vi.mock('./ChargingInfo', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('./ChargingInfo')>();
|
||||
const { createElement } = await import('react');
|
||||
return { ...actual, default: () => createElement('span', null, 'live charger') };
|
||||
});
|
||||
|
||||
const wrap = (ui: ReactElement) => render(<TranslationProvider>{ui}</TranslationProvider>);
|
||||
|
||||
beforeEach(() => {
|
||||
seedRailSettings();
|
||||
preferences({ roadtrip_vehicle: 'electric', roadtrip_fill_percent: 80 });
|
||||
});
|
||||
afterEach(() => resetRailStores());
|
||||
|
||||
function stop(over: Partial<RoadtripStop> = {}): RoadtripStop {
|
||||
return {
|
||||
assignmentId: 1,
|
||||
ownerDayId: 1,
|
||||
ownerIndex: 0,
|
||||
placeId: 10,
|
||||
name: 'Ionity Allertal',
|
||||
lat: 52.1,
|
||||
lng: 10.1,
|
||||
time: null,
|
||||
dwellMinutes: null,
|
||||
legMode: null,
|
||||
incomingLegMode: null,
|
||||
stopType: 'charging',
|
||||
...over,
|
||||
};
|
||||
}
|
||||
|
||||
function day(over: Partial<RoadtripDay> = {}): RoadtripDay {
|
||||
return {
|
||||
dayId: 3,
|
||||
dayNumber: 2,
|
||||
date: null,
|
||||
title: 'Hamburg to Hanover',
|
||||
stops: [
|
||||
stop({ name: 'Hamburg', stopType: null }),
|
||||
stop({ assignmentId: 2, placeId: 20, name: 'Hanover', stopType: null }),
|
||||
],
|
||||
legs: [
|
||||
{
|
||||
mid: [0, 0],
|
||||
from: [0, 0],
|
||||
to: [0, 0],
|
||||
distance: 150_000,
|
||||
duration: 5400,
|
||||
walkingText: '',
|
||||
drivingText: '',
|
||||
distanceText: '',
|
||||
},
|
||||
],
|
||||
schedule: {
|
||||
entries: [
|
||||
{ arrival: null, departure: null, anchored: false, dayOffset: 0 },
|
||||
{ arrival: null, departure: null, anchored: false, dayOffset: 0 },
|
||||
],
|
||||
warnings: [],
|
||||
},
|
||||
legVias: [],
|
||||
geometry: [],
|
||||
distance: 150_000,
|
||||
duration: 5400,
|
||||
driveWarnings: [],
|
||||
dayWarning: null,
|
||||
...over,
|
||||
};
|
||||
}
|
||||
|
||||
const NO_DRAG = { from: null, setFrom: () => undefined, dropAt: null, setDropAt: () => undefined };
|
||||
|
||||
describe('rail rows from a snapshot', () => {
|
||||
it('FE-ROADTRIP-SNAPSHOT-001: a charger shows the badges handed in, none for null, the live ones when left out', () => {
|
||||
const { rerender } = wrap(
|
||||
<ServiceStop stop={stop()} entry={undefined} late={[]} selected={false} charging={<span>snapshot</span>} />
|
||||
);
|
||||
expect(screen.getByText('snapshot')).toBeInTheDocument();
|
||||
expect(screen.queryByText('live charger')).not.toBeInTheDocument();
|
||||
rerender(
|
||||
<TranslationProvider>
|
||||
<ServiceStop stop={stop()} entry={undefined} late={[]} selected={false} charging={null} />
|
||||
</TranslationProvider>
|
||||
);
|
||||
expect(screen.queryByText('live charger')).not.toBeInTheDocument();
|
||||
rerender(
|
||||
<TranslationProvider>
|
||||
<ServiceStop stop={stop()} entry={undefined} late={[]} selected={false} />
|
||||
</TranslationProvider>
|
||||
);
|
||||
expect(screen.getByText('live charger')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-ROADTRIP-SNAPSHOT-002: the fill badge follows the vehicle handed in, not the saved one', () => {
|
||||
const { rerender } = wrap(
|
||||
<Stop stop={stop()} number={1} entry={undefined} late={[]} selected={false} continues={false} charging={null} />
|
||||
);
|
||||
expect(screen.getByText('80 %')).toBeInTheDocument();
|
||||
rerender(
|
||||
<TranslationProvider>
|
||||
<Stop
|
||||
stop={stop()}
|
||||
number={1}
|
||||
entry={undefined}
|
||||
late={[]}
|
||||
selected={false}
|
||||
continues={false}
|
||||
charging={null}
|
||||
vehicle={{ kind: 'combustion', fill: null }}
|
||||
/>
|
||||
</TranslationProvider>
|
||||
);
|
||||
expect(screen.queryByText('80 %')).not.toBeInTheDocument();
|
||||
rerender(
|
||||
<TranslationProvider>
|
||||
<Stop
|
||||
stop={stop()}
|
||||
number={1}
|
||||
entry={undefined}
|
||||
late={[]}
|
||||
selected={false}
|
||||
continues={false}
|
||||
charging={null}
|
||||
vehicle={{ kind: 'electric', fill: 60 }}
|
||||
/>
|
||||
</TranslationProvider>
|
||||
);
|
||||
expect(screen.getByText('60 %')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-ROADTRIP-SNAPSHOT-003: the day wears its colour when the drive had colours, whatever the saved setting', () => {
|
||||
const tinted = /^color-mix\(in srgb, .+ 11%, transparent\)$/;
|
||||
const { container, unmount } = wrap(<DayHeader day={day()} dayColors />);
|
||||
expect(container.querySelector('header')?.style.background).toMatch(tinted);
|
||||
unmount();
|
||||
preferences({ roadtrip_day_colors: true });
|
||||
const plain = wrap(<DayHeader day={day()} dayColors={false} />);
|
||||
expect(plain.container.querySelector('header')?.style.background).not.toMatch(tinted);
|
||||
});
|
||||
|
||||
it('FE-ROADTRIP-SNAPSHOT-004: the day card sits flush in another surface and its stops are read only', () => {
|
||||
const { container } = wrap(<DaySection day={day()} drag={NO_DRAG} flush dayColors={false} />);
|
||||
const section = container.querySelector('section');
|
||||
expect(section).not.toHaveClass('mx-3.5');
|
||||
expect(screen.getByText('Hamburg to Hanover')).toBeInTheDocument();
|
||||
expect(screen.getByText('Hanover')).toBeInTheDocument();
|
||||
expect(container.querySelector('[draggable="true"]')).toBeNull();
|
||||
});
|
||||
|
||||
it('FE-ROADTRIP-SNAPSHOT-005: the compact badges read the free points of all, or a question mark, and the price', () => {
|
||||
const { rerender } = wrap(
|
||||
<ChargingBadges label="4/6 available" known available={4} total={6} energy={{ price: 0.59, currency: 'EUR' }} />
|
||||
);
|
||||
expect(screen.getByText('4/6')).toHaveClass('bg-success-soft');
|
||||
expect(screen.getByText(/kWh\*/)).toBeInTheDocument();
|
||||
rerender(
|
||||
<TranslationProvider>
|
||||
<ChargingBadges label="Status outdated" known={false} available={null} total={6} energy={null} />
|
||||
</TranslationProvider>
|
||||
);
|
||||
expect(screen.getByText('?')).toBeInTheDocument();
|
||||
expect(screen.queryByText(/kWh/)).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* FE-AI-RT-040
|
||||
*
|
||||
* The chat's link into the road trip: on the desktop, where the road trip
|
||||
* is a view of the plan, `?tab=roadtrip` switches that view on, once and
|
||||
* never off; the phone's road trip tab, a view already on and a planner
|
||||
* without the addon are left as they are.
|
||||
*/
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import type { DeepLinkProps } from './deepLinkTypes';
|
||||
import { useRoadtripDeepLink } from './useRoadtripDeepLink';
|
||||
|
||||
function links(query: string, planner: Record<string, unknown>): DeepLinkProps {
|
||||
return {
|
||||
planner: planner as unknown as DeepLinkProps['planner'],
|
||||
workspace: {} as DeepLinkProps['workspace'],
|
||||
searchParams: new URLSearchParams(query),
|
||||
setSearchParams: vi.fn(),
|
||||
};
|
||||
}
|
||||
|
||||
function plannerOf(over: Record<string, unknown> = {}) {
|
||||
return {
|
||||
TRIP_TABS: [{ id: 'plan' }],
|
||||
enabledAddons: { roadtrip: true },
|
||||
roadtripMode: false,
|
||||
toggleRoadtripMode: vi.fn(),
|
||||
...over,
|
||||
};
|
||||
}
|
||||
|
||||
describe('useRoadtripDeepLink', () => {
|
||||
it('FE-AI-RT-040: switches the road trip view on for ?tab=roadtrip on the desktop, and only there', () => {
|
||||
const desktop = plannerOf();
|
||||
renderHook(() => useRoadtripDeepLink(links('?tab=roadtrip&day=31', desktop)));
|
||||
expect(desktop.toggleRoadtripMode).toHaveBeenCalledTimes(1);
|
||||
|
||||
const on = plannerOf({ roadtripMode: true });
|
||||
renderHook(() => useRoadtripDeepLink(links('?tab=roadtrip', on)));
|
||||
expect(on.toggleRoadtripMode).not.toHaveBeenCalled();
|
||||
|
||||
const phone = plannerOf({ TRIP_TABS: [{ id: 'plan' }, { id: 'roadtrip' }] });
|
||||
renderHook(() => useRoadtripDeepLink(links('?tab=roadtrip', phone)));
|
||||
expect(phone.toggleRoadtripMode).not.toHaveBeenCalled();
|
||||
|
||||
const off = plannerOf({ enabledAddons: { roadtrip: false } });
|
||||
renderHook(() => useRoadtripDeepLink(links('?tab=roadtrip', off)));
|
||||
expect(off.toggleRoadtripMode).not.toHaveBeenCalled();
|
||||
|
||||
const other = plannerOf();
|
||||
renderHook(() => useRoadtripDeepLink(links('?tab=buchungen', other)));
|
||||
expect(other.toggleRoadtripMode).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -1,9 +1,22 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import type { DeepLinkProps } from './deepLinkTypes';
|
||||
|
||||
/**
|
||||
* Where the road trip opens a stop or a day the chat points at. Nothing yet: the road trip cards
|
||||
* fill it in, and until then the planner keeps its own links.
|
||||
* Where the chat opens the road trip (`?tab=roadtrip`, with `?day=` for the
|
||||
* day a change touched). The phone has a road trip tab and the tab link takes
|
||||
* it there; the desktop has none, the road trip being a view of the plan, so
|
||||
* the link switches that view on, once and never off, and the plan's tab
|
||||
* shows it. A planner without the road trip addon stays as it is.
|
||||
*/
|
||||
export function useRoadtripDeepLink(_links: DeepLinkProps): void {
|
||||
// Filled in by the road trip cards.
|
||||
export function useRoadtripDeepLink({ planner, searchParams }: DeepLinkProps): void {
|
||||
const asked = searchParams.get('tab') === 'roadtrip';
|
||||
const hasTab = planner.TRIP_TABS.some((tab) => tab.id === 'roadtrip');
|
||||
const addonOn = !!planner.enabledAddons.roadtrip;
|
||||
const { roadtripMode, toggleRoadtripMode } = planner;
|
||||
|
||||
useEffect(() => {
|
||||
if (!asked || hasTab || !addonOn || roadtripMode) return;
|
||||
toggleRoadtripMode();
|
||||
}, [asked, hasTab, addonOn, roadtripMode, toggleRoadtripMode]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
import type { ChargingCard, RoadtripCard, RoadtripCardDay, RoadtripCardStop } from '@trek/shared';
|
||||
|
||||
/**
|
||||
* Road trip cards as the server builds them, for the road trip card tests: a
|
||||
* day from Munich over a charger to the airport, a flight to Rome and the
|
||||
* night booked there, and a second day on to Florence.
|
||||
*/
|
||||
|
||||
export function cardStop(name: string, extra: Partial<RoadtripCardStop> = {}): RoadtripCardStop {
|
||||
return {
|
||||
placeId: 1,
|
||||
assignmentId: 10,
|
||||
name,
|
||||
lat: 48.137,
|
||||
lng: 11.575,
|
||||
stopType: null,
|
||||
time: null,
|
||||
leaveAt: null,
|
||||
dwellMinutes: 30,
|
||||
offRoadM: null,
|
||||
fillPercent: null,
|
||||
night: null,
|
||||
autoNight: null,
|
||||
bookend: null,
|
||||
carrier: null,
|
||||
arrival: '08:00',
|
||||
departure: '08:30',
|
||||
anchored: false,
|
||||
dayOffset: 0,
|
||||
late: [],
|
||||
findings: [],
|
||||
...extra,
|
||||
};
|
||||
}
|
||||
|
||||
export const MUNICH_DAY: RoadtripCardDay = {
|
||||
dayId: 31,
|
||||
dayNumber: 1,
|
||||
date: '2026-10-01',
|
||||
title: 'Munich to Rome',
|
||||
distanceM: 110_000,
|
||||
durationS: 12_300,
|
||||
stops: [
|
||||
cardStop('Munich'),
|
||||
cardStop('Ionity Holzkirchen', {
|
||||
placeId: 2,
|
||||
assignmentId: 20,
|
||||
lat: 47.883,
|
||||
lng: 11.701,
|
||||
stopType: 'charging',
|
||||
arrival: '09:00',
|
||||
departure: '09:30',
|
||||
findings: [{ code: 'leg', overMinutes: 25, sinceKm: null }],
|
||||
}),
|
||||
cardStop('Munich Airport', {
|
||||
placeId: null,
|
||||
assignmentId: null,
|
||||
lat: 48.354,
|
||||
lng: 11.786,
|
||||
carrier: { reservationId: 9, type: 'flight', role: 'departure', title: 'LH 1840', code: 'MUC', at: '11:05' },
|
||||
arrival: '10:15',
|
||||
late: [{ code: 'late', minutes: 15 }],
|
||||
}),
|
||||
cardStop('Rome Fiumicino', {
|
||||
placeId: null,
|
||||
assignmentId: null,
|
||||
lat: 41.8,
|
||||
lng: 12.25,
|
||||
carrier: { reservationId: 9, type: 'flight', role: 'arrival', title: 'LH 1840', code: 'FCO', at: '12:50' },
|
||||
arrival: '12:50',
|
||||
}),
|
||||
cardStop('Hotel Roma', {
|
||||
placeId: 5,
|
||||
assignmentId: null,
|
||||
lat: 41.9,
|
||||
lng: 12.5,
|
||||
stopType: 'hotel',
|
||||
bookend: {
|
||||
phase: 'evening',
|
||||
reservationId: null,
|
||||
checkingIn: true,
|
||||
checkingOut: false,
|
||||
checkIn: '15:00',
|
||||
checkOut: null,
|
||||
},
|
||||
arrival: '14:00',
|
||||
departure: null,
|
||||
}),
|
||||
],
|
||||
moreStops: 2,
|
||||
legs: [
|
||||
{ distanceM: 30_000, durationS: 1800, mode: 'driving' },
|
||||
{ distanceM: 52_000, durationS: 2700, mode: 'driving' },
|
||||
{ distanceM: 0, durationS: 6300, mode: 'flight' },
|
||||
{ distanceM: 28_000, durationS: 1500, mode: 'driving' },
|
||||
],
|
||||
dayOver: { minutes: 400, limitMinutes: 360 },
|
||||
avoidMissed: ['toll'],
|
||||
dryKm: null,
|
||||
lines: [
|
||||
[
|
||||
[48.137, 11.575],
|
||||
[47.883, 11.701],
|
||||
[48.354, 11.786],
|
||||
],
|
||||
[
|
||||
[41.8, 12.25],
|
||||
[41.9, 12.5],
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
export const FLORENCE_DAY: RoadtripCardDay = {
|
||||
dayId: 32,
|
||||
dayNumber: 2,
|
||||
date: '2026-10-02',
|
||||
title: null,
|
||||
distanceM: 275_000,
|
||||
durationS: 10_800,
|
||||
stops: [
|
||||
cardStop('Rome', { placeId: 6, assignmentId: 60, lat: 41.9, lng: 12.5 }),
|
||||
cardStop('Florence', { placeId: 7, assignmentId: 70, lat: 43.77, lng: 11.25, arrival: '12:30', departure: null }),
|
||||
],
|
||||
moreStops: 0,
|
||||
legs: [{ distanceM: 275_000, durationS: 10_800, mode: 'driving' }],
|
||||
dayOver: null,
|
||||
avoidMissed: [],
|
||||
dryKm: null,
|
||||
lines: [
|
||||
[
|
||||
[41.9, 12.5],
|
||||
[43.77, 11.25],
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
export const DRIVE: RoadtripCard = {
|
||||
kind: 'roadtrip',
|
||||
complete: true,
|
||||
problem: null,
|
||||
previewKeys: [],
|
||||
vehicle: 'electric',
|
||||
defaultFill: 80,
|
||||
dayColors: true,
|
||||
distanceM: 385_000,
|
||||
durationS: 23_100,
|
||||
stopCount: 7,
|
||||
chargingCount: 1,
|
||||
days: [MUNICH_DAY, FLORENCE_DAY],
|
||||
moreDays: 3,
|
||||
quietDays: 0,
|
||||
undatedRides: 0,
|
||||
};
|
||||
|
||||
export function charger(extra: Partial<ChargingCard> = {}): ChargingCard {
|
||||
return {
|
||||
kind: 'charging',
|
||||
placeId: 2,
|
||||
name: 'Ionity Holzkirchen',
|
||||
station: null,
|
||||
lat: 47.883,
|
||||
lng: 11.701,
|
||||
status: 'ok',
|
||||
stale: false,
|
||||
available: 4,
|
||||
total: 6,
|
||||
checkedAt: '2026-10-01T07:38:00Z',
|
||||
updatedAt: null,
|
||||
energy: { amount: 0.59, currency: 'EUR' },
|
||||
otherPrices: 1,
|
||||
source: 'MobiData BW',
|
||||
license: 'CC BY 4.0',
|
||||
...extra,
|
||||
};
|
||||
}
|
||||
@@ -22,6 +22,14 @@ import {
|
||||
PACKAGE_HELD_READS,
|
||||
TOOL_CARDS,
|
||||
} from './cards/registry';
|
||||
import {
|
||||
ItineraryShelves,
|
||||
KeptItineraries,
|
||||
restoreItinerary,
|
||||
searchAgainArgs,
|
||||
TRANSIT_CREATE_TOOL,
|
||||
TRANSIT_SEARCH_TOOL,
|
||||
} from './cards/roadtrip/transit-restore';
|
||||
import { MikroORM } from '@mikro-orm/core';
|
||||
import { Client } from '@modelcontextprotocol/sdk/client/index';
|
||||
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory';
|
||||
@@ -173,6 +181,8 @@ export class AssistantToolSession {
|
||||
private readonly tripId: number,
|
||||
private readonly audit: (toolName: string) => void,
|
||||
private readonly mode: SessionMode,
|
||||
/** The itineraries the user's transit searches on this trip answered with, kept across turns. */
|
||||
private readonly itineraries: KeptItineraries = new KeptItineraries(),
|
||||
) {}
|
||||
|
||||
/** The groups this turn loaded; the core is always there. */
|
||||
@@ -223,11 +233,28 @@ export class AssistantToolSession {
|
||||
/** Runs a tool on the user's behalf (a read the model asked for, an applied change, an undo), audited. */
|
||||
async call(name: string, args: ToolArgs): Promise<ToolRun> {
|
||||
if (name === USE_TOOLS_TOOL) return this.load(args);
|
||||
const run = await this.invoke(name, args);
|
||||
const final = name === TRANSIT_CREATE_TOOL ? await this.withFoundItinerary(args) : args;
|
||||
const run = await this.invoke(name, final);
|
||||
this.audit(name);
|
||||
if (name === TRANSIT_SEARCH_TOOL && run.ok) this.itineraries.keep(run.value);
|
||||
return run;
|
||||
}
|
||||
|
||||
/**
|
||||
* The model never saw a connection's line; the search it took the
|
||||
* connection from did. The held call keeps the model's copy (the thread
|
||||
* never stores a line), and the search's own itinerary goes in only now.
|
||||
* One no longer kept is searched for again, as a read for the server's use.
|
||||
*/
|
||||
private async withFoundItinerary(args: ToolArgs): Promise<ToolArgs> {
|
||||
const restored = restoreItinerary(this.itineraries, args);
|
||||
const again = searchAgainArgs(args);
|
||||
if (restored !== args || !again || !this.tools.has(TRANSIT_SEARCH_TOOL)) return restored;
|
||||
const run = await this.invoke(TRANSIT_SEARCH_TOOL, again);
|
||||
if (run.ok) this.itineraries.keep(run.value);
|
||||
return restoreItinerary(this.itineraries, args);
|
||||
}
|
||||
|
||||
/** Reads for the server's own use (the trip card, the undo check), not audited as the user's calls. */
|
||||
read(name: string, args: ToolArgs = {}): Promise<ToolRun> {
|
||||
return this.invoke(name, args);
|
||||
@@ -274,6 +301,9 @@ export class AssistantToolsService implements OnApplicationBootstrap {
|
||||
private readonly auditLog: AuditService,
|
||||
) {}
|
||||
|
||||
/** The itineraries transit searches found, per user and trip, for the applied change that adds one of them. */
|
||||
private readonly itineraries = new ItineraryShelves();
|
||||
|
||||
onApplicationBootstrap(): void {
|
||||
const problems = checkToolCatalog(this.registry.list());
|
||||
if (problems.length > 0) throw new Error(`Assistant tool catalog is out of date: ${problems.join('; ')}`);
|
||||
@@ -325,7 +355,9 @@ export class AssistantToolsService implements OnApplicationBootstrap {
|
||||
});
|
||||
}
|
||||
const mode: SessionMode = undoTargets ? 'undo' : 'turn';
|
||||
return new AssistantToolSession(client, server, tools, tripId, (name) => this.audit(userId, name), mode);
|
||||
const audit = (name: string) => this.audit(userId, name);
|
||||
const kept = this.itineraries.of(userId, tripId);
|
||||
return new AssistantToolSession(client, server, tools, tripId, audit, mode, kept);
|
||||
}
|
||||
|
||||
/** The audit row an MCP client's call writes, marked as the assistant's. A failed write never fails the call. */
|
||||
|
||||
@@ -1,4 +1,121 @@
|
||||
import type { DomainCards } from '../card-types';
|
||||
import { idIn, recordOf } from '../card-values';
|
||||
import {
|
||||
describeAddVia,
|
||||
describeAddVias,
|
||||
describeDayEnd,
|
||||
describeImportRoute,
|
||||
describeMoveVia,
|
||||
describeRemoveVia,
|
||||
describeRepinVias,
|
||||
describeSettings,
|
||||
describeTransit,
|
||||
} from './roadtrip-describe';
|
||||
import { roadtripAnswerCard } from './roadtrip-drive';
|
||||
import {
|
||||
chargingAnswerCard,
|
||||
corridorAnswerCard,
|
||||
googleRouteCard,
|
||||
transitAnswerCard,
|
||||
transitChangeCard,
|
||||
} from './roadtrip-reads';
|
||||
import {
|
||||
addViaCard,
|
||||
addViasCard,
|
||||
importRouteCard,
|
||||
loadDayVias,
|
||||
moveViaCard,
|
||||
removeViaCard,
|
||||
repinViasCard,
|
||||
} from './roadtrip-route';
|
||||
import { dayEndCard, loadSavedSettings, settingsCard } from './roadtrip-rules';
|
||||
import { REMOVE_ADDED_VIA } from './roadtrip-undo';
|
||||
|
||||
/** The cards of the road trip, its drives, charging and transit. None yet: this package fills them in. */
|
||||
export const ROADTRIP_CARDS: DomainCards = { id: 'roadtrip', tools: {} };
|
||||
/** The ids of the day's stops a Google Maps route import created (`assignment_ids`), the entity its receipt names. */
|
||||
function importedAssignmentIds(_args: unknown, result: unknown): number[] {
|
||||
const ids = recordOf(result).assignment_ids;
|
||||
return Array.isArray(ids) ? ids.filter((id): id is number => typeof id === 'number') : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* The road trip in the assistant chat: the drive calculate_roadtrip worked
|
||||
* out, drawn as the planner's rail; what a corridor search found along a
|
||||
* day; a charger as one look found it; transit connections; and a card for
|
||||
* every change that bends a drive, changes its settings, ends a day or takes
|
||||
* in a Google Maps route. The day endings and the Google Maps route tools
|
||||
* load with the road trip's own tools.
|
||||
*/
|
||||
export const ROADTRIP_CARDS: DomainCards = {
|
||||
id: 'roadtrip',
|
||||
tools: {
|
||||
// The geometry is the card's, never the model's: the redaction drops every key holding it.
|
||||
calculate_roadtrip: { argPolicy: { forced: { includeGeometry: true } }, answer: roadtripAnswerCard },
|
||||
search_roadtrip_corridor: { answer: corridorAnswerCard },
|
||||
get_roadtrip_charging_info: { answer: chargingAnswerCard },
|
||||
lookup_roadtrip_charging_info: { answer: chargingAnswerCard },
|
||||
search_transit_routes: { answer: transitAnswerCard },
|
||||
// A held read: its card is the receipt's, once the user let it fetch the link.
|
||||
preview_google_maps_route: { applied: ({ result }) => googleRouteCard(result) },
|
||||
add_route_via: {
|
||||
write: { verbKey: 'addRouteVia', entity: 'roadtrip' },
|
||||
describe: describeAddVia,
|
||||
change: addViaCard,
|
||||
appliedIds: (_args, result) => {
|
||||
const viaId = idIn(result, 'via');
|
||||
return viaId === null ? [] : [viaId];
|
||||
},
|
||||
undo: REMOVE_ADDED_VIA,
|
||||
},
|
||||
add_route_vias: {
|
||||
write: { verbKey: 'shapeRoute', entity: 'roadtrip' },
|
||||
load: loadDayVias,
|
||||
describe: describeAddVias,
|
||||
change: addViasCard,
|
||||
},
|
||||
update_route_via: {
|
||||
write: { verbKey: 'moveRouteVia', entity: 'roadtrip' },
|
||||
load: loadDayVias,
|
||||
describe: describeMoveVia,
|
||||
change: moveViaCard,
|
||||
},
|
||||
remove_route_via: {
|
||||
write: { verbKey: 'removeRouteVia', entity: 'roadtrip' },
|
||||
load: loadDayVias,
|
||||
describe: describeRemoveVia,
|
||||
change: removeViaCard,
|
||||
},
|
||||
reanchor_route_vias: {
|
||||
write: { verbKey: 'repinRouteVias', entity: 'roadtrip' },
|
||||
load: loadDayVias,
|
||||
describe: describeRepinVias,
|
||||
change: repinViasCard,
|
||||
},
|
||||
update_roadtrip_settings: {
|
||||
write: { verbKey: 'updateDriveSettings', entity: 'roadtrip' },
|
||||
load: loadSavedSettings,
|
||||
describe: describeSettings,
|
||||
change: settingsCard,
|
||||
},
|
||||
set_day_boundary: {
|
||||
write: { verbKey: 'setDayBoundary', entity: 'roadtrip' },
|
||||
describe: describeDayEnd,
|
||||
change: dayEndCard,
|
||||
},
|
||||
import_google_maps_route: {
|
||||
write: { verbKey: 'importRoute', entity: 'assignment' },
|
||||
describe: describeImportRoute,
|
||||
change: importRouteCard,
|
||||
appliedIds: importedAssignmentIds,
|
||||
},
|
||||
create_transit_journey: {
|
||||
write: { verbKey: 'addTransit', entity: 'reservation' },
|
||||
describe: describeTransit,
|
||||
change: (_ctx, args) => transitChangeCard(args),
|
||||
},
|
||||
},
|
||||
prompt: [
|
||||
'The app draws calculate_roadtrip, corridor searches, charger checks, transit searches and road trip changes as ' +
|
||||
'cards; sum them up in a sentence and name the warnings, never list their days, stops or connections again.',
|
||||
],
|
||||
toolControllers: { roadtrip: ['DayBoundariesMcp', 'GoogleRouteMcp'] },
|
||||
};
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
import type { Described, PreviewContext, ToolArgs } from '../card-types';
|
||||
import { argId, recordOf } from '../card-values';
|
||||
import { clip, dayLabel, placeName, Rows, text } from '../preview-format';
|
||||
import { itineraryOf } from './roadtrip-reads';
|
||||
import type { DayVias } from './roadtrip-route';
|
||||
import { dayEndOf, settingChanges, type SavedSettings } from './roadtrip-rules';
|
||||
|
||||
/**
|
||||
* The words of the road trip's change cards: the day a via change bends
|
||||
* (and the stop its via follows), how many vias a chain lays or pins again,
|
||||
* the settings a change sets, where a day ends, the stops a Google Maps
|
||||
* route brings and the connection a transit journey adds. The cards draw
|
||||
* the rest; these rows are what the share text and the facts line read.
|
||||
*/
|
||||
|
||||
type Args = ToolArgs;
|
||||
|
||||
/** The first letter of a text is one of a script written right to left. */
|
||||
const STARTS_RIGHT_TO_LEFT = /^[^\p{L}]*[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}]/u;
|
||||
|
||||
/**
|
||||
* `from` to `to` as one text, the arrow pointing the way the names read: a
|
||||
* line takes its direction from its first letter, so an Arabic or Hebrew
|
||||
* name first reads right to left and its arrow points left.
|
||||
*/
|
||||
export function routeText(names: readonly string[]): string {
|
||||
const arrow = STARTS_RIGHT_TO_LEFT.test(names[0] ?? '') ? ' ← ' : ' → ';
|
||||
return names.join(arrow);
|
||||
}
|
||||
|
||||
function count(value: unknown): number {
|
||||
return Array.isArray(value) ? value.length : 0;
|
||||
}
|
||||
|
||||
/** "47.12345, 11.12345". */
|
||||
function coordinates(lat: unknown, lng: unknown): string {
|
||||
return typeof lat === 'number' && typeof lng === 'number' ? `${lat.toFixed(5)}, ${lng.toFixed(5)}` : '';
|
||||
}
|
||||
|
||||
/** The stop of the day at `index`, the one a via after it follows. */
|
||||
function stopAt(ctx: PreviewContext, dayId: number | null, index: unknown): string {
|
||||
if (dayId === null || typeof index !== 'number') return '';
|
||||
return placeName(ctx, ctx.card.days.find((day) => day.id === dayId)?.placeIds[index] ?? null);
|
||||
}
|
||||
|
||||
function dayRows(ctx: PreviewContext, dayId: number | null): Rows {
|
||||
return new Rows().add('day', dayLabel(ctx, dayId));
|
||||
}
|
||||
|
||||
function viaChange(ctx: PreviewContext, args: Args, rows: Rows, subject: string): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
return { subject: subject || dayLabel(ctx, dayId), rows, dayId, placeIds: [] };
|
||||
}
|
||||
|
||||
export function describeAddVia(ctx: PreviewContext, args: Args): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const after = stopAt(ctx, dayId, args.after_order_index);
|
||||
const rows = dayRows(ctx, dayId).add('position', after).add('coordinates', coordinates(args.lat, args.lng));
|
||||
return viaChange(ctx, args, rows, after);
|
||||
}
|
||||
|
||||
export function describeAddVias(ctx: PreviewContext, args: Args): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const trackId = argId(recordOf(args.track), 'place_id');
|
||||
const rows = dayRows(ctx, dayId)
|
||||
.add('quantity', String(count(args.vias)))
|
||||
.add('route', trackId === null ? '' : placeName(ctx, trackId));
|
||||
return viaChange(ctx, args, rows, '');
|
||||
}
|
||||
|
||||
export function describeMoveVia(ctx: PreviewContext, args: Args, loaded: DayVias | null): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const now = loaded?.vias.find((via) => via.id === argId(args, 'viaId'));
|
||||
const rows = dayRows(ctx, dayId).change(
|
||||
'coordinates',
|
||||
now ? coordinates(now.lat, now.lng) : null,
|
||||
coordinates(args.lat, args.lng),
|
||||
);
|
||||
if (typeof args.after_order_index === 'number' && args.after_order_index !== now?.after) {
|
||||
rows.change('position', now ? stopAt(ctx, dayId, now.after) : null, stopAt(ctx, dayId, args.after_order_index));
|
||||
}
|
||||
return viaChange(ctx, args, rows, '');
|
||||
}
|
||||
|
||||
export function describeRemoveVia(ctx: PreviewContext, args: Args, loaded: DayVias | null): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const now = loaded?.vias.find((via) => via.id === argId(args, 'viaId'));
|
||||
const rows = dayRows(ctx, dayId);
|
||||
if (now) rows.add('position', stopAt(ctx, dayId, now.after)).add('coordinates', coordinates(now.lat, now.lng));
|
||||
return viaChange(ctx, args, rows, '');
|
||||
}
|
||||
|
||||
export function describeRepinVias(ctx: PreviewContext, args: Args): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const rows = dayRows(ctx, dayId).add('quantity', String(count(args.vias) + count(args.remove)));
|
||||
return viaChange(ctx, args, rows, '');
|
||||
}
|
||||
|
||||
/** A setting's value in a row: a switch as a tick or a cross, a cleared value as a cross. */
|
||||
function settingText(value: string | number | boolean | null): string {
|
||||
if (value === null || value === '') return text(false);
|
||||
return text(value);
|
||||
}
|
||||
|
||||
export function describeSettings(ctx: PreviewContext, args: Args, loaded: SavedSettings | null): Described {
|
||||
const rows = new Rows();
|
||||
for (const change of settingChanges(args, loaded)) {
|
||||
rows.rows.push({
|
||||
op: 'change',
|
||||
labelKey: 'field',
|
||||
field: change.key,
|
||||
before: loaded ? settingText(change.before) : null,
|
||||
after: settingText(change.after),
|
||||
});
|
||||
}
|
||||
return { subject: clip(ctx.card.title), rows, dayId: null, placeIds: [] };
|
||||
}
|
||||
|
||||
export function describeDayEnd(ctx: PreviewContext, args: Args): Described {
|
||||
const dayEnd = dayEndOf(ctx, args);
|
||||
const dayId = dayEnd?.dayId ?? null;
|
||||
// Where the day ends is the card's to say, in its own words; the row names the day.
|
||||
const rows = new Rows().add('day', dayId === null ? (dayEnd ? `#${dayEnd.dayNumber}` : '') : dayLabel(ctx, dayId));
|
||||
return { subject: dayEnd?.from ?? dayLabel(ctx, dayId), rows, dayId, placeIds: [] };
|
||||
}
|
||||
|
||||
export function describeImportRoute(ctx: PreviewContext, args: Args): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const names = Array.isArray(args.stops)
|
||||
? args.stops.map((stop: unknown) => text(recordOf(stop).name)).filter((name) => name !== '')
|
||||
: [];
|
||||
const rows = dayRows(ctx, dayId).add('quantity', String(names.length)).add('route', clip(routeText(names)));
|
||||
const ends = names.length > 0 ? routeText([names[0] ?? '', names[names.length - 1] ?? '']) : '';
|
||||
return { subject: ends, rows, dayId, placeIds: [] };
|
||||
}
|
||||
|
||||
export function describeTransit(ctx: PreviewContext, args: Args): Described {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const from = text(recordOf(args.from).name);
|
||||
const to = text(recordOf(args.to).name);
|
||||
const itinerary = itineraryOf(args.itinerary);
|
||||
const rows = dayRows(ctx, dayId)
|
||||
.add('time', itinerary?.start ?? '')
|
||||
.add('endTime', itinerary?.end ?? '')
|
||||
.add('route', from && to ? routeText([from, to]) : '');
|
||||
return { subject: from && to ? routeText([from, to]) : from || to, rows, dayId, placeIds: [] };
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
import type { AnswerInput } from '../card-types';
|
||||
import { clipped, clockOf, finite, isLat, isLng, recordOf, type Row } from '../card-values';
|
||||
import { drivenLines, linePointsOf, roundPoint, thinLine, type GapStop, type LatLng } from './roadtrip-geometry';
|
||||
import {
|
||||
MAX_CARD_CHARS,
|
||||
MAX_TRIP_DAYS,
|
||||
ROADTRIP_CARD_DAY_LINES_MAX,
|
||||
ROADTRIP_CARD_DAYS_MAX,
|
||||
ROADTRIP_CARD_LINE_POINTS_MAX,
|
||||
ROADTRIP_CARD_POINTS_MAX,
|
||||
ROADTRIP_CARD_STOPS_MAX,
|
||||
roadtripStopTypeSchema,
|
||||
type RoadtripCard,
|
||||
type RoadtripCardDay,
|
||||
type RoadtripCardStop,
|
||||
} from '@trek/shared';
|
||||
|
||||
/**
|
||||
* The card of calculate_roadtrip: the drive as the planner's rail shows it,
|
||||
* built from the tool's raw answer (with its geometry, which the provider
|
||||
* never sees). A trip too long for one card keeps its first days and the
|
||||
* lines of the drive are thinned until the card fits; the rows of the days
|
||||
* it keeps are the planner's rows, never a summary of them. Lines give way
|
||||
* to days only when not even one day fits with them.
|
||||
*/
|
||||
|
||||
/** Room the card leaves under the cap for the envelope it is stored in. */
|
||||
const BUDGET = MAX_CARD_CHARS - 400;
|
||||
/**
|
||||
* The point budgets a card tries, in rounds: every day count with lines first,
|
||||
* from the most points to a floor, and only then without lines at all. A day's
|
||||
* stops cost far more room than its lines, so dropping the lines first would
|
||||
* keep one more day and lose the drive the map draws on hover for all of them.
|
||||
*/
|
||||
const POINT_ROUNDS = [[ROADTRIP_CARD_POINTS_MAX, ROADTRIP_CARD_POINTS_MAX / 2, ROADTRIP_CARD_POINTS_MAX / 4], [0]];
|
||||
|
||||
function rows(value: unknown): Row[] {
|
||||
return Array.isArray(value) ? value.map(recordOf) : [];
|
||||
}
|
||||
|
||||
function positiveId(value: unknown): number | null {
|
||||
return typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : null;
|
||||
}
|
||||
|
||||
/** A whole number in `[min, max]`, rounded; null for anything that is not a number. */
|
||||
function wholeIn(value: unknown, min: number, max: number): number | null {
|
||||
const number = finite(value);
|
||||
return number === null ? null : Math.min(max, Math.max(min, Math.round(number)));
|
||||
}
|
||||
|
||||
function within(value: unknown, max: number): number {
|
||||
return Math.min(max, Math.max(0, finite(value) ?? 0));
|
||||
}
|
||||
|
||||
function carrierOf(raw: unknown): RoadtripCardStop['carrier'] {
|
||||
const carrier = recordOf(raw);
|
||||
const reservationId = positiveId(carrier.reservationId);
|
||||
const type = clipped(carrier.type, 20);
|
||||
const role = carrier.role;
|
||||
if (!reservationId || !type) return null;
|
||||
if (role !== 'departure' && role !== 'arrival' && role !== 'pickup' && role !== 'return') return null;
|
||||
return {
|
||||
reservationId,
|
||||
type,
|
||||
role,
|
||||
title: clipped(carrier.title, 80) ?? type,
|
||||
code: clipped(carrier.code, 8),
|
||||
at: clockOf(carrier.at),
|
||||
};
|
||||
}
|
||||
|
||||
function bookendOf(raw: unknown): RoadtripCardStop['bookend'] {
|
||||
const bookend = recordOf(raw);
|
||||
if (bookend.phase !== 'morning' && bookend.phase !== 'evening') return null;
|
||||
return {
|
||||
phase: bookend.phase,
|
||||
reservationId: positiveId(bookend.reservationId),
|
||||
checkingIn: bookend.checkingIn === true,
|
||||
checkingOut: bookend.checkingOut === true,
|
||||
checkIn: clockOf(bookend.checkIn),
|
||||
checkOut: clockOf(bookend.checkOut),
|
||||
};
|
||||
}
|
||||
|
||||
function autoNightOf(raw: unknown): RoadtripCardStop['autoNight'] {
|
||||
const night = recordOf(raw);
|
||||
const fromDayNumber = wholeIn(night.fromDayNumber, 1, MAX_TRIP_DAYS);
|
||||
if ((night.phase !== 'start' && night.phase !== 'end') || fromDayNumber === null) return null;
|
||||
return { phase: night.phase, fromDayNumber };
|
||||
}
|
||||
|
||||
/** What the schedule says about the stop at `index`: its entry, how late it is reached, what the drive out finds. */
|
||||
interface StopSchedule {
|
||||
entries: Row[];
|
||||
warnings: Row[];
|
||||
driveWarnings: Row[];
|
||||
}
|
||||
|
||||
function lateAt(schedule: StopSchedule, index: number): RoadtripCardStop['late'] {
|
||||
return schedule.warnings
|
||||
.filter((w) => w.index === index && (w.code === 'late' || w.code === 'missedLeave'))
|
||||
.slice(0, 2)
|
||||
.map((w): RoadtripCardStop['late'][number] => ({
|
||||
code: w.code === 'late' ? 'late' : 'missedLeave',
|
||||
minutes: wholeIn(w.minutes, 0, 100_000) ?? 0,
|
||||
}));
|
||||
}
|
||||
|
||||
function findingsAt(schedule: StopSchedule, index: number): RoadtripCardStop['findings'] {
|
||||
return schedule.driveWarnings
|
||||
.filter((w) => w.index === index && (w.code === 'leg' || w.code === 'range'))
|
||||
.slice(0, 2)
|
||||
.map((w): RoadtripCardStop['findings'][number] => {
|
||||
const sinceKm = finite(w.sinceKm);
|
||||
return {
|
||||
code: w.code === 'leg' ? 'leg' : 'range',
|
||||
overMinutes: wholeIn(w.overMinutes, 0, 100_000),
|
||||
sinceKm: sinceKm === null ? null : Math.round(Math.min(40_000, Math.max(0, sinceKm)) * 10) / 10,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** One stop of the rail; null for one without a position, which ends the day's list there. */
|
||||
function stopOf(raw: Row, index: number, schedule: StopSchedule): RoadtripCardStop | null {
|
||||
const lat = finite(raw.lat);
|
||||
const lng = finite(raw.lng);
|
||||
if (!isLat(lat) || !isLng(lng)) return null;
|
||||
const carrier = carrierOf(raw.carrier);
|
||||
const name = clipped(raw.name, 80) ?? carrier?.title;
|
||||
if (!name) return null;
|
||||
const entry = recordOf(schedule.entries[index]);
|
||||
const stopType = roadtripStopTypeSchema.safeParse(raw.stopType);
|
||||
return {
|
||||
placeId: positiveId(raw.placeId),
|
||||
assignmentId: positiveId(raw.assignmentId),
|
||||
name,
|
||||
lat: Math.round(lat * 1e5) / 1e5,
|
||||
lng: Math.round(lng * 1e5) / 1e5,
|
||||
stopType: stopType.success ? stopType.data : null,
|
||||
time: clockOf(raw.time),
|
||||
leaveAt: clockOf(raw.leaveAt),
|
||||
dwellMinutes: wholeIn(raw.dwellMinutes, 0, 10_080),
|
||||
offRoadM: wholeIn(raw.offRoadMeters, 0, 100_000),
|
||||
fillPercent: wholeIn(raw.fillPercent, 0, 100),
|
||||
night: raw.night === true ? { checkIn: clockOf(raw.checkInTime) } : null,
|
||||
autoNight: autoNightOf(raw.automaticNight),
|
||||
bookend: bookendOf(raw.bookend),
|
||||
carrier,
|
||||
arrival: clockOf(entry.arrival),
|
||||
departure: clockOf(entry.departure),
|
||||
anchored: entry.anchored === true,
|
||||
dayOffset: wholeIn(entry.dayOffset, 0, 60) ?? 0,
|
||||
late: lateAt(schedule, index),
|
||||
findings: findingsAt(schedule, index),
|
||||
};
|
||||
}
|
||||
|
||||
/** A day as the card holds it, before its lines are fitted, with the driven pieces to fit them from. */
|
||||
interface DraftDay {
|
||||
day: Omit<RoadtripCardDay, 'lines'>;
|
||||
pieces: LatLng[][];
|
||||
}
|
||||
|
||||
function legOf(raw: unknown): RoadtripCardDay['legs'][number] {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const leg = recordOf(raw);
|
||||
const distance = finite(leg.distance);
|
||||
const duration = finite(leg.duration);
|
||||
if (distance === null || duration === null) return null;
|
||||
return {
|
||||
distanceM: within(distance, 5e7),
|
||||
durationS: within(duration, 1e7),
|
||||
mode: clipped(leg.mode, 40) ?? 'driving',
|
||||
};
|
||||
}
|
||||
|
||||
function gapStopOf(raw: Row): GapStop | null {
|
||||
const lat = finite(raw.lat);
|
||||
const lng = finite(raw.lng);
|
||||
if (!isLat(lat) || !isLng(lng)) return null;
|
||||
const carrier = recordOf(raw.carrier);
|
||||
const reservationId = positiveId(carrier.reservationId);
|
||||
const role = carrier.role;
|
||||
if (!reservationId || (role !== 'departure' && role !== 'arrival' && role !== 'pickup' && role !== 'return')) {
|
||||
return { lat, lng };
|
||||
}
|
||||
const type = typeof carrier.type === 'string' ? carrier.type : '';
|
||||
return { lat, lng, carrier: { reservationId, type, role, title: '', code: null, at: null } };
|
||||
}
|
||||
|
||||
function draftDay(raw: Row): DraftDay | null {
|
||||
const dayId = positiveId(raw.dayId);
|
||||
const dayNumber = wholeIn(raw.dayNumber, 1, MAX_TRIP_DAYS);
|
||||
if (!dayId || dayNumber === null) return null;
|
||||
const schedule = recordOf(raw.schedule);
|
||||
const timing: StopSchedule = {
|
||||
entries: rows(schedule.entries),
|
||||
warnings: rows(schedule.warnings),
|
||||
driveWarnings: rows(raw.driveWarnings),
|
||||
};
|
||||
const rawStops = rows(raw.stops);
|
||||
const stops: RoadtripCardStop[] = [];
|
||||
for (const [index, stop] of rawStops.entries()) {
|
||||
if (stops.length >= ROADTRIP_CARD_STOPS_MAX) break;
|
||||
const shown = stopOf(stop, index, timing);
|
||||
if (!shown) break;
|
||||
stops.push(shown);
|
||||
}
|
||||
const rawLegs: unknown[] = Array.isArray(raw.legs) ? raw.legs : [];
|
||||
const dayWarning = recordOf(raw.dayWarning);
|
||||
const dayOverMinutes = wholeIn(dayWarning.minutes, 0, 100_000);
|
||||
const limitMinutes = wholeIn(dayWarning.limitMinutes, 1, 1440);
|
||||
const dry = finite(rows(raw.dryPoints)[0]?.sinceKm);
|
||||
const avoided: unknown[] = Array.isArray(raw.avoidMissed) ? raw.avoidMissed : [];
|
||||
const gapStops = rawStops.flatMap((stop) => {
|
||||
const gap = gapStopOf(stop);
|
||||
return gap ? [gap] : [];
|
||||
});
|
||||
return {
|
||||
day: {
|
||||
dayId,
|
||||
dayNumber,
|
||||
date: typeof raw.date === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(raw.date) ? raw.date : null,
|
||||
title: clipped(raw.title, 80),
|
||||
distanceM: within(raw.distanceMetres, 5e7),
|
||||
durationS: within(raw.durationSeconds, 1e7),
|
||||
stops,
|
||||
moreStops: Math.min(1000, Math.max(0, rawStops.length - stops.length)),
|
||||
legs: stops.slice(1).map((_, index) => legOf(rawLegs[index])),
|
||||
dayOver: dayOverMinutes !== null && limitMinutes !== null ? { minutes: dayOverMinutes, limitMinutes } : null,
|
||||
avoidMissed: [...new Set(avoided.filter(isAvoidClass))],
|
||||
dryKm: dry === null ? null : Math.round(Math.min(40_000, Math.max(0, dry)) * 10) / 10,
|
||||
},
|
||||
pieces: drivenLines(linePointsOf(raw.geometry), gapStops).slice(0, ROADTRIP_CARD_DAY_LINES_MAX),
|
||||
};
|
||||
}
|
||||
|
||||
const AVOID_CLASSES: readonly unknown[] = ['motorway', 'toll', 'ferry'];
|
||||
|
||||
function isAvoidClass(value: unknown): value is RoadtripCardDay['avoidMissed'][number] {
|
||||
return AVOID_CLASSES.includes(value);
|
||||
}
|
||||
|
||||
function problemOf(value: Row): RoadtripCard['problem'] {
|
||||
if (rows(value.failures).length > 0) return 'routing';
|
||||
if (Array.isArray(value.omittedVisitIds) && value.omittedVisitIds.length > 0) return 'coordinates';
|
||||
return value.dayWindowIssue ? 'dayWindow' : null;
|
||||
}
|
||||
|
||||
/** A piece thinned to so many points, each thinning made once however often the card is fitted again. */
|
||||
type Thinned = (piece: LatLng[], points: number) => [number, number][];
|
||||
|
||||
function thinnedOnce(): Thinned {
|
||||
const made = new Map<LatLng[], Map<number, [number, number][]>>();
|
||||
return (piece, points) => {
|
||||
const byPoints = made.get(piece) ?? new Map<number, [number, number][]>();
|
||||
made.set(piece, byPoints);
|
||||
let line = byPoints.get(points);
|
||||
if (!line) {
|
||||
line = thinLine(piece, points).map(roundPoint);
|
||||
byPoints.set(points, line);
|
||||
}
|
||||
return line;
|
||||
};
|
||||
}
|
||||
|
||||
/** The card with the first `days` days and their lines fitted into `points` points. */
|
||||
function cardWith(
|
||||
base: Omit<RoadtripCard, 'days' | 'moreDays'>,
|
||||
drafts: DraftDay[],
|
||||
fit: { days: number; points: number; thinned: Thinned },
|
||||
): RoadtripCard {
|
||||
const kept = drafts.slice(0, fit.days);
|
||||
const pieceCount = kept.reduce((sum, draft) => sum + draft.pieces.length, 0);
|
||||
const perLine = pieceCount === 0 ? 0 : Math.min(ROADTRIP_CARD_LINE_POINTS_MAX, Math.floor(fit.points / pieceCount));
|
||||
return {
|
||||
...base,
|
||||
days: kept.map(({ day, pieces }) => ({
|
||||
...day,
|
||||
lines: perLine < 2 ? [] : pieces.map((piece) => fit.thinned(piece, perLine)),
|
||||
})),
|
||||
moreDays: Math.min(1000, drafts.length - kept.length),
|
||||
};
|
||||
}
|
||||
|
||||
/** calculate_roadtrip's answer as a card, fitted under the size cap; null for a drive with no day to show. */
|
||||
export function roadtripAnswerCard({ args, value }: AnswerInput): RoadtripCard | null {
|
||||
const answer = recordOf(value);
|
||||
const drafts = rows(answer.days).flatMap((day) => {
|
||||
const draft = draftDay(day);
|
||||
return draft ? [draft] : [];
|
||||
});
|
||||
if (drafts.length === 0) return null;
|
||||
const settings = recordOf(answer.settings);
|
||||
const vehicle = settings.roadtrip_vehicle;
|
||||
const allStops = rows(answer.days).flatMap((day) => rows(day.stops));
|
||||
const base: Omit<RoadtripCard, 'days' | 'moreDays'> = {
|
||||
kind: 'roadtrip',
|
||||
complete: answer.complete === true,
|
||||
problem: problemOf(answer),
|
||||
previewKeys: Object.keys(recordOf(args.settings))
|
||||
.filter((key) => /^roadtrip_[a-z0-9_]{1,40}$/.test(key))
|
||||
.slice(0, 12),
|
||||
vehicle: vehicle === 'combustion' || vehicle === 'electric' ? vehicle : null,
|
||||
defaultFill: wholeIn(settings.roadtrip_fill_percent, 0, 100) || null,
|
||||
dayColors: settings.roadtrip_day_colors === true,
|
||||
distanceM: within(answer.totalDistanceMetres, 5e7),
|
||||
durationS: within(answer.totalDurationSeconds, 1e7),
|
||||
stopCount: wholeIn(answer.totalStops, 0, 10_000) ?? 0,
|
||||
chargingCount: Math.min(10_000, allStops.filter((stop) => stop.stopType === 'charging').length),
|
||||
quietDays: Math.min(1000, rows(answer.quietDays).length),
|
||||
undatedRides: Math.min(100, rows(answer.undatedRides).length),
|
||||
};
|
||||
return fitted(base, drafts);
|
||||
}
|
||||
|
||||
/** The card with the most days and points that fits under the cap, lines kept as long as one day fits with them. */
|
||||
function fitted(base: Omit<RoadtripCard, 'days' | 'moreDays'>, drafts: DraftDay[]): RoadtripCard | null {
|
||||
const thinned = thinnedOnce();
|
||||
for (const steps of POINT_ROUNDS) {
|
||||
for (let days = Math.min(ROADTRIP_CARD_DAYS_MAX, drafts.length); days >= 1; days -= 1) {
|
||||
for (const points of steps) {
|
||||
const card = cardWith(base, drafts, { days, points, thinned });
|
||||
if (JSON.stringify(card).length <= BUDGET) return card;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { finite, isLat, isLng } from '../card-values';
|
||||
import { drivenPieces, riddenRanges, rideGaps, simplifyLine, type CarrierTerminal } from '@trek/shared/roadtrip';
|
||||
|
||||
/**
|
||||
* The lines a road trip card draws, cut down to what a card may carry: the
|
||||
* pieces of a day the car drives (a ride between two terminals is left out,
|
||||
* as the corridor search leaves it out), each thinned until it fits its share
|
||||
* of the card's points, at five decimals.
|
||||
*/
|
||||
|
||||
export interface LatLng {
|
||||
lat: number;
|
||||
lng: number;
|
||||
}
|
||||
|
||||
/** A stop as the ride gaps read it: where it is, and the ride it is a terminal of. */
|
||||
export interface GapStop extends LatLng {
|
||||
carrier?: CarrierTerminal;
|
||||
}
|
||||
|
||||
/** The first tolerance a line is simplified with, in kilometres; it doubles until the line fits. */
|
||||
const FIRST_TOLERANCE_KM = 0.01;
|
||||
const MAX_ROUNDS = 16;
|
||||
|
||||
function round5(value: number): number {
|
||||
return Math.round(value * 1e5) / 1e5;
|
||||
}
|
||||
|
||||
/** A point as a card draws it, `[lat, lng]` at five decimals. */
|
||||
export function roundPoint(point: LatLng): [number, number] {
|
||||
return [round5(point.lat), round5(point.lng)];
|
||||
}
|
||||
|
||||
/** The points of a raw geometry (`[lat, lng]` pairs), the broken ones left out. */
|
||||
export function linePointsOf(raw: unknown): LatLng[] {
|
||||
if (!Array.isArray(raw)) return [];
|
||||
return raw.flatMap((pair: unknown) => {
|
||||
if (!Array.isArray(pair)) return [];
|
||||
const lat = finite(pair[0]);
|
||||
const lng = finite(pair[1]);
|
||||
return isLat(lat) && isLng(lng) ? [{ lat, lng }] : [];
|
||||
});
|
||||
}
|
||||
|
||||
/** Every `count`th point, both ends kept: the last resort when simplifying cannot thin a line enough. */
|
||||
function sampled(line: readonly LatLng[], count: number): LatLng[] {
|
||||
const step = (line.length - 1) / (count - 1);
|
||||
return Array.from({ length: count }, (_, index) => line[Math.round(index * step)]);
|
||||
}
|
||||
|
||||
/** A line with at most `max` points (two at the least), the shape kept as far as the points allow. */
|
||||
export function thinLine(line: readonly LatLng[], max: number): LatLng[] {
|
||||
const most = Math.max(2, max);
|
||||
if (line.length <= most) return [...line];
|
||||
let tolerance = FIRST_TOLERANCE_KM;
|
||||
let thin = [...line];
|
||||
for (let round = 0; round < MAX_ROUNDS && thin.length > most; round += 1) {
|
||||
thin = simplifyLine([...line], tolerance);
|
||||
tolerance *= 2;
|
||||
}
|
||||
return thin.length > most ? sampled(thin, most) : thin;
|
||||
}
|
||||
|
||||
/** The pieces of a day's geometry the car drives, each of two points at least. */
|
||||
export function drivenLines(geometry: readonly LatLng[], stops: readonly GapStop[]): LatLng[][] {
|
||||
if (geometry.length < 2) return [];
|
||||
const spine = [...geometry];
|
||||
return drivenPieces(spine, riddenRanges(spine, rideGaps(stops))).filter((piece) => piece.length >= 2);
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
import { localParts, resolveTimeZone } from '../../../common/timezoneService';
|
||||
import type { AnswerInput, ToolArgs } from '../card-types';
|
||||
import { argId, clipped, finite, instantOf, isLat, isLng, recordOf, type Row } from '../card-values';
|
||||
import {
|
||||
chargingInfoSchema,
|
||||
cheapestEnergy,
|
||||
CORRIDOR_CARD_HITS_MAX,
|
||||
DAY_ROUTE_CARD_STOPS_MAX,
|
||||
MAX_CARD_CHARS,
|
||||
roadtripCorridorRequestSchema,
|
||||
TRANSIT_CARD_ITINERARIES_MAX,
|
||||
TRANSIT_CARD_LEGS_MAX,
|
||||
type ChargingCard,
|
||||
type CorridorCard,
|
||||
type DayRouteCard,
|
||||
type TransitCard,
|
||||
type TransitCardItinerary,
|
||||
} from '@trek/shared';
|
||||
|
||||
/**
|
||||
* The answer cards of the road trip's reads: what a corridor search found
|
||||
* along a day, a charger as one look found it, the connections a transit
|
||||
* search offers (and the one a held journey adds), and the stops a Google
|
||||
* Maps route link names. Each is built from the tool's raw answer; texts are
|
||||
* masked like a provider answer, and no card carries an address of the web.
|
||||
*/
|
||||
|
||||
/** The corridor search pages its areas six at a time. */
|
||||
const AREAS_PER_PAGE = 6;
|
||||
/** Room a card leaves under the cap for the envelope it is stored in. */
|
||||
const BUDGET = MAX_CARD_CHARS - 400;
|
||||
|
||||
function rows(value: unknown): Row[] {
|
||||
return Array.isArray(value) ? value.map(recordOf) : [];
|
||||
}
|
||||
|
||||
function wholeIn(value: unknown, min: number, max: number): number | null {
|
||||
const number = finite(value);
|
||||
return number === null ? null : Math.min(max, Math.max(min, Math.round(number)));
|
||||
}
|
||||
|
||||
function roundTo(value: number, decimals: number): number {
|
||||
const factor = 10 ** decimals;
|
||||
return Math.round(value * factor) / factor;
|
||||
}
|
||||
|
||||
function socketsOf(poi: Row): CorridorCard['hits'][number]['sockets'] {
|
||||
return rows(recordOf(poi.charging).sockets)
|
||||
.flatMap((socket) => {
|
||||
const type = clipped(socket.type, 20);
|
||||
const kw = finite(socket.kw);
|
||||
return type
|
||||
? [{ type, kw: kw === null ? null : Math.min(2000, Math.max(0, kw)), count: wholeIn(socket.count, 0, 99) }]
|
||||
: [];
|
||||
})
|
||||
.sort((a, b) => (b.kw ?? -1) - (a.kw ?? -1))
|
||||
.slice(0, 4);
|
||||
}
|
||||
|
||||
function betweenOf(value: unknown): [string, string] | null {
|
||||
if (!Array.isArray(value) || value.length !== 2) return null;
|
||||
const from = clipped(value[0], 80);
|
||||
const to = clipped(value[1], 80);
|
||||
return from && to ? [from, to] : null;
|
||||
}
|
||||
|
||||
/** search_roadtrip_corridor's hits along one day; a search with no hit still says so. */
|
||||
export function corridorAnswerCard({ toolCallId, args, value, card }: AnswerInput): CorridorCard | null {
|
||||
const answer = recordOf(value);
|
||||
const dayNumber = wholeIn(answer.dayNumber ?? args.dayNumber, 1, 999);
|
||||
const category = roadtripCorridorRequestSchema.shape.category.safeParse(args.category);
|
||||
if (dayNumber === null || !category.success) return null;
|
||||
const width = finite(args.widthKm);
|
||||
const hits = rows(answer.hits).flatMap((hit, index) => {
|
||||
const poi = recordOf(hit.poi);
|
||||
const lat = finite(poi.lat);
|
||||
const lng = finite(poi.lng);
|
||||
const alongKm = finite(hit.alongKm);
|
||||
if (!isLat(lat) || !isLng(lng) || alongKm === null) return [];
|
||||
return [
|
||||
{
|
||||
ref: `${toolCallId}:${index}`,
|
||||
name: clipped(poi.name, 80),
|
||||
brand: clipped(poi.brand, 40),
|
||||
lat: roundTo(lat, 5),
|
||||
lng: roundTo(lng, 5),
|
||||
alongKm: roundTo(Math.min(40_000, Math.max(0, alongKm)), 1),
|
||||
offKm: roundTo(Math.min(10, Math.max(0, finite(hit.distanceKm) ?? 0)), 2),
|
||||
between: betweenOf(hit.between),
|
||||
sockets: socketsOf(poi),
|
||||
},
|
||||
];
|
||||
});
|
||||
const total = wholeIn(answer.totalAreas, 0, 1000) ?? 0;
|
||||
const offset = wholeIn(args.offset, 0, 1000) ?? 0;
|
||||
const shown = hits.slice(0, CORRIDOR_CARD_HITS_MAX);
|
||||
return {
|
||||
kind: 'corridor',
|
||||
dayId: card.days.find((day) => day.number === dayNumber)?.id ?? null,
|
||||
dayNumber,
|
||||
category: category.data,
|
||||
widthKm: width !== null && width > 0 && width <= 10 ? width : 5,
|
||||
hits: shown,
|
||||
more: Math.min(10_000, hits.length - shown.length),
|
||||
searched: { done: Math.min(total, offset + AREAS_PER_PAGE), total },
|
||||
partial: answer.complete !== true,
|
||||
};
|
||||
}
|
||||
|
||||
/** get_ and lookup_roadtrip_charging_info: free points, the cheapest energy price and the source, as checked. */
|
||||
export function chargingAnswerCard({ args, value, card }: AnswerInput): ChargingCard | null {
|
||||
const parsed = chargingInfoSchema.safeParse(value);
|
||||
if (!parsed.success) return null;
|
||||
const info = parsed.data;
|
||||
const placeId = argId(args, 'placeId');
|
||||
const place = placeId === null ? undefined : card.places.get(placeId);
|
||||
const lat = finite(place ? place.lat : args.lat);
|
||||
const lng = finite(place ? place.lng : args.lng);
|
||||
const cheapest = cheapestEnergy(info.tariffs);
|
||||
const components = info.tariffs.reduce((sum, tariff) => sum + tariff.components.length, 0);
|
||||
const energy =
|
||||
cheapest && /^[A-Z]{3}$/.test(cheapest.currency) && cheapest.price <= 1e9
|
||||
? { amount: cheapest.price, currency: cheapest.currency }
|
||||
: null;
|
||||
return {
|
||||
kind: 'charging',
|
||||
placeId,
|
||||
name: clipped(place ? place.name : args.name, 80),
|
||||
station: clipped(info.station, 120),
|
||||
lat: isLat(lat) ? roundTo(lat, 5) : null,
|
||||
lng: isLng(lng) ? roundTo(lng, 5) : null,
|
||||
status: info.status,
|
||||
stale: info.stale,
|
||||
available: info.available === null ? null : Math.min(999, info.available),
|
||||
total: Math.min(999, info.total),
|
||||
checkedAt: instantOf(info.checkedAt),
|
||||
updatedAt: instantOf(info.updatedAt),
|
||||
energy,
|
||||
otherPrices: Math.min(99, Math.max(0, components - (energy ? 1 : 0))),
|
||||
source: clipped(info.source, 80),
|
||||
license: clipped(info.license, 120),
|
||||
};
|
||||
}
|
||||
|
||||
/** A transit line colour as `#rrggbb`; the short form is spelled out, anything else gives null. */
|
||||
function lineColour(value: unknown): string | null {
|
||||
if (typeof value !== 'string') return null;
|
||||
if (/^#[0-9a-fA-F]{6}$/.test(value)) return value;
|
||||
const short = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(value);
|
||||
return short ? `#${short[1]}${short[1]}${short[2]}${short[2]}${short[3]}${short[3]}` : null;
|
||||
}
|
||||
|
||||
/** The local date and clock of a moment at a stop, in the zone of where the stop is. */
|
||||
function localAt(iso: unknown, stop: Row): { date: string | null; time: string | null } {
|
||||
if (typeof iso !== 'string') return { date: null, time: null };
|
||||
return localParts(iso, resolveTimeZone(stop.lat, stop.lng));
|
||||
}
|
||||
|
||||
function daysBetween(from: string, to: string): number {
|
||||
return Math.round((Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / 86_400_000);
|
||||
}
|
||||
|
||||
function stopOf(raw: unknown): TransitCardItinerary['legs'][number]['from'] {
|
||||
const stop = recordOf(raw);
|
||||
return {
|
||||
name: clipped(stop.name, 80) ?? '?',
|
||||
time: localAt(stop.time ?? stop.scheduledTime, stop).time,
|
||||
track: clipped(stop.track, 12),
|
||||
};
|
||||
}
|
||||
|
||||
/** One connection as a card lists it, its clocks local to each stop; null when its times do not read. */
|
||||
export function itineraryOf(raw: unknown): TransitCardItinerary | null {
|
||||
const itinerary = recordOf(raw);
|
||||
const legs = rows(itinerary.legs);
|
||||
const first = recordOf(legs[0]?.from);
|
||||
const last = recordOf(legs[legs.length - 1]?.to);
|
||||
const start = localAt(itinerary.startTime, first);
|
||||
const end = localAt(itinerary.endTime, last);
|
||||
if (legs.length === 0 || !start.date || !start.time || !end.date || !end.time) return null;
|
||||
const endDayOffset = daysBetween(start.date, end.date);
|
||||
if (endDayOffset < 0 || endDayOffset > 3) return null;
|
||||
return {
|
||||
date: start.date,
|
||||
start: start.time,
|
||||
end: end.time,
|
||||
endDayOffset,
|
||||
durationS: Math.min(1e7, Math.max(0, finite(itinerary.duration) ?? 0)),
|
||||
transfers: wholeIn(itinerary.transfers, 0, 20) ?? 0,
|
||||
walkS: Math.min(1e7, Math.max(0, finite(itinerary.walkSeconds) ?? 0)),
|
||||
legs: legs.slice(0, TRANSIT_CARD_LEGS_MAX).map((leg) => ({
|
||||
mode: typeof leg.mode === 'string' && /^[A-Z_]{1,40}$/.test(leg.mode) ? leg.mode : 'OTHER',
|
||||
line: clipped(leg.line, 20),
|
||||
lineColor: lineColour(leg.lineColor),
|
||||
lineTextColor: lineColour(leg.lineTextColor),
|
||||
from: stopOf(leg.from),
|
||||
to: stopOf(leg.to),
|
||||
durationS: Math.min(1e7, Math.max(0, finite(leg.duration) ?? 0)),
|
||||
stops: wholeIn(leg.intermediateStops, 0, 500) ?? 0,
|
||||
headsign: clipped(leg.headsign, 80),
|
||||
agency: clipped(leg.agency, 60),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
/** The name a transit place goes by: the call's own, else the first stop's of the connection. */
|
||||
function placeName(place: unknown, fallback: TransitCardItinerary['legs'][number]['from'] | undefined): string | null {
|
||||
return clipped(recordOf(place).name, 80) ?? fallback?.name ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* search_transit_routes' connections, the first four of them, fewer when
|
||||
* long ones would not fit under the cap; the rest are counted in `more`.
|
||||
*/
|
||||
export function transitAnswerCard({ args, value }: AnswerInput): TransitCard | null {
|
||||
const answer = recordOf(value);
|
||||
const itineraries = rows(answer.itineraries).flatMap((raw) => {
|
||||
const itinerary = itineraryOf(raw);
|
||||
return itinerary ? [itinerary] : [];
|
||||
});
|
||||
const first = itineraries[0];
|
||||
const from = placeName(args.from, first?.legs[0]?.from);
|
||||
const to = placeName(args.to, first?.legs[first.legs.length - 1]?.to);
|
||||
if (!first || !from || !to) return null;
|
||||
const dropped = wholeIn(answer.dropped, 0, 100) ?? 0;
|
||||
for (let count = Math.min(TRANSIT_CARD_ITINERARIES_MAX, itineraries.length); count >= 1; count -= 1) {
|
||||
const card: TransitCard = {
|
||||
kind: 'transit',
|
||||
from,
|
||||
to,
|
||||
dayId: null,
|
||||
itineraries: itineraries.slice(0, count),
|
||||
more: Math.min(100, itineraries.length - count),
|
||||
dropped,
|
||||
};
|
||||
if (JSON.stringify(card).length <= BUDGET) return card;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The journey a held create_transit_journey adds, from its arguments. */
|
||||
export function transitChangeCard(args: ToolArgs): TransitCard | null {
|
||||
const itinerary = itineraryOf(args.itinerary);
|
||||
if (!itinerary) return null;
|
||||
const from = placeName(args.from, itinerary.legs[0]?.from);
|
||||
const to = placeName(args.to, itinerary.legs[itinerary.legs.length - 1]?.to);
|
||||
if (!from || !to) return null;
|
||||
return { kind: 'transit', from, to, dayId: argId(args, 'dayId'), itineraries: [itinerary], more: 0, dropped: 0 };
|
||||
}
|
||||
|
||||
/** The stops a Google Maps link names, as preview_google_maps_route read them once the user let it. */
|
||||
export function googleRouteCard(result: unknown): DayRouteCard | null {
|
||||
const located: DayRouteCard['stops'] = [];
|
||||
const unresolved: string[] = [];
|
||||
for (const stop of rows(recordOf(result).stops)) {
|
||||
const name = clipped(stop.name, 80);
|
||||
const lat = finite(stop.lat);
|
||||
const lng = finite(stop.lng);
|
||||
if (!name) continue;
|
||||
if (isLat(lat) && isLng(lng)) {
|
||||
if (located.length < DAY_ROUTE_CARD_STOPS_MAX) {
|
||||
located.push({ placeId: null, name, lat: roundTo(lat, 5), lng: roundTo(lng, 5), added: true });
|
||||
}
|
||||
} else if (unresolved.length < 10) unresolved.push(name);
|
||||
}
|
||||
if (located.length === 0 && unresolved.length === 0) return null;
|
||||
return {
|
||||
kind: 'dayRoute',
|
||||
dayId: null,
|
||||
dayNumber: null,
|
||||
stops: located,
|
||||
vias: [],
|
||||
afterName: null,
|
||||
track: null,
|
||||
unresolved,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
import type { CardReader, PreviewContext, ToolArgs } from '../card-types';
|
||||
import { argId, clipped, finite, isLat, isLng, recordOf, type Row } from '../card-values';
|
||||
import {
|
||||
DAY_ROUTE_CARD_STOPS_MAX,
|
||||
DAY_ROUTE_CARD_VIAS_MAX,
|
||||
type DayRouteCard,
|
||||
type DayRouteCardVia,
|
||||
} from '@trek/shared';
|
||||
|
||||
/**
|
||||
* The card of every change that bends a day's drive: the day's stops joined
|
||||
* by straight lines, and the via points the change adds, moves, takes out or
|
||||
* pins to another stop. What a held change does to a via the day has already
|
||||
* comes from `list_route_vias`, read once per turn while the change is
|
||||
* described; without it a move or a removal shows what it can.
|
||||
*/
|
||||
|
||||
/** A via of the day as it is stored now. */
|
||||
interface ViaNow {
|
||||
id: number;
|
||||
lat: number;
|
||||
lng: number;
|
||||
after: number;
|
||||
}
|
||||
|
||||
/** What describing a via change reads first: the day's vias as they are. */
|
||||
export interface DayVias {
|
||||
vias: ViaNow[];
|
||||
}
|
||||
|
||||
function rows(value: unknown): Row[] {
|
||||
return Array.isArray(value) ? value.map(recordOf) : [];
|
||||
}
|
||||
|
||||
function round5(value: number): number {
|
||||
return Math.round(value * 1e5) / 1e5;
|
||||
}
|
||||
|
||||
function afterOf(value: unknown): number | null {
|
||||
return typeof value === 'number' && Number.isInteger(value) && value >= 0 && value <= 500 ? value : null;
|
||||
}
|
||||
|
||||
function pointOf(row: Row): { lat: number; lng: number } | null {
|
||||
const lat = finite(row.lat);
|
||||
const lng = finite(row.lng);
|
||||
return isLat(lat) && isLng(lng) ? { lat: round5(lat), lng: round5(lng) } : null;
|
||||
}
|
||||
|
||||
/** The day's vias as list_route_vias answers them; null when the read failed or names no day. */
|
||||
export async function loadDayVias(args: ToolArgs, read: CardReader): Promise<DayVias | null> {
|
||||
const dayId = argId(args, 'dayId');
|
||||
if (dayId === null) return null;
|
||||
const answer = recordOf(await read('list_route_vias', { dayId }));
|
||||
if (!Array.isArray(answer.vias)) return null;
|
||||
return {
|
||||
vias: rows(answer.vias).flatMap((via) => {
|
||||
const id = argId(via, 'id');
|
||||
const point = pointOf(via);
|
||||
const after = afterOf(via.after_order_index);
|
||||
return id !== null && point && after !== null ? [{ id, ...point, after }] : [];
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
/** The day a change is about, with its stops in order as the trip card lists them. */
|
||||
function dayOf(ctx: PreviewContext, dayId: number | null) {
|
||||
const day = dayId === null ? undefined : ctx.card.days.find((d) => d.id === dayId);
|
||||
const stops: DayRouteCard['stops'] = [];
|
||||
for (const placeId of day?.placeIds ?? []) {
|
||||
const place = ctx.card.places.get(placeId);
|
||||
const name = clipped(place?.name, 80);
|
||||
const lat = finite(place?.lat);
|
||||
const lng = finite(place?.lng);
|
||||
if (!name || !isLat(lat) || !isLng(lng) || stops.length >= DAY_ROUTE_CARD_STOPS_MAX) continue;
|
||||
stops.push({ placeId, name, lat: round5(lat), lng: round5(lng), added: false });
|
||||
}
|
||||
return { day, stops };
|
||||
}
|
||||
|
||||
/** The name of the stop at `index` of the day, the one a via `after` it follows. */
|
||||
function stopName(ctx: PreviewContext, dayId: number | null, index: number | null): string | null {
|
||||
if (dayId === null || index === null) return null;
|
||||
const placeId = ctx.card.days.find((d) => d.id === dayId)?.placeIds[index];
|
||||
return placeId === undefined ? null : clipped(ctx.card.places.get(placeId)?.name, 80);
|
||||
}
|
||||
|
||||
/** The card for one day with these vias, or null when it would draw nothing. */
|
||||
function routeCard(
|
||||
ctx: PreviewContext,
|
||||
dayId: number | null,
|
||||
vias: DayRouteCardVia[],
|
||||
extra: Partial<Pick<DayRouteCard, 'afterName' | 'track' | 'stops'>> = {},
|
||||
): DayRouteCard | null {
|
||||
const { day, stops } = dayOf(ctx, dayId);
|
||||
const drawn = [...stops, ...(extra.stops ?? [])].slice(0, DAY_ROUTE_CARD_STOPS_MAX);
|
||||
if (drawn.length === 0 && vias.length === 0) return null;
|
||||
return {
|
||||
kind: 'dayRoute',
|
||||
dayId: day ? day.id : dayId,
|
||||
dayNumber: day ? Math.min(999, Math.max(1, day.number)) : null,
|
||||
stops: drawn,
|
||||
vias: vias.slice(0, DAY_ROUTE_CARD_VIAS_MAX),
|
||||
afterName: extra.afterName ?? null,
|
||||
track: extra.track ?? null,
|
||||
unresolved: [],
|
||||
};
|
||||
}
|
||||
|
||||
function viaFrom(row: Row, state: DayRouteCardVia['state']): DayRouteCardVia | null {
|
||||
const point = pointOf(row);
|
||||
const after = afterOf(row.after_order_index);
|
||||
return point && after !== null ? { ...point, after, state, from: null } : null;
|
||||
}
|
||||
|
||||
/** add_route_via: one via after the stop it names. */
|
||||
export function addViaCard(ctx: PreviewContext, args: ToolArgs): DayRouteCard | null {
|
||||
const via = viaFrom(args, 'added');
|
||||
if (!via) return null;
|
||||
const dayId = argId(args, 'dayId');
|
||||
return routeCard(ctx, dayId, [via], { afterName: stopName(ctx, dayId, via.after) });
|
||||
}
|
||||
|
||||
/** add_route_vias: a chain of vias; the vias on the legs it clears first go, the track it follows is named. */
|
||||
export function addViasCard(ctx: PreviewContext, args: ToolArgs, loaded: DayVias | null): DayRouteCard | null {
|
||||
const dayId = argId(args, 'dayId');
|
||||
const added = rows(args.vias).flatMap((row) => {
|
||||
const via = viaFrom(row, 'added');
|
||||
return via ? [via] : [];
|
||||
});
|
||||
const cleared = new Set(Array.isArray(args.replace_legs) ? args.replace_legs : []);
|
||||
const removed = (loaded?.vias ?? [])
|
||||
.filter((via) => cleared.has(via.after))
|
||||
.map((via): DayRouteCardVia => ({ lat: via.lat, lng: via.lng, after: via.after, state: 'removed', from: null }));
|
||||
const afters = new Set(added.map((via) => via.after));
|
||||
const [onlyAfter] = afters.size === 1 ? [...afters] : [null];
|
||||
const trackId = argId(recordOf(args.track), 'place_id');
|
||||
return routeCard(ctx, dayId, [...added, ...removed], {
|
||||
afterName: stopName(ctx, dayId, onlyAfter),
|
||||
track: trackId === null ? null : clipped(ctx.card.places.get(trackId)?.name, 80),
|
||||
});
|
||||
}
|
||||
|
||||
/** update_route_via: the via at its new spot, from where it stands now. */
|
||||
export function moveViaCard(ctx: PreviewContext, args: ToolArgs, loaded: DayVias | null): DayRouteCard | null {
|
||||
const point = pointOf(args);
|
||||
if (!point) return null;
|
||||
const dayId = argId(args, 'dayId');
|
||||
const now = loaded?.vias.find((via) => via.id === argId(args, 'viaId'));
|
||||
const after = afterOf(args.after_order_index) ?? now?.after ?? 0;
|
||||
const via: DayRouteCardVia = { ...point, after, state: 'moved', from: now ? [now.lat, now.lng] : null };
|
||||
return routeCard(ctx, dayId, [via], { afterName: stopName(ctx, dayId, after) });
|
||||
}
|
||||
|
||||
/** remove_route_via: the via that goes; none to draw when the day has no such via. */
|
||||
export function removeViaCard(ctx: PreviewContext, args: ToolArgs, loaded: DayVias | null): DayRouteCard | null {
|
||||
const now = loaded?.vias.find((via) => via.id === argId(args, 'viaId'));
|
||||
if (!now) return null;
|
||||
const via: DayRouteCardVia = { lat: now.lat, lng: now.lng, after: now.after, state: 'removed', from: null };
|
||||
return routeCard(ctx, argId(args, 'dayId'), [via]);
|
||||
}
|
||||
|
||||
/** reanchor_route_vias: each via pinned to the stop it now follows, and the vias whose leg is gone. */
|
||||
export function repinViasCard(ctx: PreviewContext, args: ToolArgs, loaded: DayVias | null): DayRouteCard | null {
|
||||
const byId = new Map((loaded?.vias ?? []).map((via) => [via.id, via]));
|
||||
const repinned = rows(args.vias).flatMap((row): DayRouteCardVia[] => {
|
||||
const now = byId.get(argId(row, 'id') ?? 0);
|
||||
const after = afterOf(row.after_order_index);
|
||||
return now && after !== null ? [{ lat: now.lat, lng: now.lng, after, state: 'repinned', from: null }] : [];
|
||||
});
|
||||
const removed = (Array.isArray(args.remove) ? args.remove : []).flatMap((id: unknown): DayRouteCardVia[] => {
|
||||
const now = typeof id === 'number' ? byId.get(id) : undefined;
|
||||
return now ? [{ lat: now.lat, lng: now.lng, after: now.after, state: 'removed', from: null }] : [];
|
||||
});
|
||||
if (repinned.length + removed.length === 0) return null;
|
||||
return routeCard(ctx, argId(args, 'dayId'), [...repinned, ...removed]);
|
||||
}
|
||||
|
||||
/** import_google_maps_route: the day's stops with the route's stops appended. */
|
||||
export function importRouteCard(ctx: PreviewContext, args: ToolArgs): DayRouteCard | null {
|
||||
const added = rows(args.stops).flatMap((stop): DayRouteCard['stops'] => {
|
||||
const point = pointOf(stop);
|
||||
const name = typeof stop.name === 'string' ? stop.name.replace(/\s+/g, ' ').trim().slice(0, 80) : '';
|
||||
return point && name ? [{ placeId: null, name, ...point, added: true }] : [];
|
||||
});
|
||||
if (added.length === 0) return null;
|
||||
return routeCard(ctx, argId(args, 'dayId'), [], { stops: added });
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import type { CardReader, PreviewContext, ToolArgs } from '../card-types';
|
||||
import { clipped, finite, recordOf, type Row } from '../card-values';
|
||||
import type { RoadtripRulesCard, RoadtripSettingChange } from '@trek/shared';
|
||||
|
||||
/**
|
||||
* The card of a change to the rules a road trip drives by: the driving
|
||||
* settings update_roadtrip_settings changes, each read against what is saved
|
||||
* now (`get_roadtrip_settings`, once per turn), and where set_day_boundary
|
||||
* makes a day end. Values travel as the planner stores them; the client
|
||||
* words them.
|
||||
*/
|
||||
|
||||
/** The saved settings, as get_roadtrip_settings answers them. */
|
||||
export interface SavedSettings {
|
||||
settings: Row;
|
||||
}
|
||||
|
||||
const MAX_SETTINGS = 24;
|
||||
const KEY = /^roadtrip_[a-z0-9_]{1,40}$/;
|
||||
|
||||
/** A setting's value as the card carries it; anything else reads as not set. */
|
||||
function settingValue(value: unknown): RoadtripSettingChange['after'] {
|
||||
if (typeof value === 'boolean') return value;
|
||||
if (typeof value === 'string') return value.slice(0, 40);
|
||||
const number = finite(value);
|
||||
return number === null || number < 0 ? null : Math.min(100_000, number);
|
||||
}
|
||||
|
||||
/** The saved settings; null when the read failed. */
|
||||
export async function loadSavedSettings(_args: ToolArgs, read: CardReader): Promise<SavedSettings | null> {
|
||||
const answer = await read('get_roadtrip_settings', {});
|
||||
return answer && typeof answer === 'object' ? { settings: recordOf(recordOf(answer).settings) } : null;
|
||||
}
|
||||
|
||||
/** The settings a call changes, each from what is saved now to what it asks for. */
|
||||
export function settingChanges(args: ToolArgs, saved: SavedSettings | null): RoadtripSettingChange[] {
|
||||
return Object.entries(recordOf(args.settings))
|
||||
.filter(([key]) => KEY.test(key))
|
||||
.slice(0, MAX_SETTINGS)
|
||||
.map(([key, value]) => ({
|
||||
key,
|
||||
before: saved ? settingValue(saved.settings[key]) : null,
|
||||
after: settingValue(value),
|
||||
}));
|
||||
}
|
||||
|
||||
/** update_roadtrip_settings as a card; none for a call that changes nothing it can name. */
|
||||
export function settingsCard(
|
||||
_ctx: PreviewContext,
|
||||
args: ToolArgs,
|
||||
saved: SavedSettings | null,
|
||||
): RoadtripRulesCard | null {
|
||||
const settings = settingChanges(args, saved);
|
||||
return settings.length > 0 ? { kind: 'roadtripRules', settings, dayEnd: null } : null;
|
||||
}
|
||||
|
||||
/** The name of the place an assignment of the trip stands for. */
|
||||
function stopName(ctx: PreviewContext, assignmentId: unknown): string | null {
|
||||
if (typeof assignmentId !== 'number') return null;
|
||||
const assignment = ctx.card.assignments.get(assignmentId);
|
||||
return assignment ? clipped(ctx.card.places.get(assignment.placeId)?.name, 80) : null;
|
||||
}
|
||||
|
||||
/** Where set_day_boundary makes the day end: at a stop, part way along a drive, or automatically again. */
|
||||
export function dayEndOf(ctx: PreviewContext, args: ToolArgs): RoadtripRulesCard['dayEnd'] {
|
||||
const dayNumber = finite(args.dayNumber);
|
||||
if (dayNumber === null || !Number.isInteger(dayNumber) || dayNumber < 1 || dayNumber > 999) return null;
|
||||
const dayId = ctx.card.days.find((day) => day.number === dayNumber)?.id ?? null;
|
||||
if (args.boundary === null) return { dayId, dayNumber, mode: 'auto', from: null, to: null, percent: null };
|
||||
const boundary = recordOf(args.boundary);
|
||||
const from = stopName(ctx, boundary.from_assignment_id);
|
||||
if (boundary.to_assignment_id === null || boundary.to_assignment_id === undefined) {
|
||||
return { dayId, dayNumber, mode: 'stop', from, to: null, percent: null };
|
||||
}
|
||||
const fraction = finite(boundary.fraction);
|
||||
return {
|
||||
dayId,
|
||||
dayNumber,
|
||||
mode: 'along',
|
||||
from,
|
||||
to: stopName(ctx, boundary.to_assignment_id),
|
||||
percent: fraction === null ? null : Math.round(Math.min(1, Math.max(0, fraction)) * 100),
|
||||
};
|
||||
}
|
||||
|
||||
/** set_day_boundary as a card. */
|
||||
export function dayEndCard(ctx: PreviewContext, args: ToolArgs): RoadtripRulesCard | null {
|
||||
const dayEnd = dayEndOf(ctx, args);
|
||||
return dayEnd ? { kind: 'roadtripRules', settings: [], dayEnd } : null;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import type { ToolCards, UndoSnapshot } from '../card-types';
|
||||
import { argId, idIn, recordOf } from '../card-values';
|
||||
|
||||
/**
|
||||
* The way back from a via sent into a day's drive: remove it again, as long
|
||||
* as it still stands where it was put. A via someone dragged since, or
|
||||
* pinned to another stop, is theirs now and stays.
|
||||
*/
|
||||
|
||||
const LIST_VIAS = 'list_route_vias';
|
||||
|
||||
/** The via an add answered with, as the day's list holds it now; undefined when it is gone. */
|
||||
function viaNow(viaId: unknown, snapshot: UndoSnapshot): Record<string, unknown> | undefined {
|
||||
for (const [key, value] of snapshot.reads) {
|
||||
if (!key.startsWith(`${LIST_VIAS} `)) continue;
|
||||
const list = recordOf(value).vias;
|
||||
const found = (Array.isArray(list) ? list : []).map(recordOf).find((via) => via.id === viaId);
|
||||
if (found) return found;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** add_route_via, taken back by removing the via it made while that via is unchanged. */
|
||||
export const REMOVE_ADDED_VIA: NonNullable<ToolCards['undo']> = {
|
||||
tool: 'remove_route_via',
|
||||
args: (args, result) => {
|
||||
const viaId = idIn(result, 'via');
|
||||
const dayId = argId(args, 'dayId');
|
||||
return viaId && dayId ? { dayId, viaId } : null;
|
||||
},
|
||||
reads: (args) => {
|
||||
const dayId = argId(args, 'dayId');
|
||||
return [{ tool: LIST_VIAS, args: dayId ? { dayId } : {} }];
|
||||
},
|
||||
unchanged: (result, snapshot) => {
|
||||
const made = recordOf(recordOf(result).via);
|
||||
const now = viaNow(made.id, snapshot);
|
||||
return (
|
||||
now !== undefined &&
|
||||
now.lat === made.lat &&
|
||||
now.lng === made.lng &&
|
||||
now.after_order_index === made.after_order_index
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,114 @@
|
||||
import { recordOf } from '../card-values';
|
||||
|
||||
/**
|
||||
* Gives an applied create_transit_journey back the itinerary the search found.
|
||||
* The model never sees a connection's line on the map (`geometry` and
|
||||
* `geometryPrecision` are dropped from every answer it gets), yet the tool
|
||||
* requires both on every leg, so the itinerary it passes on would be refused.
|
||||
*
|
||||
* The itineraries transit searches answered with are kept per user and trip,
|
||||
* across turns, as the provider gave them: "show me trains" and "add the
|
||||
* 08:04" are often two messages. The held call keeps the model's copy, so the
|
||||
* thread never stores or replays a line; the matching itinerary is put in
|
||||
* place of it only when the change is applied. When nothing kept matches (the
|
||||
* server restarted, the connection was found long ago), one search for the
|
||||
* same two places at the connection's own departure finds it again.
|
||||
*/
|
||||
|
||||
export const TRANSIT_SEARCH_TOOL = 'search_transit_routes';
|
||||
export const TRANSIT_CREATE_TOOL = 'create_transit_journey';
|
||||
|
||||
/** The itineraries one user and trip keep at most; a search answers with a handful. */
|
||||
const MAX_KEPT = 50;
|
||||
/** The users and trips kept at most; the longest unused goes first. */
|
||||
const MAX_SHELVES = 200;
|
||||
/** How long a found itinerary is kept: a connection found yesterday is searched again. */
|
||||
const KEPT_MS = 6 * 60 * 60 * 1000;
|
||||
|
||||
/** An instant as one spelling: `+02:00` and `Z` name the same moment. */
|
||||
function instantOf(value: unknown): number | null {
|
||||
if (typeof value !== 'string') return null;
|
||||
const at = Date.parse(value);
|
||||
return Number.isFinite(at) ? at : null;
|
||||
}
|
||||
|
||||
/** Drops the entry set longest ago: a map keeps its keys in the order they were set. */
|
||||
function dropOldest<V>(map: Map<string, V>): void {
|
||||
const oldest = map.keys().next();
|
||||
if (oldest.done !== true) map.delete(oldest.value);
|
||||
}
|
||||
|
||||
/** What tells one connection from another: its two instants and the lines of its legs, in order. */
|
||||
export function itineraryKey(raw: unknown): string | null {
|
||||
const itinerary = recordOf(raw);
|
||||
const start = instantOf(itinerary.startTime);
|
||||
const end = instantOf(itinerary.endTime);
|
||||
if (start === null || end === null || !Array.isArray(itinerary.legs)) return null;
|
||||
const lines = itinerary.legs.map((leg: unknown) => {
|
||||
const line = recordOf(leg).line;
|
||||
return typeof line === 'string' ? line : '';
|
||||
});
|
||||
return `${start}|${end}|${lines.length}|${lines.join(',')}`;
|
||||
}
|
||||
|
||||
/** The itineraries one user's transit searches on one trip answered with, each for a while. */
|
||||
export class KeptItineraries {
|
||||
private readonly byKey = new Map<string, { itinerary: unknown; at: number }>();
|
||||
|
||||
constructor(private readonly now: () => number = Date.now) {}
|
||||
|
||||
/** Keeps the itineraries a transit search answered with; the oldest give way past the cap. */
|
||||
keep(value: unknown): void {
|
||||
const itineraries = recordOf(value).itineraries;
|
||||
if (!Array.isArray(itineraries)) return;
|
||||
for (const itinerary of itineraries) {
|
||||
const key = itineraryKey(itinerary);
|
||||
if (key === null) continue;
|
||||
this.byKey.delete(key);
|
||||
this.byKey.set(key, { itinerary, at: this.now() });
|
||||
if (this.byKey.size > MAX_KEPT) dropOldest(this.byKey);
|
||||
}
|
||||
}
|
||||
|
||||
/** The kept itinerary under this key, while it is fresh. */
|
||||
find(key: string): unknown {
|
||||
const kept = this.byKey.get(key);
|
||||
if (!kept) return undefined;
|
||||
if (this.now() - kept.at > KEPT_MS) {
|
||||
this.byKey.delete(key);
|
||||
return undefined;
|
||||
}
|
||||
return kept.itinerary;
|
||||
}
|
||||
}
|
||||
|
||||
/** The kept itineraries of every user and trip, the longest unused dropped past the cap. */
|
||||
export class ItineraryShelves {
|
||||
private readonly shelves = new Map<string, KeptItineraries>();
|
||||
|
||||
constructor(private readonly now: () => number = Date.now) {}
|
||||
|
||||
of(userId: number, tripId: number): KeptItineraries {
|
||||
const key = `${userId}:${tripId}`;
|
||||
const shelf = this.shelves.get(key) ?? new KeptItineraries(this.now);
|
||||
this.shelves.delete(key);
|
||||
this.shelves.set(key, shelf);
|
||||
if (this.shelves.size > MAX_SHELVES) dropOldest(this.shelves);
|
||||
return shelf;
|
||||
}
|
||||
}
|
||||
|
||||
/** The arguments with the kept itinerary in place of the model's copy; the same object when none matches. */
|
||||
export function restoreItinerary(kept: KeptItineraries, args: Record<string, unknown>): Record<string, unknown> {
|
||||
const key = itineraryKey(args.itinerary);
|
||||
const found = key === null ? undefined : kept.find(key);
|
||||
return found === undefined ? args : { ...args, itinerary: found };
|
||||
}
|
||||
|
||||
/** The search that finds the call's connection again: its two places, from its own departure; null without them. */
|
||||
export function searchAgainArgs(args: Record<string, unknown>): Record<string, unknown> | null {
|
||||
const startTime = recordOf(args.itinerary).startTime;
|
||||
if (typeof startTime !== 'string' || instantOf(startTime) === null) return null;
|
||||
if (!args.from || typeof args.from !== 'object' || !args.to || typeof args.to !== 'object') return null;
|
||||
return { from: args.from, to: args.to, time: startTime };
|
||||
}
|
||||
@@ -119,6 +119,11 @@ export class GoogleRouteService {
|
||||
this.assignments.broadcast(String(tripId), 'assignment:created', { assignment }, socketId);
|
||||
}
|
||||
await this.assignments.reconcile(tripId, socketId);
|
||||
return { imported: imported.length };
|
||||
// The ids name what the import made, so the assistant's receipt can show and open it.
|
||||
return {
|
||||
imported: imported.length,
|
||||
place_ids: imported.map(({ place }) => place.id),
|
||||
assignment_ids: imported.flatMap(({ assignment }) => (assignment ? [assignment.id] : [])),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
corridorTiles,
|
||||
drivenPieces,
|
||||
inRiddenRange,
|
||||
insertIndexForAlong,
|
||||
projectOntoRoute,
|
||||
rideGaps,
|
||||
riddenRanges,
|
||||
@@ -92,7 +93,7 @@ export class RoadtripPlanningMcp {
|
||||
@Tool({
|
||||
name: 'search_roadtrip_corridor',
|
||||
description:
|
||||
'Search for fuel, charging, rest areas, campsites, food, sights or accommodation along a calculated roadtrip day, without a browser. Uses the routed road, not a straight line, and leaves out the ride between the two terminals of a flight, train, ferry, cruise or bus booking: no rectangle is searched under it and nothing found there is a hit. Returns distance along the route and distance from it. Search rectangles are paged in batches of six; continue with nextOffset until null for full coverage. Optional name, socket family and minimum power filter the matches; missing charging details mean unknown. Does not add stops. Add a chosen place and assign it to the appropriate stored day, preserving any via anchors. With roadtrip_hotel_bookends on, the road of the day includes the drive from the stay slept in and to the stay of that night; a place found there belongs at the start or the end of the stored day. Routing failures refuse the corridor search rather than searching an invented line.',
|
||||
'Search for fuel, charging, rest areas, campsites, food, sights or accommodation along a calculated roadtrip day, without a browser. Uses the routed road, not a straight line, and leaves out the ride between the two terminals of a flight, train, ferry, cruise or bus booking: no rectangle is searched under it and nothing found there is a hit. Returns distance along the route, distance from it and the names of the two stops of the day each hit lies between. Search rectangles are paged in batches of six; continue with nextOffset until null for full coverage. Optional name, socket family and minimum power filter the matches; missing charging details mean unknown. Does not add stops. Add a chosen place and assign it to the appropriate stored day, preserving any via anchors. With roadtrip_hotel_bookends on, the road of the day includes the drive from the stay slept in and to the stay of that night; a place found there belongs at the start or the end of the stored day. Routing failures refuse the corridor search rather than searching an invented line.',
|
||||
inputSchema: roadtripCorridorRequestSchema.shape,
|
||||
annotations: TOOL_ANNOTATIONS_READONLY,
|
||||
access: { group: 'trips', mode: 'read' },
|
||||
@@ -117,12 +118,28 @@ export class RoadtripPlanningMcp {
|
||||
// not on that stretch: nothing under it is tiled or on the way (#2428).
|
||||
const ridden = riddenRanges(line, rideGaps(day.stops));
|
||||
const tiles = drivenPieces(line, ridden).flatMap((piece) => corridorTiles(piece, input.widthKm));
|
||||
// The stops a hit lies between, so a chosen one can be put at its place in the day.
|
||||
// Each stop is placed on the road from the previous one on: a day that passes a spot
|
||||
// twice (a loop, a crossing) would otherwise put a later stop back at the first pass.
|
||||
let reachedKm = 0;
|
||||
const anchors = day.stops.flatMap((stop) => {
|
||||
const alongKm = projectOntoRoute(stop, line, { fromKm: reachedKm, toKm: Number.POSITIVE_INFINITY })?.alongKm;
|
||||
if (alongKm === undefined) return [];
|
||||
reachedKm = alongKm;
|
||||
return [{ name: stop.name, alongKm }];
|
||||
});
|
||||
const betweenStops = (alongKm: number): [string, string] | null => {
|
||||
if (anchors.length < 2) return null;
|
||||
const index = insertIndexForAlong(anchors.map((anchor) => anchor.alongKm), alongKm);
|
||||
return [anchors[index - 1].name, anchors[index].name];
|
||||
};
|
||||
const hits = new Map<
|
||||
string,
|
||||
{
|
||||
poi: Awaited<ReturnType<RoadtripSearchService['search']>>['pois'][number];
|
||||
alongKm: number;
|
||||
distanceKm: number;
|
||||
between: [string, string] | null;
|
||||
}
|
||||
>();
|
||||
const page = tiles.slice(input.offset, input.offset + 6);
|
||||
@@ -159,7 +176,12 @@ export class RoadtripPlanningMcp {
|
||||
)
|
||||
continue;
|
||||
}
|
||||
hits.set(poi.osm_id, { poi, alongKm: projection.alongKm, distanceKm: projection.offRouteKm });
|
||||
hits.set(poi.osm_id, {
|
||||
poi,
|
||||
alongKm: projection.alongKm,
|
||||
distanceKm: projection.offRouteKm,
|
||||
between: betweenStops(projection.alongKm),
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
failedAreas.push(input.offset + page.indexOf(bbox));
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* The road trip in the assistant chat, end to end: the whole app (buildApp,
|
||||
* the real MCP registry with its road trip addon gate, the real services on a
|
||||
* migrated temp SQLite) and an instance connection pointing at a fake
|
||||
* OpenAI-compatible server on loopback, scripted per case. A held change to
|
||||
* the driving settings streams its rules card, read against what is saved;
|
||||
* the thread it is stored in still reads back, the card with it; once
|
||||
* approved the setting is saved and the receipt names the road trip.
|
||||
*/
|
||||
import { buildApp } from '../../src/bootstrap';
|
||||
import { setAddonEnabled } from '../helpers/factories/settings';
|
||||
import { makeTrip } from '../helpers/factories/trips';
|
||||
import { makeUser } from '../helpers/factories/users';
|
||||
import { resetRateLimits } from '../helpers/test-db';
|
||||
import { sessionCookie } from './harness';
|
||||
import { MikroORM } from '@mikro-orm/core';
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import type { AssistantMessagePart, RoadtripRulesCard, UiStreamChunk } from '@trek/shared';
|
||||
|
||||
import { createServer, type IncomingMessage, type Server as HttpServer, type ServerResponse } from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import request from 'supertest';
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
type Step = () => { chunks: object[] };
|
||||
|
||||
const provider = { requests: [] as string[], script: [] as Step[] };
|
||||
|
||||
const say =
|
||||
(text: string): Step =>
|
||||
() => ({
|
||||
chunks: [
|
||||
{ choices: [{ index: 0, delta: { content: text } }] },
|
||||
{ choices: [{ index: 0, delta: {}, finish_reason: 'stop' }] },
|
||||
],
|
||||
});
|
||||
|
||||
const callTool =
|
||||
(id: string, name: string, args: Record<string, unknown>): Step =>
|
||||
() => ({
|
||||
chunks: [
|
||||
{
|
||||
choices: [
|
||||
{
|
||||
index: 0,
|
||||
delta: {
|
||||
tool_calls: [{ index: 0, id, type: 'function', function: { name, arguments: JSON.stringify(args) } }],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{ choices: [{ index: 0, delta: {}, finish_reason: 'tool_calls' }] },
|
||||
],
|
||||
});
|
||||
|
||||
async function answer(req: IncomingMessage, res: ServerResponse): Promise<void> {
|
||||
if (req.method === 'GET' && req.url?.startsWith('/api/tags')) {
|
||||
res.writeHead(200, { 'content-type': 'application/json' });
|
||||
res.end(JSON.stringify({ models: [{ name: 'fake-model', size: 1 }] }));
|
||||
return;
|
||||
}
|
||||
if (req.method !== 'POST' || req.url !== '/v1/chat/completions') {
|
||||
res.writeHead(404).end();
|
||||
return;
|
||||
}
|
||||
let text = '';
|
||||
for await (const chunk of req) text += String(chunk);
|
||||
provider.requests.push(text);
|
||||
const reply = (provider.script.shift() ?? say('Nothing more.'))();
|
||||
res.writeHead(200, { 'content-type': 'text/event-stream' });
|
||||
for (const chunk of reply.chunks) res.write(`data: ${JSON.stringify(chunk)}\n\n`);
|
||||
res.end('data: [DONE]\n\n');
|
||||
}
|
||||
|
||||
let app: INestApplication;
|
||||
let orm: MikroORM;
|
||||
let fake: HttpServer;
|
||||
|
||||
const CTX = { locale: 'en', timeZone: 'Europe/Berlin' };
|
||||
|
||||
beforeAll(async () => {
|
||||
fake = createServer((req, res) => {
|
||||
answer(req, res).catch(() => res.destroy());
|
||||
});
|
||||
await new Promise<void>((resolve) => fake.listen(0, '127.0.0.1', resolve));
|
||||
app = await buildApp();
|
||||
orm = app.get(MikroORM);
|
||||
await setAddonEnabled(orm, 'ai_assistant', true);
|
||||
await setAddonEnabled(orm, 'roadtrip', true);
|
||||
const admin = (await makeUser(orm, { role: 'admin' })).user.id;
|
||||
const { port } = fake.address() as AddressInfo;
|
||||
const res = await request(app.getHttpServer())
|
||||
.put('/api/admin/ai/connection')
|
||||
.set('Cookie', sessionCookie(admin))
|
||||
.send({ kind: 'custom', baseUrl: `http://127.0.0.1:${port}/v1`, model: 'fake-model' });
|
||||
expect(res.status).toBe(200);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await resetRateLimits(app);
|
||||
provider.requests = [];
|
||||
provider.script = [];
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await app.close();
|
||||
await new Promise<void>((resolve) => fake.close(() => resolve()));
|
||||
});
|
||||
|
||||
/** A request with its whole stream read, as the chunks it sent. */
|
||||
async function post(path: string, userId: number, body: object): Promise<{ status: number; chunks: UiStreamChunk[] }> {
|
||||
const res = await request(app.getHttpServer())
|
||||
.post(path)
|
||||
.set('Cookie', sessionCookie(userId))
|
||||
.send(body)
|
||||
.buffer(true)
|
||||
.parse((stream, done) => {
|
||||
let text = '';
|
||||
stream.setEncoding('utf8');
|
||||
stream.on('data', (chunk: string) => (text += chunk));
|
||||
stream.on('end', () => done(null, text));
|
||||
});
|
||||
const events = String(res.body)
|
||||
.split('\n\n')
|
||||
.filter((event) => event.startsWith('data: ') && event !== 'data: [DONE]')
|
||||
.map((event) => JSON.parse(event.slice('data: '.length)) as UiStreamChunk);
|
||||
return { status: res.status, chunks: events };
|
||||
}
|
||||
|
||||
const ofType = <T extends UiStreamChunk['type']>(chunks: UiStreamChunk[], type: T) =>
|
||||
chunks.filter((chunk): chunk is Extract<UiStreamChunk, { type: T }> => chunk.type === type);
|
||||
|
||||
describe('assistant: road trip', () => {
|
||||
it('ASTE2E-RT-001: a held settings change shows its rules card, reads back from the thread, then saves', async () => {
|
||||
const { user } = await makeUser(orm);
|
||||
const trip = await makeTrip(orm, user.id, { title: 'Alps' });
|
||||
const base = `/api/trips/${trip.id}/assistant`;
|
||||
const settings = { roadtrip_hotel_bookends: true };
|
||||
provider.script = [callTool('call_rules', 'update_roadtrip_settings', { settings })];
|
||||
const turn = await post(`${base}/chat`, user.id, { ...CTX, threadId: null, text: 'Start each day at the hotel' });
|
||||
expect(turn.status).toBe(200);
|
||||
expect(provider.requests).toHaveLength(1);
|
||||
const toolCallId = ofType(turn.chunks, 'tool-approval-request')[0]?.toolCallId ?? '';
|
||||
const [change] = ofType(turn.chunks, 'data-trek-change');
|
||||
expect(change?.data).toMatchObject({ toolCallId, tool: 'update_roadtrip_settings' });
|
||||
const pending = change?.data.card as RoadtripRulesCard;
|
||||
expect(pending).toEqual({
|
||||
kind: 'roadtripRules',
|
||||
settings: [{ key: 'roadtrip_hotel_bookends', before: null, after: true }],
|
||||
dayEnd: null,
|
||||
});
|
||||
|
||||
const threadId = ofType(turn.chunks, 'data-trek-thread')[0]?.data.threadId;
|
||||
const shown = await request(app.getHttpServer())
|
||||
.get(`${base}/threads/${threadId}`)
|
||||
.set('Cookie', sessionCookie(user.id));
|
||||
expect(shown.status).toBe(200);
|
||||
const parts = shown.body.messages.flatMap((message: { parts: AssistantMessagePart[] }) => message.parts);
|
||||
const stored = parts.find((part: AssistantMessagePart) => part.type === 'data-trek-change');
|
||||
expect(stored?.data.card).toEqual(pending);
|
||||
|
||||
provider.script = [say('Done, each day now starts at your stay.')];
|
||||
const decided = await post(`${base}/threads/${threadId}/decisions`, user.id, {
|
||||
...CTX,
|
||||
decisions: [{ toolCallId, approved: true }],
|
||||
});
|
||||
expect(decided.status).toBe(200);
|
||||
const [applied] = ofType(decided.chunks, 'data-trek-applied');
|
||||
expect(applied?.data).toMatchObject({ toolCallId, entity: 'roadtrip' });
|
||||
const saved = await request(app.getHttpServer())
|
||||
.get(`/api/trips/${trip.id}/roadtrip/preferences`)
|
||||
.set('Cookie', sessionCookie(user.id));
|
||||
expect(saved.status).toBe(200);
|
||||
expect(saved.body.preferences).toMatchObject(settings);
|
||||
});
|
||||
});
|
||||
@@ -183,7 +183,7 @@ describe('Roadtrip e2e (real guard chain + temp SQLite)', () => {
|
||||
it('validates Google route preview and import before executing either service', async () => {
|
||||
const routes = app.get(GoogleRouteService);
|
||||
const preview = vi.spyOn(routes, 'preview').mockResolvedValue({ stops: [] });
|
||||
const save = vi.spyOn(routes, 'import').mockResolvedValue({ imported: 2 });
|
||||
const save = vi.spyOn(routes, 'import').mockResolvedValue({ imported: 2, place_ids: [], assignment_ids: [] });
|
||||
const input = {
|
||||
dayId: 3,
|
||||
stops: [
|
||||
|
||||
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* The road trip's change cards: every via change drawn on its day (a via
|
||||
* added after its stop, a chain with the vias it clears, a move from where it
|
||||
* stands, a removal, vias pinned again), a Google Maps route's stops
|
||||
* appended, the driving settings from what is saved to what the call sets,
|
||||
* where a day ends, the way back from an added via, and the tool groups the
|
||||
* road trip loads with.
|
||||
*/
|
||||
import { buildTripCard } from '../../../../../../src/nest/assistant/assistant-context';
|
||||
import { ASSISTANT_TOOL_GROUPS } from '../../../../../../src/nest/assistant/assistant-tool-offer';
|
||||
import type { PreviewContext, UndoSnapshot } from '../../../../../../src/nest/assistant/cards/card-types';
|
||||
import { readKey } from '../../../../../../src/nest/assistant/cards/card-values';
|
||||
import {
|
||||
ASSISTANT_UNDO_MAP,
|
||||
ASSISTANT_WRITE_TOOLS,
|
||||
CARD_PROMPT_LINES,
|
||||
TOOL_CARDS,
|
||||
undoReadsOf,
|
||||
} from '../../../../../../src/nest/assistant/cards/registry';
|
||||
import { routeText } from '../../../../../../src/nest/assistant/cards/roadtrip/roadtrip-describe';
|
||||
import { loadDayVias, type DayVias } from '../../../../../../src/nest/assistant/cards/roadtrip/roadtrip-route';
|
||||
import { loadSavedSettings } from '../../../../../../src/nest/assistant/cards/roadtrip/roadtrip-rules';
|
||||
import { appliedChange, describeToolCall } from '../../../../../../src/nest/assistant/tool-call-preview.helpers';
|
||||
import type { DayRouteCard, RoadtripRulesCard } from '@trek/shared';
|
||||
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const logMock = vi.hoisted(() => ({ logInfo: vi.fn(), logError: vi.fn(), logWarn: vi.fn(), logDebug: vi.fn() }));
|
||||
vi.mock('../../../../../../src/nest/audit/audit-log.logger', () => logMock);
|
||||
|
||||
const place = (id: number, name: string, lat: number, lng: number) => ({ id, name, lat, lng });
|
||||
const card = buildTripCard(
|
||||
1,
|
||||
7,
|
||||
{
|
||||
trip: { title: 'Alps' },
|
||||
days: [
|
||||
{
|
||||
id: 31,
|
||||
day_number: 2,
|
||||
date: '2026-10-02',
|
||||
assignments: [
|
||||
{ id: 301, place: place(1, 'Munich', 48.137, 11.575) },
|
||||
{ id: 302, place: place(2, 'Garmisch', 47.49, 11.09) },
|
||||
{ id: 303, place: place(3, 'Innsbruck', 47.26, 11.39) },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ places: [place(9, 'Romantic Road track', 48.5, 10.5)] },
|
||||
null,
|
||||
);
|
||||
const ctx: PreviewContext = { card, categories: new Map(), locale: 'en', today: '2026-10-01', airport: () => null };
|
||||
const vias: DayVias = {
|
||||
vias: [
|
||||
{ id: 71, lat: 47.8, lng: 11.3, after: 0 },
|
||||
{ id: 72, lat: 47.4, lng: 11.2, after: 1 },
|
||||
],
|
||||
};
|
||||
|
||||
const ROADTRIP_WRITES = [
|
||||
'add_route_via',
|
||||
'add_route_vias',
|
||||
'update_route_via',
|
||||
'remove_route_via',
|
||||
'reanchor_route_vias',
|
||||
'update_roadtrip_settings',
|
||||
'set_day_boundary',
|
||||
'import_google_maps_route',
|
||||
'create_transit_journey',
|
||||
];
|
||||
|
||||
const preview = (tool: string, args: Record<string, unknown>, loaded: unknown = null) =>
|
||||
describeToolCall(tool, 'call_9', args, ctx, loaded);
|
||||
const routeOf = (tool: string, args: Record<string, unknown>, loaded: unknown = null) =>
|
||||
preview(tool, args, loaded).card as DayRouteCard;
|
||||
|
||||
describe('via change cards', () => {
|
||||
it('ASTRT-020: a via added after its stop, on the day with its stops in order', () => {
|
||||
const shown = preview('add_route_via', { dayId: 31, after_order_index: 1, lat: 47.35, lng: 11.2 });
|
||||
expect(shown).toMatchObject({ verbKey: 'addRouteVia', subject: 'Garmisch', dayId: 31, undoable: true });
|
||||
expect(shown.rows.find((row) => row.labelKey === 'day')?.after).toContain('Oct');
|
||||
const route = shown.card as DayRouteCard;
|
||||
expect(route).toMatchObject({ kind: 'dayRoute', dayId: 31, dayNumber: 2, afterName: 'Garmisch', track: null });
|
||||
expect(route.stops.map((stop) => stop.name)).toEqual(['Munich', 'Garmisch', 'Innsbruck']);
|
||||
expect(route.vias).toEqual([{ lat: 47.35, lng: 11.2, after: 1, state: 'added', from: null }]);
|
||||
});
|
||||
|
||||
it('ASTRT-021: a chain names its track and the vias of the legs it clears first', () => {
|
||||
const args = {
|
||||
dayId: 31,
|
||||
vias: [
|
||||
{ after_order_index: 0, lat: 47.9, lng: 11.4 },
|
||||
{ after_order_index: 0, lat: 47.7, lng: 11.2 },
|
||||
],
|
||||
replace_legs: [0],
|
||||
track: { place_id: 9 },
|
||||
};
|
||||
const shown = preview('add_route_vias', args, vias);
|
||||
expect(shown.verbKey).toBe('shapeRoute');
|
||||
expect(shown.rows.find((row) => row.labelKey === 'quantity')?.after).toBe('2');
|
||||
const route = shown.card as DayRouteCard;
|
||||
expect(route).toMatchObject({ afterName: 'Munich', track: 'Romantic Road track' });
|
||||
expect(route.vias.map((via) => via.state)).toEqual(['added', 'added', 'removed']);
|
||||
});
|
||||
|
||||
it('ASTRT-022: a move from where the via stands, a removal of a via the day has, vias pinned again', () => {
|
||||
const move = { dayId: 31, viaId: 72, lat: 47.3, lng: 11.25, after_order_index: 0 };
|
||||
const moved = routeOf('update_route_via', move, vias);
|
||||
expect(moved.vias).toEqual([{ lat: 47.3, lng: 11.25, after: 0, state: 'moved', from: [47.4, 11.2] }]);
|
||||
expect(moved.afterName).toBe('Munich');
|
||||
const shownMove = preview('update_route_via', { dayId: 31, viaId: 72, lat: 47.3, lng: 11.25 }, vias);
|
||||
expect(shownMove.rows.find((row) => row.labelKey === 'coordinates')).toMatchObject({
|
||||
before: '47.40000, 11.20000',
|
||||
after: '47.30000, 11.25000',
|
||||
});
|
||||
const gone = preview('remove_route_via', { dayId: 31, viaId: 71 }, vias);
|
||||
expect(gone.verbKey).toBe('removeRouteVia');
|
||||
expect((gone.card as DayRouteCard).vias).toEqual([
|
||||
{ lat: 47.8, lng: 11.3, after: 0, state: 'removed', from: null },
|
||||
]);
|
||||
expect(preview('remove_route_via', { dayId: 31, viaId: 99 }, vias).card).toBeUndefined();
|
||||
const repin = { dayId: 31, vias: [{ id: 71, after_order_index: 1 }], remove: [72] };
|
||||
const repinned = routeOf('reanchor_route_vias', repin, vias);
|
||||
expect(repinned.vias.map((via) => [via.state, via.after])).toEqual([
|
||||
['repinned', 1],
|
||||
['removed', 1],
|
||||
]);
|
||||
});
|
||||
|
||||
it('ASTRT-023: a move without the day read still shows where the via goes', () => {
|
||||
const moved = routeOf('update_route_via', { dayId: 31, viaId: 72, lat: 47.3, lng: 11.25 });
|
||||
expect(moved.vias).toEqual([{ lat: 47.3, lng: 11.25, after: 0, state: 'moved', from: null }]);
|
||||
});
|
||||
|
||||
it('ASTRT-024: a Google Maps route appends its stops to the day', () => {
|
||||
const args = {
|
||||
dayId: 31,
|
||||
stops: [
|
||||
{ name: 'Seefeld', lat: 47.33, lng: 11.19 },
|
||||
{ name: 'Bolzano', lat: 46.5, lng: 11.35 },
|
||||
],
|
||||
};
|
||||
const shown = preview('import_google_maps_route', args);
|
||||
expect(shown).toMatchObject({ verbKey: 'importRoute', subject: 'Seefeld → Bolzano', dayId: 31 });
|
||||
expect((shown.card as DayRouteCard).stops.map((stop) => [stop.name, stop.added])).toEqual([
|
||||
['Munich', false],
|
||||
['Garmisch', false],
|
||||
['Innsbruck', false],
|
||||
['Seefeld', true],
|
||||
['Bolzano', true],
|
||||
]);
|
||||
const applied = appliedChange('import_google_maps_route', 'call_9', args, { place_ids: [41, 42] }, 31, null);
|
||||
expect(applied).toMatchObject({ entity: 'assignment', ids: [41, 42], dayId: 31 });
|
||||
});
|
||||
|
||||
it('ASTRT-025: reads the day vias once, through the reader the turn hands in', async () => {
|
||||
const stored = { id: 71, day_id: 31, after_order_index: 0, sequence: 0, lat: 47.8, lng: 11.3 };
|
||||
const read = vi.fn(async () => ({ vias: [stored] }));
|
||||
expect(await loadDayVias({ dayId: 31 }, read)).toEqual({ vias: [{ id: 71, lat: 47.8, lng: 11.3, after: 0 }] });
|
||||
expect(read).toHaveBeenCalledWith('list_route_vias', { dayId: 31 });
|
||||
expect(await loadDayVias({}, read)).toBeNull();
|
||||
expect(await loadDayVias({ dayId: 31 }, async () => null)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('settings and day end cards', () => {
|
||||
it('ASTRT-026: the settings a call changes, each against what is saved', async () => {
|
||||
const saved = await loadSavedSettings({}, async () => ({
|
||||
tripId: 1,
|
||||
settings: { roadtrip_day_start: '08:00', roadtrip_hotel_bookends: false },
|
||||
}));
|
||||
const args = { settings: { roadtrip_day_start: '09:30', roadtrip_hotel_bookends: true, roadtrip_leg_minutes: 0 } };
|
||||
const shown = preview('update_roadtrip_settings', args, saved);
|
||||
expect(shown).toMatchObject({ verbKey: 'updateDriveSettings', subject: 'Alps' });
|
||||
expect((shown.card as RoadtripRulesCard).settings).toEqual([
|
||||
{ key: 'roadtrip_day_start', before: '08:00', after: '09:30' },
|
||||
{ key: 'roadtrip_hotel_bookends', before: false, after: true },
|
||||
{ key: 'roadtrip_leg_minutes', before: null, after: 0 },
|
||||
]);
|
||||
expect(shown.rows[0]).toMatchObject({ labelKey: 'field', field: 'roadtrip_day_start', before: '08:00' });
|
||||
const unread = preview('update_roadtrip_settings', args).card as RoadtripRulesCard;
|
||||
expect(unread.settings[0]).toEqual({ key: 'roadtrip_day_start', before: null, after: '09:30' });
|
||||
});
|
||||
|
||||
it('ASTRT-027: a day that ends at a stop, part way along a drive, or automatically again', () => {
|
||||
const atStop = preview('set_day_boundary', {
|
||||
dayNumber: 2,
|
||||
boundary: { from_assignment_id: 302, to_assignment_id: null, fraction: 0 },
|
||||
});
|
||||
expect(atStop).toMatchObject({ verbKey: 'setDayBoundary', subject: 'Garmisch', dayId: 31 });
|
||||
expect(atStop.rows.map((row) => row.labelKey)).toEqual(['day']);
|
||||
expect((atStop.card as RoadtripRulesCard).dayEnd).toEqual({
|
||||
dayId: 31,
|
||||
dayNumber: 2,
|
||||
mode: 'stop',
|
||||
from: 'Garmisch',
|
||||
to: null,
|
||||
percent: null,
|
||||
});
|
||||
const along = preview('set_day_boundary', {
|
||||
dayNumber: 2,
|
||||
boundary: { from_assignment_id: 302, to_assignment_id: 303, fraction: 0.4 },
|
||||
}).card as RoadtripRulesCard;
|
||||
expect(along.dayEnd).toMatchObject({ mode: 'along', from: 'Garmisch', to: 'Innsbruck', percent: 40 });
|
||||
const auto = preview('set_day_boundary', { dayNumber: 2, boundary: null }).card as RoadtripRulesCard;
|
||||
expect(auto.dayEnd).toMatchObject({ mode: 'auto', from: null });
|
||||
});
|
||||
|
||||
it('ASTRT-032: a route reads from its first name to its last, the arrow pointing the way they are written', () => {
|
||||
expect(routeText(['Seefeld', 'Innsbruck', 'Bolzano'])).toBe('Seefeld → Innsbruck → Bolzano');
|
||||
expect(routeText(['الرياض', 'جدة'])).toBe('الرياض ← جدة');
|
||||
expect(routeText(['(שדה תעופה) תל אביב', 'Haifa'])).toBe('(שדה תעופה) תל אביב ← Haifa');
|
||||
expect(routeText([])).toBe('');
|
||||
});
|
||||
|
||||
it('ASTRT-028: every road trip change card is valid for a call without arguments', () => {
|
||||
logMock.logWarn.mockClear();
|
||||
for (const tool of ROADTRIP_WRITES) {
|
||||
expect(ASSISTANT_WRITE_TOOLS[tool], tool).toBeDefined();
|
||||
expect(() => describeToolCall(tool, 'call_0', {}, ctx, null), tool).not.toThrow();
|
||||
}
|
||||
expect(logMock.logWarn).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('undo and tool groups', () => {
|
||||
const made = { via: { id: 71, day_id: 31, after_order_index: 0, sequence: 0, lat: 47.8, lng: 11.3 } };
|
||||
const snapshot = (list: unknown): UndoSnapshot => ({
|
||||
summary: null,
|
||||
places: null,
|
||||
reads: new Map([[readKey('list_route_vias', { dayId: 31 }), list]]),
|
||||
});
|
||||
|
||||
it('ASTRT-029: an added via goes back while it stands where it was put, and stays once moved', () => {
|
||||
const undo = ASSISTANT_UNDO_MAP.add_route_via;
|
||||
expect(undo.tool).toBe('remove_route_via');
|
||||
expect(undo.args({ dayId: 31 }, made, null)).toEqual({ dayId: 31, viaId: 71 });
|
||||
expect(undo.args({ dayId: 31 }, { via: {} }, null)).toBeNull();
|
||||
const reads = undoReadsOf('add_route_via', { dayId: 31 }, made);
|
||||
expect(reads).toEqual([{ tool: 'list_route_vias', args: { dayId: 31 } }]);
|
||||
const check = TOOL_CARDS.add_route_via?.undo;
|
||||
expect(check?.unchanged(made, snapshot({ vias: [made.via] }))).toBe(true);
|
||||
expect(check?.unchanged(made, snapshot({ vias: [{ ...made.via, lat: 47.9 }] }))).toBe(false);
|
||||
expect(check?.unchanged(made, snapshot({ vias: [] }))).toBe(false);
|
||||
expect(appliedChange('add_route_via', 'call_9', { dayId: 31 }, made, 31, null)).toMatchObject({
|
||||
entity: 'roadtrip',
|
||||
ids: [71],
|
||||
dayId: 31,
|
||||
});
|
||||
});
|
||||
|
||||
it('ASTRT-030: the day endings and the Google Maps route load with the road trip, which tells the model about its cards', () => {
|
||||
expect(ASSISTANT_TOOL_GROUPS.roadtrip?.controllers).toEqual(
|
||||
expect.arrayContaining(['RoadtripPlanningMcp', 'DayBoundariesMcp', 'GoogleRouteMcp']),
|
||||
);
|
||||
expect(ASSISTANT_TOOL_GROUPS.tours?.controllers).not.toContain('GoogleRouteMcp');
|
||||
expect(CARD_PROMPT_LINES.some((line) => line.includes('calculate_roadtrip'))).toBe(true);
|
||||
});
|
||||
|
||||
it('ASTRT-031: an imported Google Maps route names the day stops it created, as its receipt entity says', () => {
|
||||
const imported = { place_ids: [5, 6], assignment_ids: [301, 302], skipped: [] };
|
||||
expect(appliedChange('import_google_maps_route', 'call_9', { dayId: 31 }, imported, 31, null)).toMatchObject({
|
||||
entity: 'assignment',
|
||||
ids: [301, 302],
|
||||
});
|
||||
const broken = { place_ids: [5], assignment_ids: ['x', 0] };
|
||||
expect(appliedChange('import_google_maps_route', 'call_9', { dayId: 31 }, broken, 31, null)).toMatchObject({
|
||||
ids: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,303 @@
|
||||
/**
|
||||
* The card of calculate_roadtrip: the planner's rail rebuilt from the tool's
|
||||
* raw answer (stops with their schedule, terminals, booked nights and
|
||||
* findings), the totals and the problem it reports, the driven lines without
|
||||
* the ride between two terminals, and a trip too long for one card fitted
|
||||
* under the size cap by keeping its first days and thinning its lines.
|
||||
*/
|
||||
import { buildTripCard } from '../../../../../../src/nest/assistant/assistant-context';
|
||||
import { redactForProvider } from '../../../../../../src/nest/assistant/assistant-redact';
|
||||
import { AssistantToolSession } from '../../../../../../src/nest/assistant/assistant-tools.service';
|
||||
import { answerCardOf, ASSISTANT_ARG_POLICY } from '../../../../../../src/nest/assistant/cards/registry';
|
||||
import { roadtripAnswerCard } from '../../../../../../src/nest/assistant/cards/roadtrip/roadtrip-drive';
|
||||
import { MAX_CARD_CHARS, ROADTRIP_CARD_DAYS_MAX, roadtripCardSchema, type RoadtripCard } from '@trek/shared';
|
||||
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const logMock = vi.hoisted(() => ({ logInfo: vi.fn(), logError: vi.fn(), logWarn: vi.fn(), logDebug: vi.fn() }));
|
||||
vi.mock('../../../../../../src/nest/audit/audit-log.logger', () => logMock);
|
||||
|
||||
beforeEach(() => vi.clearAllMocks());
|
||||
|
||||
const card = buildTripCard(1, 7, { trip: { title: 'Alps' } }, null, null);
|
||||
|
||||
const stop = (name: string, lat: number, lng: number, extra: Record<string, unknown> = {}) => ({
|
||||
assignmentId: 100 + Math.round(lat * 10),
|
||||
ownerDayId: 3,
|
||||
ownerIndex: 0,
|
||||
placeId: 200 + Math.round(lat * 10),
|
||||
name,
|
||||
lat,
|
||||
lng,
|
||||
time: null,
|
||||
dwellMinutes: 30,
|
||||
legMode: null,
|
||||
incomingLegMode: null,
|
||||
stopType: null,
|
||||
...extra,
|
||||
});
|
||||
|
||||
const leg = (distance: number, duration: number, mode = 'driving') => ({
|
||||
distance,
|
||||
duration,
|
||||
mode,
|
||||
mid: [0, 0],
|
||||
from: [0, 0],
|
||||
to: [0, 0],
|
||||
walkingText: '',
|
||||
drivingText: '',
|
||||
distanceText: '',
|
||||
});
|
||||
|
||||
/** Munich, a charger, the airport, a flight to Rome, a stay booked in Rome for the night. */
|
||||
function day(dayId: number, extra: Record<string, unknown> = {}) {
|
||||
return {
|
||||
dayId,
|
||||
dayNumber: dayId,
|
||||
date: '2026-10-01',
|
||||
title: 'Munich to Rome',
|
||||
stops: [
|
||||
stop('Munich', 48.137, 11.575),
|
||||
stop('Ionity Holzkirchen', 47.883, 11.701, { stopType: 'charging', fillPercent: 80 }),
|
||||
stop('Munich Airport', 48.354, 11.786, {
|
||||
assignmentId: -1,
|
||||
placeId: -1,
|
||||
carrier: { reservationId: 9, type: 'flight', role: 'departure', title: 'LH 1840', code: 'MUC', at: '11:05' },
|
||||
}),
|
||||
stop('Rome Fiumicino', 41.8, 12.25, {
|
||||
assignmentId: -2,
|
||||
placeId: -2,
|
||||
carrier: { reservationId: 9, type: 'flight', role: 'arrival', title: 'LH 1840', code: 'FCO', at: '12:50' },
|
||||
}),
|
||||
stop('Hotel Roma', 41.9, 12.5, {
|
||||
assignmentId: -3,
|
||||
stopType: 'hotel',
|
||||
bookend: {
|
||||
phase: 'evening',
|
||||
accommodationId: 4,
|
||||
reservationId: null,
|
||||
checkingIn: true,
|
||||
checkingOut: false,
|
||||
checkOut: null,
|
||||
checkIn: '15:00',
|
||||
},
|
||||
}),
|
||||
],
|
||||
schedule: {
|
||||
entries: [
|
||||
{ arrival: '08:00', departure: '08:30', anchored: true, dayOffset: 0 },
|
||||
{ arrival: '09:00', departure: '09:30', anchored: false, dayOffset: 0 },
|
||||
{ arrival: '10:15', departure: '11:05', anchored: false, dayOffset: 0 },
|
||||
{ arrival: '12:50', departure: '13:10', anchored: false, dayOffset: 0 },
|
||||
{ arrival: '14:00', departure: null, anchored: false, dayOffset: 0 },
|
||||
],
|
||||
warnings: [
|
||||
{ index: 2, code: 'late', minutes: 15 },
|
||||
{ index: 4, code: 'overnight' },
|
||||
],
|
||||
},
|
||||
legs: [leg(30_000, 1800), leg(52_000, 2700), leg(0, 6300, 'flight'), leg(28_000, 1500)],
|
||||
distanceMetres: 110_000,
|
||||
durationSeconds: 12_300,
|
||||
driveWarnings: [{ index: 1, code: 'leg', overMinutes: 25 }],
|
||||
dayWarning: { code: 'dayDriving', minutes: 400, limitMinutes: 360 },
|
||||
avoidMissed: ['toll', 'toll', 'unknown'],
|
||||
dryPoints: [{ legIndex: 3, intoLegKm: 4, drivenMeters: 4000, sinceKm: 312.46 }],
|
||||
geometry: [
|
||||
[48.137, 11.575],
|
||||
[47.883, 11.701],
|
||||
[48.354, 11.786],
|
||||
[41.8, 12.25],
|
||||
[41.9, 12.5],
|
||||
],
|
||||
...extra,
|
||||
};
|
||||
}
|
||||
|
||||
const answer = (days: unknown[], extra: Record<string, unknown> = {}) => ({
|
||||
complete: true,
|
||||
settings: { roadtrip_vehicle: 'electric', roadtrip_fill_percent: 80, roadtrip_day_colors: true },
|
||||
failures: [],
|
||||
omittedVisitIds: [],
|
||||
undatedRides: [{ id: 5, type: 'train', title: 'ICE' }],
|
||||
dayWindowIssue: null,
|
||||
totalDistanceMetres: 110_000,
|
||||
totalDurationSeconds: 12_300,
|
||||
totalStops: 5,
|
||||
days,
|
||||
quietDays: [{ dayId: 9, dayNumber: 9 }],
|
||||
...extra,
|
||||
});
|
||||
|
||||
const input = (value: unknown, args: Record<string, unknown> = {}) => ({
|
||||
toolCallId: 'call_1',
|
||||
args,
|
||||
value,
|
||||
card,
|
||||
today: '2026-10-01',
|
||||
});
|
||||
|
||||
describe('calculate_roadtrip card', () => {
|
||||
it('ASTRT-001: rebuilds the rail of a day with its schedule, terminals, booked night and findings', () => {
|
||||
const built = roadtripAnswerCard(input(answer([day(3)]))) as RoadtripCard;
|
||||
expect(roadtripCardSchema.safeParse(built).success).toBe(true);
|
||||
const [first] = built.days;
|
||||
expect(first.stops.map((s) => s.name)).toEqual([
|
||||
'Munich',
|
||||
'Ionity Holzkirchen',
|
||||
'Munich Airport',
|
||||
'Rome Fiumicino',
|
||||
'Hotel Roma',
|
||||
]);
|
||||
expect(first.stops[0]).toMatchObject({ arrival: '08:00', departure: '08:30', anchored: true, placeId: 681 });
|
||||
expect(first.stops[1]).toMatchObject({ stopType: 'charging', fillPercent: 80 });
|
||||
expect(first.stops[2]).toMatchObject({
|
||||
placeId: null,
|
||||
assignmentId: null,
|
||||
carrier: { reservationId: 9, type: 'flight', role: 'departure', title: 'LH 1840', code: 'MUC', at: '11:05' },
|
||||
late: [{ code: 'late', minutes: 15 }],
|
||||
});
|
||||
expect(first.stops[4]).toMatchObject({
|
||||
assignmentId: null,
|
||||
bookend: { phase: 'evening', checkingIn: true, checkIn: '15:00', reservationId: null },
|
||||
late: [],
|
||||
});
|
||||
expect(first.legs).toEqual([
|
||||
{ distanceM: 30_000, durationS: 1800, mode: 'driving' },
|
||||
{ distanceM: 52_000, durationS: 2700, mode: 'driving' },
|
||||
{ distanceM: 0, durationS: 6300, mode: 'flight' },
|
||||
{ distanceM: 28_000, durationS: 1500, mode: 'driving' },
|
||||
]);
|
||||
expect(first).toMatchObject({
|
||||
dayOver: { minutes: 400, limitMinutes: 360 },
|
||||
avoidMissed: ['toll'],
|
||||
dryKm: 312.5,
|
||||
moreStops: 0,
|
||||
});
|
||||
});
|
||||
|
||||
it('ASTRT-002: names the drive leaving a stop by its own index', () => {
|
||||
const built = roadtripAnswerCard(input(answer([day(3)]))) as RoadtripCard;
|
||||
expect(built.days[0].stops.map((s) => s.findings.map((f) => f.code))).toEqual([[], ['leg'], [], [], []]);
|
||||
expect(built.days[0].stops[1].findings[0]).toEqual({ code: 'leg', overMinutes: 25, sinceKm: null });
|
||||
});
|
||||
|
||||
it('ASTRT-003: leaves the flight out of the lines and keeps the rest at five decimals', () => {
|
||||
const built = roadtripAnswerCard(input(answer([day(3)]))) as RoadtripCard;
|
||||
const lines = built.days[0].lines;
|
||||
expect(lines.length).toBe(2);
|
||||
const points = lines.flat();
|
||||
expect(points.some(([lat]) => lat > 42 && lat < 48)).toBe(false);
|
||||
for (const [lat, lng] of points) {
|
||||
expect(Math.round(lat * 1e5) / 1e5).toBe(lat);
|
||||
expect(Math.round(lng * 1e5) / 1e5).toBe(lng);
|
||||
}
|
||||
});
|
||||
|
||||
it('ASTRT-004: carries the totals, the vehicle, the preview keys and the problem the answer reports', () => {
|
||||
const built = roadtripAnswerCard(
|
||||
input(answer([day(3)], { complete: false, failures: [{ from: 1, to: 2 }] }), {
|
||||
settings: { roadtrip_hotel_bookends: true, endpoint: 'x' },
|
||||
}),
|
||||
) as RoadtripCard;
|
||||
expect(built).toMatchObject({
|
||||
complete: false,
|
||||
problem: 'routing',
|
||||
previewKeys: ['roadtrip_hotel_bookends'],
|
||||
vehicle: 'electric',
|
||||
defaultFill: 80,
|
||||
dayColors: true,
|
||||
distanceM: 110_000,
|
||||
durationS: 12_300,
|
||||
stopCount: 5,
|
||||
chargingCount: 1,
|
||||
moreDays: 0,
|
||||
quietDays: 1,
|
||||
undatedRides: 1,
|
||||
});
|
||||
const omitted = roadtripAnswerCard(input(answer([day(3)], { omittedVisitIds: [4] }))) as RoadtripCard;
|
||||
expect(omitted.problem).toBe('coordinates');
|
||||
const window = roadtripAnswerCard(input(answer([day(3)], { dayWindowIssue: 'conflict' }))) as RoadtripCard;
|
||||
expect(window.problem).toBe('dayWindow');
|
||||
});
|
||||
|
||||
it('ASTRT-005: a trip of thirty full days fits under the cap by its first days, its lines thinned', () => {
|
||||
const many = Array.from({ length: 24 }, (_, index) => stop(`Stop ${index}`, 45 + index * 0.1, 10 + index * 0.1));
|
||||
const geometry = Array.from({ length: 3000 }, (_, index) => [45 + index * 0.0008, 10 + index * 0.0008]);
|
||||
const days = Array.from({ length: 30 }, (_, index) =>
|
||||
day(index + 1, { stops: many, legs: many.slice(1).map(() => leg(1000, 60)), geometry, driveWarnings: [] }),
|
||||
);
|
||||
const built = answerCardOf('calculate_roadtrip', input(answer(days))) as RoadtripCard;
|
||||
expect(built).not.toBeNull();
|
||||
expect(JSON.stringify(built).length).toBeLessThanOrEqual(MAX_CARD_CHARS);
|
||||
expect(built.days.length).toBeLessThanOrEqual(ROADTRIP_CARD_DAYS_MAX);
|
||||
expect(built.days.length + built.moreDays).toBe(30);
|
||||
expect(built.days[0].stops).toHaveLength(16);
|
||||
expect(built.days[0].moreStops).toBe(8);
|
||||
for (const line of built.days.flatMap((d) => d.lines)) expect(line.length).toBeLessThanOrEqual(64);
|
||||
expect(built.days.flatMap((d) => d.lines).flat().length).toBeLessThanOrEqual(400);
|
||||
for (const kept of built.days) expect(kept.lines.length).toBeGreaterThan(0);
|
||||
expect(logMock.logWarn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('ASTRT-008: a ten day trip of six stops a day keeps a line on every day it shows', () => {
|
||||
const six = Array.from({ length: 6 }, (_, index) => stop(`Stop ${index}`, 46 + index * 0.2, 9 + index * 0.2));
|
||||
const geometry = Array.from({ length: 800 }, (_, index) => [46 + index * 0.0015, 9 + index * 0.0015]);
|
||||
const days = Array.from({ length: 10 }, (_, index) =>
|
||||
day(index + 1, { stops: six, legs: six.slice(1).map(() => leg(20_000, 900)), geometry, driveWarnings: [] }),
|
||||
);
|
||||
const built = roadtripAnswerCard(input(answer(days))) as RoadtripCard;
|
||||
expect(JSON.stringify(built).length).toBeLessThanOrEqual(MAX_CARD_CHARS);
|
||||
expect(built.days.length + built.moreDays).toBe(10);
|
||||
expect(built.days.length).toBeGreaterThan(1);
|
||||
for (const kept of built.days) {
|
||||
expect(kept.lines.length).toBeGreaterThan(0);
|
||||
for (const line of kept.lines) expect(line.length).toBeGreaterThanOrEqual(2);
|
||||
}
|
||||
});
|
||||
|
||||
it('ASTRT-006: gives no card for a drive without a day, and the geometry is asked for without the model', () => {
|
||||
expect(roadtripAnswerCard(input(answer([])))).toBeNull();
|
||||
expect(roadtripAnswerCard(input('Trip not found'))).toBeNull();
|
||||
expect(ASSISTANT_ARG_POLICY.calculate_roadtrip).toEqual({ forced: { includeGeometry: true } });
|
||||
});
|
||||
|
||||
it('ASTRT-009: the model never sees the geometry switch, the call always sets it, the answer drops it', async () => {
|
||||
const callTool = vi.fn(async () => ({ content: [{ type: 'text', text: JSON.stringify(answer([day(3)])) }] }));
|
||||
const tool = {
|
||||
name: 'calculate_roadtrip',
|
||||
description: '',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: { tripId: { type: 'number' }, includeGeometry: { type: 'boolean' }, dayId: { type: 'number' } },
|
||||
required: ['tripId', 'includeGeometry'],
|
||||
},
|
||||
kind: 'read',
|
||||
pinned: true,
|
||||
hint: { destructive: false, creates: false, group: 'roadtrip' },
|
||||
};
|
||||
const tools = new Map([['calculate_roadtrip', tool]]);
|
||||
const audit = () => undefined;
|
||||
const session = new AssistantToolSession({ callTool } as never, {} as never, tools as never, 1, audit, 'undo');
|
||||
const [spec] = session.specs();
|
||||
expect(Object.keys(spec.parameters.properties as object)).toEqual(['dayId']);
|
||||
expect(spec.parameters.required).toBeUndefined();
|
||||
const run = await session.call('calculate_roadtrip', { includeGeometry: false, dayId: 3 });
|
||||
expect(callTool).toHaveBeenCalledWith({
|
||||
name: 'calculate_roadtrip',
|
||||
arguments: { includeGeometry: true, dayId: 3, tripId: 1 },
|
||||
});
|
||||
expect(JSON.stringify(run.value)).toContain('geometry');
|
||||
expect(JSON.stringify(redactForProvider(run.value))).not.toContain('geometry');
|
||||
});
|
||||
|
||||
it('ASTRT-007: carries no web address and ends a day at a stop without a position', () => {
|
||||
const stops = [stop('Munich', 48.1, 11.5), stop('Nowhere', Number.NaN, 11), stop('Ulm', 48.4, 10)];
|
||||
const broken = day(3, { stops });
|
||||
const built = roadtripAnswerCard(input(answer([broken]))) as RoadtripCard;
|
||||
expect(built.days[0].stops.map((s) => s.name)).toEqual(['Munich']);
|
||||
expect(built.days[0].moreStops).toBe(2);
|
||||
expect(built.days[0].legs).toEqual([]);
|
||||
expect(JSON.stringify(built)).not.toMatch(/https?:|url/i);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,309 @@
|
||||
/**
|
||||
* The road trip's read cards: corridor hits in driving order with the stops
|
||||
* they lie between, a charger as checked (never its source's address), the
|
||||
* connections of a transit search with each clock local to its stop, the
|
||||
* journey a held create_transit_journey adds, and the stops a Google Maps
|
||||
* link names once the user let the read fetch it.
|
||||
*/
|
||||
import { buildTripCard } from '../../../../../../src/nest/assistant/assistant-context';
|
||||
import type { PreviewContext } from '../../../../../../src/nest/assistant/cards/card-types';
|
||||
import { answerCardOf, appliedCardOf, changeCardOf } from '../../../../../../src/nest/assistant/cards/registry';
|
||||
import {
|
||||
chargingAnswerCard,
|
||||
corridorAnswerCard,
|
||||
googleRouteCard,
|
||||
itineraryOf,
|
||||
transitAnswerCard,
|
||||
} from '../../../../../../src/nest/assistant/cards/roadtrip/roadtrip-reads';
|
||||
import {
|
||||
MAX_CARD_CHARS,
|
||||
type ChargingCard,
|
||||
type CorridorCard,
|
||||
type DayRouteCard,
|
||||
type TransitCard,
|
||||
} from '@trek/shared';
|
||||
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const logMock = vi.hoisted(() => ({ logInfo: vi.fn(), logError: vi.fn(), logWarn: vi.fn(), logDebug: vi.fn() }));
|
||||
vi.mock('../../../../../../src/nest/audit/audit-log.logger', () => logMock);
|
||||
|
||||
const card = buildTripCard(
|
||||
1,
|
||||
7,
|
||||
{ trip: { title: 'Alps' }, days: [{ id: 31, day_number: 2, assignments: [] }] },
|
||||
{ places: [{ id: 5, name: 'Ionity Holzkirchen', lat: 47.88, lng: 11.7 }] },
|
||||
null,
|
||||
);
|
||||
const ctx: PreviewContext = { card, categories: new Map(), locale: 'en', today: '2026-10-01', airport: () => null };
|
||||
const input = (args: Record<string, unknown>, value: unknown) => ({
|
||||
toolCallId: 'call_7',
|
||||
args,
|
||||
value,
|
||||
card,
|
||||
today: '2026-10-01',
|
||||
});
|
||||
|
||||
const poi = (name: string, lat: number, lng: number, extra: Record<string, unknown> = {}) => ({
|
||||
osm_id: `node/${name}`,
|
||||
name,
|
||||
lat,
|
||||
lng,
|
||||
category: 'charging',
|
||||
poi_type: 'charging_station',
|
||||
source: 'osm',
|
||||
...extra,
|
||||
});
|
||||
|
||||
describe('corridor card', () => {
|
||||
const value = {
|
||||
dayNumber: 2,
|
||||
complete: false,
|
||||
totalAreas: 9,
|
||||
nextOffset: 6,
|
||||
hits: [
|
||||
{
|
||||
poi: poi('Ionity', 47.88, 11.7, {
|
||||
brand: 'Ionity',
|
||||
charging: {
|
||||
sockets: [
|
||||
{ type: 'type2', kw: 22, count: 2 },
|
||||
{ type: 'ccs', kw: 350, count: 6 },
|
||||
{ type: '', kw: 50, count: 1 },
|
||||
],
|
||||
},
|
||||
}),
|
||||
alongKm: 31.44,
|
||||
distanceKm: 0.4234,
|
||||
between: ['Munich', 'Verona'],
|
||||
},
|
||||
{ poi: poi('', 47.5, 11.3), alongKm: 80.06, distanceKm: 1.2, between: null },
|
||||
{ poi: poi('Broken', Number.NaN, 11), alongKm: 90, distanceKm: 0.1, between: null },
|
||||
],
|
||||
};
|
||||
|
||||
it('ASTRT-010: lists the hits in driving order with their refs, distances, stops and strongest sockets', () => {
|
||||
const built = corridorAnswerCard(input({ dayNumber: 2, category: 'charging', widthKm: 3, offset: 0 }, value));
|
||||
expect(built).toMatchObject({
|
||||
kind: 'corridor',
|
||||
dayId: 31,
|
||||
dayNumber: 2,
|
||||
category: 'charging',
|
||||
widthKm: 3,
|
||||
more: 0,
|
||||
searched: { done: 6, total: 9 },
|
||||
partial: true,
|
||||
});
|
||||
const hits = (built as CorridorCard).hits;
|
||||
expect(hits.map((hit) => hit.ref)).toEqual(['call_7:0', 'call_7:1']);
|
||||
expect(hits[0]).toMatchObject({ name: 'Ionity', brand: 'Ionity', alongKm: 31.4, offKm: 0.42 });
|
||||
expect(hits[0].between).toEqual(['Munich', 'Verona']);
|
||||
expect(hits[0].sockets).toEqual([
|
||||
{ type: 'ccs', kw: 350, count: 6 },
|
||||
{ type: 'type2', kw: 22, count: 2 },
|
||||
]);
|
||||
expect(hits[1]).toMatchObject({ name: null, between: null, sockets: [] });
|
||||
});
|
||||
|
||||
it('ASTRT-011: a search with nothing found still draws, one with an unknown category does not', () => {
|
||||
const none = corridorAnswerCard(input({ dayNumber: 2, category: 'fuel' }, { ...value, hits: [], complete: true }));
|
||||
expect(none).toMatchObject({ hits: [], partial: false, widthKm: 5 });
|
||||
expect(corridorAnswerCard(input({ dayNumber: 2, category: 'museum' }, value))).toBeNull();
|
||||
const checked = answerCardOf('search_roadtrip_corridor', input({ dayNumber: 2, category: 'charging' }, value));
|
||||
expect(checked).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('charging card', () => {
|
||||
const info = {
|
||||
checkedAt: '2026-10-01T09:38:12.345Z',
|
||||
status: 'ok',
|
||||
station: 'Ionity Holzkirchen Nord',
|
||||
source: 'MobiData BW',
|
||||
sourceUrl: 'https://example.org/feed',
|
||||
license: 'CC BY 4.0',
|
||||
updatedAt: '2026-10-01T09:30:00+02:00',
|
||||
stale: false,
|
||||
available: 4,
|
||||
total: 6,
|
||||
unknown: 0,
|
||||
tariffs: [
|
||||
{
|
||||
currency: 'EUR',
|
||||
updatedAt: '2026-09-01T00:00:00Z',
|
||||
components: [
|
||||
{ kind: 'ENERGY', price: 0.69, taxIncluded: true, conditional: false, afterSeconds: null },
|
||||
{ kind: 'ENERGY', price: 0.59, taxIncluded: true, conditional: false, afterSeconds: null },
|
||||
{ kind: 'TIME', price: 0.1, taxIncluded: true, conditional: false, afterSeconds: 3600 },
|
||||
],
|
||||
},
|
||||
],
|
||||
pricesUnavailable: false,
|
||||
};
|
||||
|
||||
it('ASTRT-012: a stop of the trip as checked, with the cheapest energy price and its source but no address', () => {
|
||||
const built = chargingAnswerCard(input({ placeId: 5 }, info)) as ChargingCard;
|
||||
expect(built).toMatchObject({
|
||||
kind: 'charging',
|
||||
placeId: 5,
|
||||
name: 'Ionity Holzkirchen',
|
||||
station: 'Ionity Holzkirchen Nord',
|
||||
lat: 47.88,
|
||||
lng: 11.7,
|
||||
available: 4,
|
||||
total: 6,
|
||||
checkedAt: '2026-10-01T09:38:12Z',
|
||||
updatedAt: '2026-10-01T07:30:00Z',
|
||||
energy: { amount: 0.59, currency: 'EUR' },
|
||||
otherPrices: 2,
|
||||
source: 'MobiData BW',
|
||||
license: 'CC BY 4.0',
|
||||
});
|
||||
expect(JSON.stringify(built)).not.toContain('example.org');
|
||||
});
|
||||
|
||||
it('ASTRT-013: a charger found by its position, prices in two currencies, and an answer that is no charger', () => {
|
||||
const twoCurrencies = {
|
||||
...info,
|
||||
stale: true,
|
||||
tariffs: [...info.tariffs, { ...info.tariffs[0], currency: 'CHF' }],
|
||||
};
|
||||
const built = chargingAnswerCard(input({ lat: 47.1, lng: 9.5, name: 'Supercharger Chur' }, twoCurrencies));
|
||||
expect(built).toMatchObject({ placeId: null, name: 'Supercharger Chur', lat: 47.1, energy: null, stale: true });
|
||||
expect(chargingAnswerCard(input({ placeId: 5 }, 'No reliable data'))).toBeNull();
|
||||
const found = answerCardOf('lookup_roadtrip_charging_info', input({ lat: 47.1, lng: 9.5, name: '' }, info));
|
||||
expect(found).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
const transitLeg = (from: string, fromTime: string, to: string, toTime: string) => ({
|
||||
mode: 'RAIL',
|
||||
from: { name: from, lat: 48.14, lng: 11.56, time: fromTime, scheduledTime: fromTime, track: '12' },
|
||||
to: { name: to, lat: 47.86, lng: 12.12, time: toTime, scheduledTime: toTime, track: null },
|
||||
duration: 2220,
|
||||
distance: null,
|
||||
headsign: 'Salzburg',
|
||||
line: 'RE 4',
|
||||
lineColor: '#f00',
|
||||
lineTextColor: 'white',
|
||||
agency: 'DB',
|
||||
intermediateStops: 3,
|
||||
geometry: 'abc',
|
||||
geometryPrecision: 5,
|
||||
});
|
||||
|
||||
describe('transit cards', () => {
|
||||
it('ASTRT-014: reads every clock in the zone of its stop, whatever offset the provider wrote', () => {
|
||||
const itinerary = itineraryOf({
|
||||
startTime: '2026-10-01T06:04:00Z',
|
||||
endTime: '2026-10-01T08:41:00+02:00',
|
||||
duration: 2220,
|
||||
transfers: 0,
|
||||
walkSeconds: 0,
|
||||
legs: [transitLeg('Munich Hbf', '2026-10-01T06:04:00Z', 'Rosenheim', '2026-10-01T06:41:00Z')],
|
||||
});
|
||||
expect(itinerary).toMatchObject({ date: '2026-10-01', start: '08:04', end: '08:41', endDayOffset: 0 });
|
||||
expect(itinerary?.legs[0]).toMatchObject({
|
||||
from: { name: 'Munich Hbf', time: '08:04', track: '12' },
|
||||
to: { name: 'Rosenheim', time: '08:41', track: null },
|
||||
line: 'RE 4',
|
||||
lineColor: '#ff0000',
|
||||
lineTextColor: null,
|
||||
stops: 3,
|
||||
});
|
||||
});
|
||||
|
||||
it('ASTRT-015: a night connection lands a day later, and one in New York keeps its own clock', () => {
|
||||
const night = itineraryOf({
|
||||
startTime: '2026-10-01T21:30:00Z',
|
||||
endTime: '2026-10-02T05:10:00Z',
|
||||
legs: [transitLeg('Munich Hbf', '2026-10-01T21:30:00Z', 'Rosenheim', '2026-10-02T05:10:00Z')],
|
||||
});
|
||||
expect(night).toMatchObject({ date: '2026-10-01', start: '23:30', end: '07:10', endDayOffset: 1 });
|
||||
const newYork = transitLeg('Penn Station', '2026-10-01T09:00:00-04:00', 'Newark', '2026-10-01T09:30:00-04:00');
|
||||
const east = itineraryOf({
|
||||
startTime: '2026-10-01T13:00:00Z',
|
||||
endTime: '2026-10-01T13:30:00Z',
|
||||
legs: [
|
||||
{
|
||||
...newYork,
|
||||
from: { ...newYork.from, lat: 40.75, lng: -73.99 },
|
||||
to: { ...newYork.to, lat: 40.73, lng: -74.17 },
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(east).toMatchObject({ start: '09:00', end: '09:30' });
|
||||
expect(itineraryOf({ startTime: 'soon', endTime: 'later', legs: [] })).toBeNull();
|
||||
});
|
||||
|
||||
it('ASTRT-016: a search lists four connections and counts the rest; the held journey shows its one', () => {
|
||||
const itinerary = {
|
||||
startTime: '2026-10-01T06:04:00Z',
|
||||
endTime: '2026-10-01T06:41:00Z',
|
||||
duration: 2220,
|
||||
transfers: 0,
|
||||
walkSeconds: 0,
|
||||
legs: [transitLeg('Munich Hbf', '2026-10-01T06:04:00Z', 'Rosenheim', '2026-10-01T06:41:00Z')],
|
||||
};
|
||||
const args = {
|
||||
from: { name: 'Munich', lat: 48.14, lng: 11.56 },
|
||||
to: { name: 'Rosenheim', lat: 47.86, lng: 12.12 },
|
||||
};
|
||||
const value = { itineraries: Array.from({ length: 6 }, () => itinerary), dropped: 1 };
|
||||
const search = transitAnswerCard(input(args, value)) as TransitCard;
|
||||
expect(search).toMatchObject({ from: 'Munich', to: 'Rosenheim', dayId: null, more: 2, dropped: 1 });
|
||||
expect(search.itineraries).toHaveLength(4);
|
||||
expect(answerCardOf('search_transit_routes', input(args, value))).not.toBeNull();
|
||||
expect(transitAnswerCard(input(args, { itineraries: [], dropped: 3 }))).toBeNull();
|
||||
const held = changeCardOf('create_transit_journey', ctx, { ...args, dayId: 31, itinerary }, null) as TransitCard;
|
||||
expect(held).toMatchObject({ kind: 'transit', dayId: 31, more: 0, dropped: 0 });
|
||||
expect(held.itineraries).toHaveLength(1);
|
||||
expect(JSON.stringify(held)).not.toContain('geometry');
|
||||
});
|
||||
|
||||
it('ASTRT-018: long connections give way one by one until the card fits, the ones left out counted', () => {
|
||||
const long = (name: string) => `${name} ${'Hauptbahnhof Gleis Nord '.repeat(6)}`;
|
||||
const leg = {
|
||||
...transitLeg(long('Munich'), '2026-10-01T06:04:00Z', long('Rosenheim'), '2026-10-01T06:41:00Z'),
|
||||
headsign: long('Salzburg'),
|
||||
agency: long('Bayerische Regiobahn'),
|
||||
line: 'RE 4 Express Nord',
|
||||
};
|
||||
const itinerary = {
|
||||
startTime: '2026-10-01T06:04:00Z',
|
||||
endTime: '2026-10-01T06:41:00Z',
|
||||
legs: Array.from({ length: 12 }, () => leg),
|
||||
};
|
||||
const args = { from: { name: 'Munich' }, to: { name: 'Rosenheim' } };
|
||||
const built = transitAnswerCard(input(args, { itineraries: Array.from({ length: 5 }, () => itinerary) }));
|
||||
expect(built).not.toBeNull();
|
||||
const card = built as TransitCard;
|
||||
expect(JSON.stringify(card).length).toBeLessThanOrEqual(MAX_CARD_CHARS);
|
||||
expect(card.itineraries.length).toBeLessThan(4);
|
||||
expect(card.itineraries.length).toBeGreaterThan(0);
|
||||
expect(card.more).toBe(5 - card.itineraries.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Google Maps route card', () => {
|
||||
it('ASTRT-017: the stops the link names once read, the ones without a position counted apart', () => {
|
||||
const result = {
|
||||
stops: [
|
||||
{ name: 'Munich', lat: 48.137, lng: 11.575 },
|
||||
{ name: 'My location', lat: null, lng: null },
|
||||
{ name: 'Garmisch', lat: 47.49, lng: 11.09 },
|
||||
],
|
||||
};
|
||||
const built = googleRouteCard(result) as DayRouteCard;
|
||||
expect(built.stops.map((stop) => [stop.name, stop.added])).toEqual([
|
||||
['Munich', true],
|
||||
['Garmisch', true],
|
||||
]);
|
||||
expect(built.unresolved).toEqual(['My location']);
|
||||
expect(appliedCardOf('preview_google_maps_route', { args: {}, result, preview: null })).toMatchObject({
|
||||
kind: 'dayRoute',
|
||||
dayId: null,
|
||||
});
|
||||
expect(googleRouteCard({ stops: [] })).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* An applied create_transit_journey gets back the itinerary its search found:
|
||||
* the model never sees a connection's line, yet the tool needs it on every
|
||||
* leg. The searches' itineraries are kept per user and trip across turns, the
|
||||
* held call keeps the model's copy (so the thread never stores a line), and
|
||||
* the matching itinerary goes in when the change is applied. One no longer
|
||||
* kept is searched for again.
|
||||
*/
|
||||
import { AssistantToolSession } from '../../../../../../src/nest/assistant/assistant-tools.service';
|
||||
import {
|
||||
ItineraryShelves,
|
||||
itineraryKey,
|
||||
KeptItineraries,
|
||||
restoreItinerary,
|
||||
searchAgainArgs,
|
||||
} from '../../../../../../src/nest/assistant/cards/roadtrip/transit-restore';
|
||||
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const leg = (line: string | null, geometry: string | null) => ({
|
||||
mode: line ? 'RAIL' : 'WALK',
|
||||
line,
|
||||
geometry,
|
||||
geometryPrecision: 5,
|
||||
});
|
||||
const raw = (start: string, lines: (string | null)[]) => ({
|
||||
startTime: start,
|
||||
endTime: '2026-10-01T08:41:00+02:00',
|
||||
legs: lines.map((line) => leg(line, `poly-${line ?? 'walk'}`)),
|
||||
});
|
||||
/** The itinerary as the model passes it on: the same, without the line on the map. */
|
||||
const told = (start: string, lines: (string | null)[], end = '2026-10-01T08:41:00+02:00') => ({
|
||||
startTime: start,
|
||||
endTime: end,
|
||||
legs: lines.map((line) => ({ mode: line ? 'RAIL' : 'WALK', line })),
|
||||
});
|
||||
const from = { lat: 48.14, lng: 11.56, name: 'München Hbf' };
|
||||
const to = { lat: 48.37, lng: 10.89, name: 'Augsburg Hbf' };
|
||||
|
||||
type CallTool = (request: { name: string; arguments: Record<string, unknown> }) => Promise<unknown>;
|
||||
|
||||
const BOTH = ['search_transit_routes', 'create_transit_journey'];
|
||||
|
||||
/** A session over a client that answers every search with `found` and every other call with `{ ok: true }`. */
|
||||
function sessionWith(found: unknown, kept: KeptItineraries, names = BOTH) {
|
||||
const callTool = vi.fn<CallTool>(async ({ name }) => ({
|
||||
content: [{ type: 'text', text: JSON.stringify(name === 'search_transit_routes' ? found : { ok: true }) }],
|
||||
}));
|
||||
const tool = (name: string) => ({
|
||||
name,
|
||||
description: '',
|
||||
inputSchema: { type: 'object', properties: {} },
|
||||
kind: name.startsWith('search') ? 'read' : 'write',
|
||||
pinned: false,
|
||||
hint: { destructive: false, creates: false, group: 'roadtrip' },
|
||||
});
|
||||
const tools = new Map(names.map((name) => [name, tool(name)]));
|
||||
const client = { callTool };
|
||||
const audit = () => undefined;
|
||||
const session = new AssistantToolSession(client as never, {} as never, tools as never, 1, audit, 'turn', kept);
|
||||
return { session, callTool };
|
||||
}
|
||||
|
||||
describe('transit itinerary restore', () => {
|
||||
it('ASTRT-040: tells connections apart by their instants and the lines of their legs', () => {
|
||||
const at = Date.parse('2026-10-01T06:04:00Z');
|
||||
const until = Date.parse('2026-10-01T06:41:00Z');
|
||||
expect(itineraryKey(raw('2026-10-01T08:04:00+02:00', [null, 'RE 4']))).toBe(`${at}|${until}|2|,RE 4`);
|
||||
expect(itineraryKey(told('2026-10-01T06:04:00Z', [null, 'RE 4'], '2026-10-01T06:41:00.000Z'))).toBe(
|
||||
itineraryKey(raw('2026-10-01T08:04:00+02:00', [null, 'RE 4'])),
|
||||
);
|
||||
expect(itineraryKey({ startTime: 'x' })).toBeNull();
|
||||
expect(itineraryKey({ startTime: 'not a time', endTime: 'nor this', legs: [] })).toBeNull();
|
||||
});
|
||||
|
||||
it('ASTRT-041: puts the search answer in place of the model copy, and leaves an unknown one alone', () => {
|
||||
const kept = new KeptItineraries();
|
||||
kept.keep({ itineraries: [raw('2026-10-01T08:04:00+02:00', ['RE 4']), 'broken'], dropped: 0 });
|
||||
kept.keep('Too many transit requests.');
|
||||
const args = { dayId: 3, itinerary: told('2026-10-01T06:04:00Z', ['RE 4']) };
|
||||
expect(restoreItinerary(kept, args)).toEqual({ dayId: 3, itinerary: raw('2026-10-01T08:04:00+02:00', ['RE 4']) });
|
||||
const other = { dayId: 3, itinerary: told('2026-10-01T09:04:00+02:00', ['RE 4']) };
|
||||
expect(restoreItinerary(kept, other)).toBe(other);
|
||||
});
|
||||
|
||||
it('ASTRT-042: a search in one turn restores the journey applied in the next, held without a line', async () => {
|
||||
const shelves = new ItineraryShelves();
|
||||
const found = { itineraries: [raw('2026-10-01T08:04:00+02:00', ['RE 4'])], dropped: 0 };
|
||||
const first = sessionWith(found, shelves.of(7, 1));
|
||||
await first.session.call('search_transit_routes', { from, to });
|
||||
|
||||
const held = { dayId: 3, from, to, itinerary: told('2026-10-01T08:04:00+02:00', ['RE 4']) };
|
||||
const next = sessionWith(found, shelves.of(7, 1));
|
||||
expect(next.session.pinArgs('create_transit_journey', held)).toEqual({ args: held });
|
||||
expect(JSON.stringify(next.session.pinArgs('create_transit_journey', held))).not.toMatch(/geometry/);
|
||||
await next.session.call('create_transit_journey', held);
|
||||
expect(next.callTool).toHaveBeenCalledTimes(1);
|
||||
expect(next.callTool.mock.calls[0][0]).toEqual({
|
||||
name: 'create_transit_journey',
|
||||
arguments: { ...held, itinerary: raw('2026-10-01T08:04:00+02:00', ['RE 4']) },
|
||||
});
|
||||
});
|
||||
|
||||
it('ASTRT-043: a connection no longer kept is searched for again from its own departure', async () => {
|
||||
const found = { itineraries: [raw('2026-10-01T08:04:00+02:00', ['RE 4'])], dropped: 0 };
|
||||
const { session, callTool } = sessionWith(found, new KeptItineraries());
|
||||
const held = { dayId: 3, from, to, itinerary: told('2026-10-01T08:04:00+02:00', ['RE 4']) };
|
||||
await session.call('create_transit_journey', held);
|
||||
expect(callTool.mock.calls.map(([request]) => request.name)).toEqual([
|
||||
'search_transit_routes',
|
||||
'create_transit_journey',
|
||||
]);
|
||||
expect(callTool.mock.calls[0][0].arguments).toEqual({ from, to, time: '2026-10-01T08:04:00+02:00' });
|
||||
expect(callTool.mock.calls[1][0].arguments.itinerary).toEqual(raw('2026-10-01T08:04:00+02:00', ['RE 4']));
|
||||
|
||||
const without = sessionWith(found, new KeptItineraries(), ['create_transit_journey']);
|
||||
await without.session.call('create_transit_journey', held);
|
||||
expect(without.callTool.mock.calls.map(([request]) => request.arguments)).toEqual([held]);
|
||||
expect(searchAgainArgs({ itinerary: told('soon', []), from, to })).toBeNull();
|
||||
expect(searchAgainArgs({ itinerary: told('2026-10-01T08:04:00+02:00', []), from })).toBeNull();
|
||||
});
|
||||
|
||||
it('ASTRT-044: keeps itineraries per user and trip, for six hours, the newest fifty of them', () => {
|
||||
let now = 0;
|
||||
const shelves = new ItineraryShelves(() => now);
|
||||
const one = raw('2026-10-01T08:04:00+02:00', ['RE 4']);
|
||||
const key = itineraryKey(one) as string;
|
||||
shelves.of(7, 1).keep({ itineraries: [one] });
|
||||
expect(shelves.of(7, 1).find(key)).toEqual(one);
|
||||
expect(shelves.of(7, 2).find(key)).toBeUndefined();
|
||||
expect(shelves.of(8, 1).find(key)).toBeUndefined();
|
||||
now = 6 * 60 * 60 * 1000 + 1;
|
||||
expect(shelves.of(7, 1).find(key)).toBeUndefined();
|
||||
|
||||
const kept = new KeptItineraries(() => now);
|
||||
const many = Array.from({ length: 51 }, (_, index) =>
|
||||
raw(`2026-10-01T08:${String(index).padStart(2, '0')}:00+02:00`, ['RE 4']),
|
||||
);
|
||||
kept.keep({ itineraries: many });
|
||||
expect(kept.find(itineraryKey(many[0]) as string)).toBeUndefined();
|
||||
expect(kept.find(itineraryKey(many[50]) as string)).toEqual(many[50]);
|
||||
});
|
||||
});
|
||||
@@ -18,7 +18,7 @@ async function setup() {
|
||||
const places = { create: vi.fn((_trip: string, stop: { name: string }) => ({ id: stop.name })), broadcast: vi.fn() };
|
||||
const assignments = {
|
||||
dayExists: vi.fn(() => true),
|
||||
createAssignment: vi.fn((dayId: number, placeId: string) => ({ dayId, placeId })),
|
||||
createAssignment: vi.fn((dayId: number, placeId: string) => ({ id: `a-${placeId}`, dayId, placeId })),
|
||||
broadcast: vi.fn(),
|
||||
reconcile: vi.fn(),
|
||||
};
|
||||
@@ -126,7 +126,11 @@ describe('Google route import', () => {
|
||||
|
||||
it('appends stops in order with car transport and broadcasts after saving', async () => {
|
||||
const { service, places, assignments, permissions } = await setup();
|
||||
expect(await service.import(1, 7, input)).toEqual({ imported: 2 });
|
||||
expect(await service.import(1, 7, input)).toEqual({
|
||||
imported: 2,
|
||||
place_ids: ['Munich', 'Rome'],
|
||||
assignment_ids: ['a-Munich', 'a-Rome'],
|
||||
});
|
||||
expect(places.create.mock.calls.map((call) => call[1].name)).toEqual(['Munich', 'Rome']);
|
||||
expect(places.create).toHaveBeenCalledWith(
|
||||
'1',
|
||||
@@ -152,7 +156,7 @@ describe('Google route import', () => {
|
||||
return { id: stop.name };
|
||||
});
|
||||
assignments.createAssignment
|
||||
.mockImplementationOnce(() => ({ dayId: 3, placeId: 'Munich' }))
|
||||
.mockImplementationOnce(() => ({ id: 'a-Munich', dayId: 3, placeId: 'Munich' }))
|
||||
.mockImplementationOnce(() => {
|
||||
throw new Error('write failed');
|
||||
});
|
||||
|
||||
@@ -716,6 +716,50 @@ describe('corridor filtering', () => {
|
||||
expect((await read({ toKm: 0 })).hits).toHaveLength(0);
|
||||
expect((await read({})).failedSources).toEqual(['plugin']);
|
||||
});
|
||||
it('RTMCP-001: names the two stops of the day each hit lies between, and none on a day of one stop', async () => {
|
||||
const s = tool();
|
||||
s.plan.calculated.days[0].stops = [
|
||||
{ name: 'Augsburg', lat: 48, lng: 10 },
|
||||
{ name: 'Ulm', lat: 48, lng: 10.06 },
|
||||
{ name: 'Stuttgart', lat: 48, lng: 10.1 },
|
||||
] as never;
|
||||
const read = async () => JSON.parse((await s.mcp.corridor(input, ctx)).content[0].text as string);
|
||||
const between = (body: { hits: { poi: { name: string }; between: unknown }[] }) =>
|
||||
Object.fromEntries(body.hits.map((hit) => [hit.poi.name, hit.between]));
|
||||
expect(between(await read())).toEqual({
|
||||
Fast: ['Augsburg', 'Ulm'],
|
||||
Unknown: ['Augsburg', 'Ulm'],
|
||||
Slow: ['Ulm', 'Stuttgart'],
|
||||
});
|
||||
s.plan.calculated.days[0].stops = [{ name: 'Augsburg', lat: 48, lng: 10 }] as never;
|
||||
expect(Object.values(between(await read()))).toEqual([null, null, null]);
|
||||
});
|
||||
it('RTMCP-002: places each stop after the previous one, so a day crossing itself names the right pair', async () => {
|
||||
const s = tool();
|
||||
// East, north, then south across the first stretch at (48, 10.05) and on below it.
|
||||
s.plan.calculated.days[0].geometry = [
|
||||
[48, 10],
|
||||
[48, 10.1],
|
||||
[48.05, 10.1],
|
||||
[48.05, 10.05],
|
||||
[47.95, 10.05],
|
||||
];
|
||||
s.plan.calculated.days[0].stops = [
|
||||
{ name: 'Start', lat: 48, lng: 10 },
|
||||
{ name: 'Corner', lat: 48.05, lng: 10.1 },
|
||||
{ name: 'Crossing', lat: 48, lng: 10.05 },
|
||||
{ name: 'End', lat: 47.95, lng: 10.05 },
|
||||
] as never;
|
||||
s.maps.search.mockResolvedValue({
|
||||
pois: [{ osm_id: 'x', name: 'Before the crossing', lat: 48.03, lng: 10.05, category: 'charging' }],
|
||||
sources: ['osm'],
|
||||
failedSources: [],
|
||||
truncated: false,
|
||||
clamped: false,
|
||||
} as never);
|
||||
const body = JSON.parse((await s.mcp.corridor(input, ctx)).content[0].text as string);
|
||||
expect(body.hits.map((hit: { between: unknown }) => hit.between)).toEqual([['Corner', 'Crossing']]);
|
||||
});
|
||||
it('leaves the ride between two terminals out of the search and drops a hit under the flight path (#2428)', async () => {
|
||||
// The day drives to the airport, flies two degrees north and east, and drives on
|
||||
// from the far one: the geometry jumps straight between the terminals, and the
|
||||
|
||||
@@ -1,8 +1,33 @@
|
||||
import { idSchema } from '../../common/primitives.schema';
|
||||
import { cardInstantSchema, cardLatSchema, cardLngSchema, cardMoneySchema, cardText } from './card-parts';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* Charging stops for an electric car along a drive. Only its kind so far; the road trip cards give it
|
||||
* its fields.
|
||||
* A charger as one look at it found it: how many points were free when it
|
||||
* was checked, the cheapest published price per kWh, and where the figures
|
||||
* come from. A snapshot with its time, never refreshed in the chat, and
|
||||
* never the source's address: the attribution is its name and licence.
|
||||
*/
|
||||
export const chargingCardSchema = z.object({ kind: z.literal('charging') });
|
||||
export const chargingCardSchema = z.object({
|
||||
kind: z.literal('charging'),
|
||||
// The stop of the trip it is, or null for a charger found by its position.
|
||||
placeId: idSchema.nullable(),
|
||||
name: cardText(80).nullable(),
|
||||
station: cardText(120).nullable(),
|
||||
lat: cardLatSchema.nullable(),
|
||||
lng: cardLngSchema.nullable(),
|
||||
status: z.enum(['ok', 'unknown', 'ambiguous', 'unavailable']),
|
||||
stale: z.boolean(),
|
||||
available: z.number().int().min(0).max(999).nullable(),
|
||||
total: z.number().int().min(0).max(999),
|
||||
checkedAt: cardInstantSchema.nullable(),
|
||||
updatedAt: cardInstantSchema.nullable(),
|
||||
// The cheapest unconditional energy price with tax, per kWh; null when the prices are in several currencies.
|
||||
energy: cardMoneySchema.nullable(),
|
||||
// The other price components the tariffs name besides that one.
|
||||
otherPrices: z.number().int().min(0).max(99),
|
||||
source: cardText(80).nullable(),
|
||||
license: cardText(120).nullable(),
|
||||
});
|
||||
export type ChargingCard = z.infer<typeof chargingCardSchema>;
|
||||
|
||||
@@ -1,8 +1,55 @@
|
||||
import { idSchema } from '../../common/primitives.schema';
|
||||
import { roadtripCorridorRequestSchema } from '../../roadtrip/planning.schema';
|
||||
import { MAX_TRIP_DAYS } from '../../trip/trip.schema';
|
||||
import { cardLatSchema, cardLngSchema, cardText } from './card-parts';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* What lies along a drive, within reach of its route. Only its kind so far; the road trip cards give
|
||||
* it its fields.
|
||||
* What search_roadtrip_corridor found along one day's drive, in the order
|
||||
* the drive passes it: how far into the drive and how far off the road each
|
||||
* hit lies, between which stops, and for a charger its sockets. A search
|
||||
* that is not done yet says how much of the road it has searched.
|
||||
*/
|
||||
export const corridorCardSchema = z.object({ kind: z.literal('corridor') });
|
||||
|
||||
/** The hits a card lists; the rest are counted in `more`. */
|
||||
export const CORRIDOR_CARD_HITS_MAX = 12;
|
||||
|
||||
export const corridorCardSchema = z.object({
|
||||
kind: z.literal('corridor'),
|
||||
dayId: idSchema.nullable(),
|
||||
dayNumber: z.number().int().min(1).max(MAX_TRIP_DAYS),
|
||||
category: roadtripCorridorRequestSchema.shape.category,
|
||||
widthKm: z.number().positive().max(10),
|
||||
hits: z
|
||||
.array(
|
||||
z.object({
|
||||
// `<toolCallId>:<index>`, the way a found place is named.
|
||||
ref: z.string().min(1).max(80),
|
||||
name: cardText(80).nullable(),
|
||||
brand: cardText(40).nullable(),
|
||||
lat: cardLatSchema,
|
||||
lng: cardLngSchema,
|
||||
alongKm: z.number().min(0).max(40_000),
|
||||
offKm: z.number().min(0).max(10),
|
||||
// The names of the stops the hit lies between, in driving order.
|
||||
between: z.tuple([cardText(80), cardText(80)]).nullable(),
|
||||
sockets: z
|
||||
.array(
|
||||
z.object({
|
||||
type: cardText(20),
|
||||
kw: z.number().min(0).max(2000).nullable(),
|
||||
count: z.number().int().min(0).max(99).nullable(),
|
||||
}),
|
||||
)
|
||||
.max(4),
|
||||
}),
|
||||
)
|
||||
.max(CORRIDOR_CARD_HITS_MAX),
|
||||
more: z.number().int().min(0).max(10_000),
|
||||
searched: z.object({ done: z.number().int().min(0).max(1000), total: z.number().int().min(0).max(1000) }),
|
||||
// Areas that failed, came back cut short, or are still to be searched.
|
||||
partial: z.boolean(),
|
||||
});
|
||||
export type CorridorCard = z.infer<typeof corridorCardSchema>;
|
||||
export type CorridorCardHit = CorridorCard['hits'][number];
|
||||
|
||||
@@ -1,5 +1,55 @@
|
||||
import { idSchema } from '../../common/primitives.schema';
|
||||
import { MAX_TRIP_DAYS } from '../../trip/trip.schema';
|
||||
import { cardLatSchema, cardLngSchema, cardPointSchema, cardText } from './card-parts';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/** One day's route between its places. Only its kind so far; the road trip cards give it its fields. */
|
||||
export const dayRouteCardSchema = z.object({ kind: z.literal('dayRoute') });
|
||||
/**
|
||||
* One day's route drawn straight from stop to stop, with the via points a
|
||||
* change sends the drive through: the card of every change that bends a
|
||||
* day's drive, and of a Google Maps route read or imported. Straight lines on
|
||||
* purpose: TREK routes the road once the change is applied.
|
||||
*/
|
||||
|
||||
/** The stops of a day a card draws. */
|
||||
export const DAY_ROUTE_CARD_STOPS_MAX = 40;
|
||||
/** The via points a card draws. */
|
||||
export const DAY_ROUTE_CARD_VIAS_MAX = 100;
|
||||
|
||||
export const dayRouteCardSchema = z.object({
|
||||
kind: z.literal('dayRoute'),
|
||||
dayId: idSchema.nullable(),
|
||||
dayNumber: z.number().int().min(1).max(MAX_TRIP_DAYS).nullable(),
|
||||
stops: z
|
||||
.array(
|
||||
z.object({
|
||||
placeId: idSchema.nullable(),
|
||||
name: cardText(80),
|
||||
lat: cardLatSchema,
|
||||
lng: cardLngSchema,
|
||||
// A stop the change adds to the day.
|
||||
added: z.boolean(),
|
||||
}),
|
||||
)
|
||||
.max(DAY_ROUTE_CARD_STOPS_MAX),
|
||||
vias: z
|
||||
.array(
|
||||
z.object({
|
||||
lat: cardLatSchema,
|
||||
lng: cardLngSchema,
|
||||
// The stop of the day the via follows, counting from 0.
|
||||
after: z.number().int().min(0).max(500),
|
||||
state: z.enum(['added', 'moved', 'removed', 'repinned']),
|
||||
// Where a moved via was before.
|
||||
from: cardPointSchema.nullable(),
|
||||
}),
|
||||
)
|
||||
.max(DAY_ROUTE_CARD_VIAS_MAX),
|
||||
// The stop every new via follows, and the imported track the chain was fitted to.
|
||||
afterName: cardText(80).nullable(),
|
||||
track: cardText(80).nullable(),
|
||||
// Stops of a read Google Maps route that have no position.
|
||||
unresolved: z.array(cardText(80)).max(10),
|
||||
});
|
||||
export type DayRouteCard = z.infer<typeof dayRouteCardSchema>;
|
||||
export type DayRouteCardVia = DayRouteCard['vias'][number];
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { idSchema } from '../../common/primitives.schema';
|
||||
import { MAX_TRIP_DAYS } from '../../trip/trip.schema';
|
||||
import { cardText } from './card-parts';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* The rules a road trip drives by, as a held change sets them: the driving
|
||||
* settings it changes, each from its old value to its new one, or where it
|
||||
* makes a day end (at a stop, part way along a drive, or back to the
|
||||
* automatic end). The client names each setting the way the planner's
|
||||
* settings name it, so a setting this build does not know reads by its key.
|
||||
*/
|
||||
|
||||
/** A setting's value as the planner stores it: a clock, a number, a switch, a choice; null when it is not set. */
|
||||
const settingValueSchema = z.union([z.string().max(40), z.number().min(0).max(100_000), z.boolean()]).nullable();
|
||||
|
||||
export const roadtripRulesCardSchema = z.object({
|
||||
kind: z.literal('roadtripRules'),
|
||||
settings: z
|
||||
.array(
|
||||
z.object({
|
||||
key: z.string().regex(/^roadtrip_[a-z0-9_]{1,40}$/),
|
||||
before: settingValueSchema,
|
||||
after: settingValueSchema,
|
||||
}),
|
||||
)
|
||||
.max(24),
|
||||
dayEnd: z
|
||||
.object({
|
||||
dayId: idSchema.nullable(),
|
||||
dayNumber: z.number().int().min(1).max(MAX_TRIP_DAYS),
|
||||
// At the stop `from`; `percent` along the drive from `from` to `to`; or the automatic end again.
|
||||
mode: z.enum(['stop', 'along', 'auto']),
|
||||
from: cardText(80).nullable(),
|
||||
to: cardText(80).nullable(),
|
||||
percent: z.number().int().min(0).max(100).nullable(),
|
||||
})
|
||||
.nullable(),
|
||||
});
|
||||
export type RoadtripRulesCard = z.infer<typeof roadtripRulesCardSchema>;
|
||||
export type RoadtripSettingChange = RoadtripRulesCard['settings'][number];
|
||||
@@ -1,8 +1,138 @@
|
||||
import { idSchema } from '../../common/primitives.schema';
|
||||
import { roadtripStopTypeSchema } from '../../place/place.schema';
|
||||
import { MAX_TRIP_DAYS } from '../../trip/trip.schema';
|
||||
import { cardClockSchema, cardDateSchema, cardLatSchema, cardLngSchema, cardPointSchema, cardText } from './card-parts';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* A road trip's drive with its days and stops. Only its kind so far; the road trip cards give it its
|
||||
* fields.
|
||||
* A road trip's drive as calculate_roadtrip worked it out: the totals, a
|
||||
* strip of its days and, for each day, the stops the planner's rail lists, in
|
||||
* the shape the rail reads them, so the chat draws the very rows the planner
|
||||
* draws. The server builds it from the tool's raw answer and fits it under
|
||||
* MAX_CARD_CHARS: a long trip keeps its first days and counts the rest
|
||||
* (`moreDays`), a long day its first stops (`moreStops`), and the lines of
|
||||
* the drive are thinned until the card fits.
|
||||
*/
|
||||
export const roadtripCardSchema = z.object({ kind: z.literal('roadtrip') });
|
||||
|
||||
/** The days a card holds in full; the rest are counted in `moreDays`. */
|
||||
export const ROADTRIP_CARD_DAYS_MAX = 14;
|
||||
/** The stops of one day a card holds; the rest are counted in `moreStops`. */
|
||||
export const ROADTRIP_CARD_STOPS_MAX = 16;
|
||||
/** The driven pieces of one day; a ride between two terminals splits a day's line. */
|
||||
export const ROADTRIP_CARD_DAY_LINES_MAX = 4;
|
||||
/** The points of one driven piece. */
|
||||
export const ROADTRIP_CARD_LINE_POINTS_MAX = 64;
|
||||
/** The points of every line of the card together. */
|
||||
export const ROADTRIP_CARD_POINTS_MAX = 400;
|
||||
|
||||
const metres = z.number().min(0).max(5e7);
|
||||
const seconds = z.number().min(0).max(1e7);
|
||||
const minutes = z.number().int().min(0).max(100_000);
|
||||
const dayNumber = z.number().int().min(1).max(MAX_TRIP_DAYS);
|
||||
|
||||
/** A driven piece of a day, `[lat, lng]` points at five decimals. */
|
||||
export const roadtripCardLineSchema = z.array(cardPointSchema).min(2).max(ROADTRIP_CARD_LINE_POINTS_MAX);
|
||||
|
||||
/** One stop of a day as the planner's rail reads it, with its schedule entry and what is wrong about it. */
|
||||
export const roadtripCardStopSchema = z.object({
|
||||
// Null for a ride's terminal or a hire car's desk, which are no places of the trip.
|
||||
placeId: idSchema.nullable(),
|
||||
// Null for a booked night at a day's edge and for a terminal: neither is an assignment.
|
||||
assignmentId: idSchema.nullable(),
|
||||
name: cardText(80),
|
||||
lat: cardLatSchema,
|
||||
lng: cardLngSchema,
|
||||
stopType: roadtripStopTypeSchema.nullable(),
|
||||
// A time pinned on the stop, and the time the drive leaves it at.
|
||||
time: cardClockSchema.nullable(),
|
||||
leaveAt: cardClockSchema.nullable(),
|
||||
dwellMinutes: z.number().int().min(0).max(10_080).nullable(),
|
||||
offRoadM: z.number().int().min(0).max(100_000).nullable(),
|
||||
// The stop's own fill figure; null follows the trip's setting.
|
||||
fillPercent: z.number().int().min(0).max(100).nullable(),
|
||||
// The booked night's stop on its check-in day.
|
||||
night: z.object({ checkIn: cardClockSchema.nullable() }).nullable(),
|
||||
// A marker the daily travel times put where a day ends or resumes.
|
||||
autoNight: z.object({ phase: z.enum(['start', 'end']), fromDayNumber: dayNumber }).nullable(),
|
||||
bookend: z
|
||||
.object({
|
||||
phase: z.enum(['morning', 'evening']),
|
||||
reservationId: idSchema.nullable(),
|
||||
checkingIn: z.boolean(),
|
||||
checkingOut: z.boolean(),
|
||||
checkIn: cardClockSchema.nullable(),
|
||||
checkOut: cardClockSchema.nullable(),
|
||||
})
|
||||
.nullable(),
|
||||
carrier: z
|
||||
.object({
|
||||
reservationId: idSchema,
|
||||
type: z.string().min(1).max(20),
|
||||
role: z.enum(['departure', 'arrival', 'pickup', 'return']),
|
||||
title: cardText(80),
|
||||
code: z.string().min(1).max(8).nullable(),
|
||||
at: cardClockSchema.nullable(),
|
||||
})
|
||||
.nullable(),
|
||||
// The schedule's entry for the stop.
|
||||
arrival: cardClockSchema.nullable(),
|
||||
departure: cardClockSchema.nullable(),
|
||||
anchored: z.boolean(),
|
||||
dayOffset: z.number().int().min(0).max(60),
|
||||
late: z.array(z.object({ code: z.enum(['late', 'missedLeave']), minutes })).max(2),
|
||||
// About the drive LEAVING this stop.
|
||||
findings: z
|
||||
.array(
|
||||
z.object({
|
||||
code: z.enum(['leg', 'range']),
|
||||
overMinutes: minutes.nullable(),
|
||||
sinceKm: z.number().min(0).max(40_000).nullable(),
|
||||
}),
|
||||
)
|
||||
.max(2),
|
||||
});
|
||||
|
||||
/** One day of the drive. `legs[i]` runs from `stops[i]` to `stops[i + 1]`; null where it is not routed. */
|
||||
export const roadtripCardDaySchema = z.object({
|
||||
dayId: idSchema,
|
||||
dayNumber,
|
||||
date: cardDateSchema.nullable(),
|
||||
title: cardText(80).nullable(),
|
||||
distanceM: metres,
|
||||
durationS: seconds,
|
||||
stops: z.array(roadtripCardStopSchema).max(ROADTRIP_CARD_STOPS_MAX),
|
||||
moreStops: z.number().int().min(0).max(1000),
|
||||
legs: z
|
||||
.array(z.object({ distanceM: metres, durationS: seconds, mode: z.string().min(1).max(40) }).nullable())
|
||||
.max(ROADTRIP_CARD_STOPS_MAX - 1),
|
||||
dayOver: z.object({ minutes, limitMinutes: z.number().int().min(1).max(1440) }).nullable(),
|
||||
avoidMissed: z.array(z.enum(['motorway', 'toll', 'ferry'])).max(3),
|
||||
// Where the range runs out, counted from the last fill.
|
||||
dryKm: z.number().min(0).max(40_000).nullable(),
|
||||
// The driven pieces only: a ride's straight jump between its terminals is left out.
|
||||
lines: z.array(roadtripCardLineSchema).max(ROADTRIP_CARD_DAY_LINES_MAX),
|
||||
});
|
||||
|
||||
export const roadtripCardSchema = z.object({
|
||||
kind: z.literal('roadtrip'),
|
||||
complete: z.boolean(),
|
||||
problem: z.enum(['routing', 'coordinates', 'dayWindow']).nullable(),
|
||||
// The settings a preview tried without saving them; empty for the saved drive.
|
||||
previewKeys: z.array(z.string().regex(/^roadtrip_[a-z0-9_]{1,40}$/)).max(12),
|
||||
vehicle: z.enum(['combustion', 'electric']).nullable(),
|
||||
defaultFill: z.number().int().min(1).max(100).nullable(),
|
||||
// The trip's own setting, so the sketch colours its days the way the map does.
|
||||
dayColors: z.boolean(),
|
||||
distanceM: metres,
|
||||
durationS: seconds,
|
||||
stopCount: z.number().int().min(0).max(10_000),
|
||||
chargingCount: z.number().int().min(0).max(10_000),
|
||||
days: z.array(roadtripCardDaySchema).min(1).max(ROADTRIP_CARD_DAYS_MAX),
|
||||
moreDays: z.number().int().min(0).max(1000),
|
||||
quietDays: z.number().int().min(0).max(1000),
|
||||
undatedRides: z.number().int().min(0).max(100),
|
||||
});
|
||||
export type RoadtripCard = z.infer<typeof roadtripCardSchema>;
|
||||
export type RoadtripCardDay = z.infer<typeof roadtripCardDaySchema>;
|
||||
export type RoadtripCardStop = z.infer<typeof roadtripCardStopSchema>;
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
import { ASSISTANT_CHANGE_VERB_KEYS, assistantAppliedSchema } from '../assistant.schema';
|
||||
import { MAX_CARD_CHARS } from './card-parts';
|
||||
import { chargingCardSchema } from './charging.card';
|
||||
import { corridorCardSchema } from './corridor.card';
|
||||
import { dayRouteCardSchema } from './day-route.card';
|
||||
import { storedTrekCardSchema, trekCardSchema } from './index';
|
||||
import { roadtripRulesCardSchema } from './roadtrip-rules.card';
|
||||
import { ROADTRIP_CARD_DAYS_MAX, roadtripCardSchema, type RoadtripCardStop } from './roadtrip.card';
|
||||
import { ROADTRIP_VERB_KEYS } from './roadtrip.contract';
|
||||
import { transitCardSchema } from './transit.card';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
const stop = (name: string, extra: Partial<RoadtripCardStop> = {}): RoadtripCardStop => ({
|
||||
placeId: 7,
|
||||
assignmentId: 70,
|
||||
name,
|
||||
lat: 48.13743,
|
||||
lng: 11.57549,
|
||||
stopType: null,
|
||||
time: null,
|
||||
leaveAt: null,
|
||||
dwellMinutes: 30,
|
||||
offRoadM: null,
|
||||
fillPercent: null,
|
||||
night: null,
|
||||
autoNight: null,
|
||||
bookend: null,
|
||||
carrier: null,
|
||||
arrival: '08:00',
|
||||
departure: '08:30',
|
||||
anchored: false,
|
||||
dayOffset: 0,
|
||||
late: [],
|
||||
findings: [],
|
||||
...extra,
|
||||
});
|
||||
|
||||
const day = (dayId: number) => ({
|
||||
dayId,
|
||||
dayNumber: dayId,
|
||||
date: '2026-10-01',
|
||||
title: null,
|
||||
distanceM: 152_000,
|
||||
durationS: 5880,
|
||||
stops: [stop('Munich'), stop('Verona', { placeId: 8, assignmentId: 80, arrival: '15:20', departure: null })],
|
||||
moreStops: 0,
|
||||
legs: [{ distanceM: 152_000, durationS: 5880, mode: 'driving' }],
|
||||
dayOver: null,
|
||||
avoidMissed: [],
|
||||
dryKm: null,
|
||||
lines: [
|
||||
[
|
||||
[48.13743, 11.57549],
|
||||
[45.43839, 10.99162],
|
||||
],
|
||||
],
|
||||
});
|
||||
|
||||
const drive = {
|
||||
kind: 'roadtrip',
|
||||
complete: true,
|
||||
problem: null,
|
||||
previewKeys: [],
|
||||
vehicle: 'electric',
|
||||
defaultFill: 80,
|
||||
dayColors: true,
|
||||
distanceM: 152_000,
|
||||
durationS: 5880,
|
||||
stopCount: 2,
|
||||
chargingCount: 0,
|
||||
days: [day(1)],
|
||||
moreDays: 0,
|
||||
quietDays: 0,
|
||||
undatedRides: 0,
|
||||
};
|
||||
|
||||
describe('road trip cards', () => {
|
||||
it('RTCARD-010: a drive with its days, stops and lines reads, and is one of the union', () => {
|
||||
expect(roadtripCardSchema.safeParse(drive).success).toBe(true);
|
||||
expect(trekCardSchema.safeParse(drive).success).toBe(true);
|
||||
});
|
||||
|
||||
it('RTCARD-011: a drive past its bounds reads as no card instead of breaking the message', () => {
|
||||
const days = Array.from({ length: ROADTRIP_CARD_DAYS_MAX + 1 }, (_, index) => day(index + 1));
|
||||
expect(roadtripCardSchema.safeParse({ ...drive, days }).success).toBe(false);
|
||||
expect(storedTrekCardSchema.parse({ ...drive, days })).toBeNull();
|
||||
expect(storedTrekCardSchema.parse({ ...drive, days: [] })).toBeNull();
|
||||
const badClock = { ...drive, days: [{ ...day(1), stops: [stop('Munich', { arrival: '25:00' })] }] };
|
||||
expect(roadtripCardSchema.safeParse(badClock).success).toBe(false);
|
||||
const oneLinePoint = { ...drive, days: [{ ...day(1), lines: [[[48, 11]]] }] };
|
||||
expect(roadtripCardSchema.safeParse(oneLinePoint).success).toBe(false);
|
||||
});
|
||||
|
||||
it('RTCARD-012: a terminal, a booked night and a day marker are stops of their own shape', () => {
|
||||
const terminal = stop('Munich Airport', {
|
||||
placeId: null,
|
||||
assignmentId: null,
|
||||
carrier: { reservationId: 4, type: 'flight', role: 'departure', title: 'LH 1840', code: 'MUC', at: '11:05' },
|
||||
});
|
||||
const night = stop('Hotel Adler', {
|
||||
assignmentId: null,
|
||||
stopType: 'hotel',
|
||||
bookend: {
|
||||
phase: 'evening',
|
||||
reservationId: null,
|
||||
checkingIn: true,
|
||||
checkingOut: false,
|
||||
checkIn: '15:00',
|
||||
checkOut: null,
|
||||
},
|
||||
});
|
||||
const marker = stop('Brenner', { autoNight: { phase: 'end', fromDayNumber: 1 } });
|
||||
const card = { ...drive, days: [{ ...day(1), stops: [terminal, night, marker], legs: [null, null] }] };
|
||||
expect(roadtripCardSchema.safeParse(card).success).toBe(true);
|
||||
const typeless = { ...terminal, carrier: { ...terminal.carrier, type: '' } };
|
||||
expect(roadtripCardSchema.safeParse({ ...drive, days: [{ ...day(1), stops: [typeless] }] }).success).toBe(false);
|
||||
});
|
||||
|
||||
it('RTCARD-013: a corridor search, a charger, connections and a day route read, each within its bounds', () => {
|
||||
const corridor = {
|
||||
kind: 'corridor',
|
||||
dayId: 3,
|
||||
dayNumber: 2,
|
||||
category: 'charging',
|
||||
widthKm: 5,
|
||||
hits: [
|
||||
{
|
||||
ref: 'call_1:0',
|
||||
name: 'Ionity Holzkirchen',
|
||||
brand: 'Ionity',
|
||||
lat: 47.88,
|
||||
lng: 11.7,
|
||||
alongKm: 31.4,
|
||||
offKm: 0.42,
|
||||
between: ['Munich', 'Verona'],
|
||||
sockets: [{ type: 'ccs', kw: 350, count: 6 }],
|
||||
},
|
||||
],
|
||||
more: 0,
|
||||
searched: { done: 6, total: 9 },
|
||||
partial: true,
|
||||
};
|
||||
expect(corridorCardSchema.safeParse(corridor).success).toBe(true);
|
||||
expect(corridorCardSchema.safeParse({ ...corridor, category: 'museum' }).success).toBe(false);
|
||||
|
||||
const charging = {
|
||||
kind: 'charging',
|
||||
placeId: 7,
|
||||
name: 'Ionity Holzkirchen',
|
||||
station: null,
|
||||
lat: 47.88,
|
||||
lng: 11.7,
|
||||
status: 'ok',
|
||||
stale: false,
|
||||
available: 4,
|
||||
total: 6,
|
||||
checkedAt: '2026-10-01T09:38:00Z',
|
||||
updatedAt: null,
|
||||
energy: { amount: 0.59, currency: 'EUR' },
|
||||
otherPrices: 1,
|
||||
source: 'MobiData BW',
|
||||
license: 'CC BY 4.0',
|
||||
};
|
||||
expect(chargingCardSchema.safeParse(charging).success).toBe(true);
|
||||
expect(chargingCardSchema.safeParse({ ...charging, checkedAt: '2026-10-01 09:38' }).success).toBe(false);
|
||||
|
||||
const leg = {
|
||||
mode: 'RAIL',
|
||||
line: 'RE 4',
|
||||
lineColor: '#ff0000',
|
||||
lineTextColor: null,
|
||||
from: { name: 'Munich Hbf', time: '08:04', track: '12' },
|
||||
to: { name: 'Rosenheim', time: '08:41', track: null },
|
||||
durationS: 2220,
|
||||
stops: 3,
|
||||
headsign: 'Salzburg',
|
||||
agency: null,
|
||||
};
|
||||
const itinerary = {
|
||||
date: '2026-10-01',
|
||||
start: '08:04',
|
||||
end: '08:41',
|
||||
endDayOffset: 0,
|
||||
durationS: 2220,
|
||||
transfers: 0,
|
||||
walkS: 0,
|
||||
legs: [leg],
|
||||
};
|
||||
const transit = { kind: 'transit', from: 'Munich', to: 'Rosenheim', dayId: null, more: 0, dropped: 0 };
|
||||
expect(transitCardSchema.safeParse({ ...transit, itineraries: [itinerary] }).success).toBe(true);
|
||||
const shortColour = { ...itinerary, legs: [{ ...leg, lineColor: '#f00' }] };
|
||||
expect(transitCardSchema.safeParse({ ...transit, itineraries: [shortColour] }).success).toBe(false);
|
||||
|
||||
const route = {
|
||||
kind: 'dayRoute',
|
||||
dayId: 3,
|
||||
dayNumber: 2,
|
||||
stops: [{ placeId: 7, name: 'Munich', lat: 48.1, lng: 11.6, added: false }],
|
||||
vias: [{ lat: 47.5, lng: 11.2, after: 0, state: 'moved', from: [47.4, 11.1] }],
|
||||
afterName: 'Munich',
|
||||
track: null,
|
||||
unresolved: [],
|
||||
};
|
||||
expect(dayRouteCardSchema.safeParse(route).success).toBe(true);
|
||||
const lostVia = { ...route, vias: [{ ...route.vias[0], state: 'lost' }] };
|
||||
expect(dayRouteCardSchema.safeParse(lostVia).success).toBe(false);
|
||||
});
|
||||
|
||||
it('RTCARD-014: the road trip adds its verbs and its applied entity to the shared enums', () => {
|
||||
for (const verb of ROADTRIP_VERB_KEYS) expect(ASSISTANT_CHANGE_VERB_KEYS).toContain(verb);
|
||||
const applied = { toolCallId: 'call_1', entity: 'roadtrip', ids: [5], dayId: 3, undoUntil: null };
|
||||
expect(assistantAppliedSchema.parse(applied).entity).toBe('roadtrip');
|
||||
});
|
||||
|
||||
it('RTCARD-016: the rules a change sets read with their values as stored, and a key that is no setting does not', () => {
|
||||
const rules = {
|
||||
kind: 'roadtripRules',
|
||||
settings: [
|
||||
{ key: 'roadtrip_day_start', before: '08:00', after: '09:30' },
|
||||
{ key: 'roadtrip_hotel_bookends', before: null, after: true },
|
||||
{ key: 'roadtrip_leg_minutes', before: 120, after: 0 },
|
||||
],
|
||||
dayEnd: { dayId: 3, dayNumber: 2, mode: 'along', from: 'Garmisch', to: 'Innsbruck', percent: 40 },
|
||||
};
|
||||
expect(roadtripRulesCardSchema.safeParse(rules).success).toBe(true);
|
||||
expect(trekCardSchema.safeParse({ ...rules, dayEnd: null }).success).toBe(true);
|
||||
const foreign = { ...rules, settings: [{ key: 'endpoint_url', before: null, after: 'x' }] };
|
||||
expect(roadtripRulesCardSchema.safeParse(foreign).success).toBe(false);
|
||||
const auto = { ...rules, dayEnd: { ...rules.dayEnd, mode: 'never' } };
|
||||
expect(roadtripRulesCardSchema.safeParse(auto).success).toBe(false);
|
||||
});
|
||||
|
||||
it('RTCARD-015: the fullest drive the bounds allow is a card the server can still check under the size cap', () => {
|
||||
// The bounds alone do not hold a drive under MAX_CARD_CHARS; the server's builder fits it.
|
||||
const days = Array.from({ length: ROADTRIP_CARD_DAYS_MAX }, (_, index) => day(index + 1));
|
||||
const full = { ...drive, days };
|
||||
expect(roadtripCardSchema.safeParse(full).success).toBe(true);
|
||||
expect(JSON.stringify(full).length).toBeLessThan(MAX_CARD_CHARS);
|
||||
});
|
||||
});
|
||||
@@ -1,12 +1,14 @@
|
||||
import { chargingCardSchema } from './charging.card';
|
||||
import { corridorCardSchema } from './corridor.card';
|
||||
import { dayRouteCardSchema } from './day-route.card';
|
||||
import { roadtripRulesCardSchema } from './roadtrip-rules.card';
|
||||
import { roadtripCardSchema } from './roadtrip.card';
|
||||
import { transitCardSchema } from './transit.card';
|
||||
|
||||
export * from './charging.card';
|
||||
export * from './corridor.card';
|
||||
export * from './day-route.card';
|
||||
export * from './roadtrip-rules.card';
|
||||
export * from './roadtrip.card';
|
||||
export * from './transit.card';
|
||||
|
||||
@@ -23,6 +25,24 @@ export const ROADTRIP_CARD_SCHEMAS = [
|
||||
chargingCardSchema,
|
||||
transitCardSchema,
|
||||
dayRouteCardSchema,
|
||||
roadtripRulesCardSchema,
|
||||
] as const;
|
||||
export const ROADTRIP_VERB_KEYS = [] as const;
|
||||
export const ROADTRIP_APPLIED_ENTITIES = [] as const;
|
||||
/**
|
||||
* A via point sent into a day's drive, a chain of them laid at once, one
|
||||
* moved, one taken out, the vias of a day pinned again to its stops; the
|
||||
* driving settings changed; where a day ends set; a Google Maps route taken
|
||||
* in as stops; a transit connection added.
|
||||
*/
|
||||
export const ROADTRIP_VERB_KEYS = [
|
||||
'addRouteVia',
|
||||
'shapeRoute',
|
||||
'moveRouteVia',
|
||||
'removeRouteVia',
|
||||
'repinRouteVias',
|
||||
'updateDriveSettings',
|
||||
'setDayBoundary',
|
||||
'importRoute',
|
||||
'addTransit',
|
||||
] as const;
|
||||
/** The road trip of a trip: its vias, its settings and its day endings, shown on the plan by their day. */
|
||||
export const ROADTRIP_APPLIED_ENTITIES = ['roadtrip'] as const;
|
||||
|
||||
@@ -1,8 +1,65 @@
|
||||
import { idSchema } from '../../common/primitives.schema';
|
||||
import { cardClockSchema, cardDateSchema, cardHexColorSchema, cardText } from './card-parts';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* A public transport journey with its legs and times. Only its kind so far; the road trip cards give
|
||||
* it its fields.
|
||||
* Public transport connections between two places: the ones a search found,
|
||||
* or the one a held create_transit_journey adds. Clocks are the local time
|
||||
* at each stop as the provider wrote it; a connection that lands on a later
|
||||
* day says by how many (`endDayOffset`).
|
||||
*/
|
||||
export const transitCardSchema = z.object({ kind: z.literal('transit') });
|
||||
|
||||
/** The connections a card lists; the rest are counted in `more`. */
|
||||
export const TRANSIT_CARD_ITINERARIES_MAX = 4;
|
||||
/** The legs of one connection a card lists. */
|
||||
export const TRANSIT_CARD_LEGS_MAX = 12;
|
||||
|
||||
const seconds = z.number().min(0).max(1e7);
|
||||
|
||||
const transitCardStopSchema = z.object({
|
||||
name: cardText(80),
|
||||
time: cardClockSchema.nullable(),
|
||||
track: cardText(12).nullable(),
|
||||
});
|
||||
|
||||
export const transitCardItinerarySchema = z.object({
|
||||
date: cardDateSchema,
|
||||
start: cardClockSchema,
|
||||
end: cardClockSchema,
|
||||
endDayOffset: z.number().int().min(0).max(3),
|
||||
durationS: seconds,
|
||||
transfers: z.number().int().min(0).max(20),
|
||||
walkS: seconds,
|
||||
legs: z
|
||||
.array(
|
||||
z.object({
|
||||
mode: z.string().regex(/^[A-Z_]{1,40}$/),
|
||||
line: cardText(20).nullable(),
|
||||
lineColor: cardHexColorSchema.nullable(),
|
||||
lineTextColor: cardHexColorSchema.nullable(),
|
||||
from: transitCardStopSchema,
|
||||
to: transitCardStopSchema,
|
||||
durationS: seconds,
|
||||
stops: z.number().int().min(0).max(500),
|
||||
headsign: cardText(80).nullable(),
|
||||
agency: cardText(60).nullable(),
|
||||
}),
|
||||
)
|
||||
.min(1)
|
||||
.max(TRANSIT_CARD_LEGS_MAX),
|
||||
});
|
||||
|
||||
export const transitCardSchema = z.object({
|
||||
kind: z.literal('transit'),
|
||||
from: cardText(80),
|
||||
to: cardText(80),
|
||||
// The day a held journey is added to; null for a search.
|
||||
dayId: idSchema.nullable(),
|
||||
itineraries: z.array(transitCardItinerarySchema).min(1).max(TRANSIT_CARD_ITINERARIES_MAX),
|
||||
more: z.number().int().min(0).max(100),
|
||||
// Connections the provider offered that could not be checked, so none of them is shown.
|
||||
dropped: z.number().int().min(0).max(100),
|
||||
});
|
||||
export type TransitCard = z.infer<typeof transitCardSchema>;
|
||||
export type TransitCardItinerary = z.infer<typeof transitCardItinerarySchema>;
|
||||
|
||||
@@ -1,4 +1,149 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'تمرير الرحلة عبر نقطة',
|
||||
'assistant.change.verb.shapeRoute': 'تشكيل الرحلة',
|
||||
'assistant.change.verb.moveRouteVia': 'نقل نقطة عبور',
|
||||
'assistant.change.verb.removeRouteVia': 'إزالة نقطة عبور',
|
||||
'assistant.change.verb.repinRouteVias': 'إعادة تثبيت نقاط العبور',
|
||||
'assistant.change.verb.updateDriveSettings': 'تغيير إعدادات القيادة',
|
||||
'assistant.change.verb.setDayBoundary': 'تحديد مكان انتهاء اليوم',
|
||||
'assistant.change.verb.importRoute': 'استيراد مسار',
|
||||
'assistant.change.verb.addTransit': 'إضافة رحلة مواصلات',
|
||||
'assistant.tool.add_route_via': 'تمرير الرحلة عبر نقطة',
|
||||
'assistant.tool.add_route_vias': 'تشكيل الرحلة على طول خط',
|
||||
'assistant.tool.update_route_via': 'نقل نقطة عبور',
|
||||
'assistant.tool.remove_route_via': 'إزالة نقطة عبور',
|
||||
'assistant.tool.reanchor_route_vias': 'إعادة تثبيت نقاط عبور يوم',
|
||||
'assistant.tool.update_roadtrip_settings': 'تغيير إعدادات القيادة',
|
||||
'assistant.tool.set_day_boundary': 'تحديد مكان انتهاء اليوم',
|
||||
'assistant.tool.import_google_maps_route': 'استيراد مسار من خرائط Google',
|
||||
'assistant.tool.preview_google_maps_route': 'قراءة مسار من خرائط Google',
|
||||
'assistant.tool.create_transit_journey': 'إضافة رحلة بالمواصلات العامة',
|
||||
'assistant.step.roadtrip': 'جارٍ حساب الرحلة',
|
||||
'assistant.step.corridor': 'جارٍ البحث على طول المسار',
|
||||
'assistant.step.charging': 'جارٍ فحص الشاحن',
|
||||
'assistant.step.transit': 'جارٍ البحث عن رحلات المواصلات',
|
||||
'assistant.followUp.chargers': 'البحث عن شواحن على الطريق',
|
||||
'assistant.followUp.stays': 'البحث عن أماكن إقامة على الطريق',
|
||||
'assistant.followUp.corridorMore': 'البحث أبعد على طول المسار',
|
||||
'assistant.followUp.laterTransit': 'عرض رحلات لاحقة',
|
||||
'assistant.followUp.addTransit': 'إضافة أول رحلة إلى السفر',
|
||||
'assistant.card.roadtrip.preview': 'معاينة',
|
||||
'assistant.card.roadtrip.saved': 'الإعدادات المحفوظة',
|
||||
'assistant.card.roadtrip.variants': 'طرق قيادة الرحلة',
|
||||
'assistant.card.roadtrip.warnings': '{count} تحذير',
|
||||
'assistant.card.roadtrip.warnings.zero': 'لا تحذيرات',
|
||||
'assistant.card.roadtrip.warnings.one': 'تحذير واحد',
|
||||
'assistant.card.roadtrip.warnings.two': 'تحذيران',
|
||||
'assistant.card.roadtrip.warnings.few': '{count} تحذيرات',
|
||||
'assistant.card.roadtrip.warnings.many': '{count} تحذيرًا',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} محطة شحن',
|
||||
'assistant.card.roadtrip.chargingStops.zero': 'لا محطات شحن',
|
||||
'assistant.card.roadtrip.chargingStops.one': 'محطة شحن واحدة',
|
||||
'assistant.card.roadtrip.chargingStops.two': 'محطتا شحن',
|
||||
'assistant.card.roadtrip.chargingStops.few': '{count} محطات شحن',
|
||||
'assistant.card.roadtrip.chargingStops.many': '{count} محطة شحن',
|
||||
'assistant.card.roadtrip.moreDays': '{count} يوم إضافي في الرحلة البرية',
|
||||
'assistant.card.roadtrip.moreDays.zero': 'لا أيام إضافية في الرحلة البرية',
|
||||
'assistant.card.roadtrip.moreDays.one': 'يوم إضافي واحد في الرحلة البرية',
|
||||
'assistant.card.roadtrip.moreDays.two': 'يومان إضافيان في الرحلة البرية',
|
||||
'assistant.card.roadtrip.moreDays.few': '{count} أيام إضافية في الرحلة البرية',
|
||||
'assistant.card.roadtrip.moreDays.many': '{count} يومًا إضافيًا في الرحلة البرية',
|
||||
'assistant.card.roadtrip.moreStops': '{count} محطة توقف إضافية في هذا اليوم',
|
||||
'assistant.card.roadtrip.moreStops.zero': 'لا محطات توقف إضافية في هذا اليوم',
|
||||
'assistant.card.roadtrip.moreStops.one': 'محطة توقف إضافية واحدة في هذا اليوم',
|
||||
'assistant.card.roadtrip.moreStops.two': 'محطتا توقف إضافيتان في هذا اليوم',
|
||||
'assistant.card.roadtrip.moreStops.few': '{count} محطات توقف إضافية في هذا اليوم',
|
||||
'assistant.card.roadtrip.moreStops.many': '{count} محطة توقف إضافية في هذا اليوم',
|
||||
'assistant.card.roadtrip.undated': '{count} حجز لا يقع في أي من الأيام',
|
||||
'assistant.card.roadtrip.undated.zero': 'لا حجوزات خارج الأيام',
|
||||
'assistant.card.roadtrip.undated.one': 'حجز واحد لا يقع في أي من الأيام',
|
||||
'assistant.card.roadtrip.undated.two': 'حجزان لا يقعان في أي من الأيام',
|
||||
'assistant.card.roadtrip.undated.few': '{count} حجوزات لا تقع في أي من الأيام',
|
||||
'assistant.card.roadtrip.undated.many': '{count} حجزًا لا يقع في أي من الأيام',
|
||||
'assistant.card.roadtrip.noDrive': 'بلا قيادة',
|
||||
'assistant.card.roadtrip.days': 'أيام الرحلة',
|
||||
'assistant.card.roadtrip.dayWarning': 'في هذا اليوم شيء يستحق المراجعة',
|
||||
'assistant.card.roadtrip.sketch': 'رسم تخطيطي للمسار',
|
||||
'assistant.card.roadtrip.showDrive': 'عرض الرحلة على الخريطة',
|
||||
'assistant.card.roadtrip.showDay': 'عرض اليوم {number} على الخريطة',
|
||||
'assistant.card.roadtrip.open': 'فتح في الرحلة البرية',
|
||||
'assistant.card.roadtrip.problem.routing': 'تعذّر حساب بعض المقاطع، لذا لا تمثل هذه المجاميع الرحلة كلها.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'بعض الأماكن بلا موقع، لذا تتجاوزها الرحلة.',
|
||||
'assistant.card.roadtrip.problem.dayWindow': 'لا يمكن الالتزام بأوقات السفر اليومية، لذا نهايات الأيام ليست نهائية.',
|
||||
'assistant.card.roadtrip.setting.on': 'مفعّل',
|
||||
'assistant.card.roadtrip.setting.off': 'متوقف',
|
||||
'assistant.card.roadtrip.corridor.none': 'لم يُعثر على شيء ضمن {distance} من المسار.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'تم البحث في {done} من {count} منطقة حتى الآن.',
|
||||
'assistant.card.roadtrip.corridor.partial.zero': 'تم البحث في {done} من {count} منطقة حتى الآن.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'تم البحث في {done} من {count} منطقة حتى الآن.',
|
||||
'assistant.card.roadtrip.corridor.partial.two': 'تم البحث في {done} من {count} منطقتين حتى الآن.',
|
||||
'assistant.card.roadtrip.corridor.partial.few': 'تم البحث في {done} من {count} مناطق حتى الآن.',
|
||||
'assistant.card.roadtrip.corridor.partial.many': 'تم البحث في {done} من {count} منطقة حتى الآن.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} نتيجة إضافية على طول المسار',
|
||||
'assistant.card.roadtrip.corridor.more.zero': 'لا نتائج إضافية على طول المسار',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'نتيجة إضافية واحدة على طول المسار',
|
||||
'assistant.card.roadtrip.corridor.more.two': 'نتيجتان إضافيتان على طول المسار',
|
||||
'assistant.card.roadtrip.corridor.more.few': '{count} نتائج إضافية على طول المسار',
|
||||
'assistant.card.roadtrip.corridor.more.many': '{count} نتيجة إضافية على طول المسار',
|
||||
'assistant.card.roadtrip.charging.checked': 'فُحص الساعة {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'البيانات من {source} بموجب {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'البيانات من {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'حُدّث الساعة {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} رحلة إضافية',
|
||||
'assistant.card.roadtrip.transit.more.zero': 'لا رحلات إضافية',
|
||||
'assistant.card.roadtrip.transit.more.one': 'رحلة إضافية واحدة',
|
||||
'assistant.card.roadtrip.transit.more.two': 'رحلتان إضافيتان',
|
||||
'assistant.card.roadtrip.transit.more.few': '{count} رحلات إضافية',
|
||||
'assistant.card.roadtrip.transit.more.many': '{count} رحلة إضافية',
|
||||
'assistant.card.roadtrip.transit.dropped': 'تعذّر عرض {count} رحلة',
|
||||
'assistant.card.roadtrip.transit.dropped.zero': 'لم يتعذّر عرض أي رحلة',
|
||||
'assistant.card.roadtrip.transit.dropped.one': 'تعذّر عرض رحلة واحدة',
|
||||
'assistant.card.roadtrip.transit.dropped.two': 'تعذّر عرض رحلتين',
|
||||
'assistant.card.roadtrip.transit.dropped.few': 'تعذّر عرض {count} رحلات',
|
||||
'assistant.card.roadtrip.transit.dropped.many': 'تعذّر عرض {count} رحلة',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} نقطة عبور',
|
||||
'assistant.card.roadtrip.dayRoute.vias.zero': 'لا نقاط عبور',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': 'نقطة عبور واحدة',
|
||||
'assistant.card.roadtrip.dayRoute.vias.two': 'نقطتا عبور',
|
||||
'assistant.card.roadtrip.dayRoute.vias.few': '{count} نقاط عبور',
|
||||
'assistant.card.roadtrip.dayRoute.vias.many': '{count} نقطة عبور',
|
||||
'assistant.card.roadtrip.dayRoute.removed': 'أُزيلت {count} نقطة عبور',
|
||||
'assistant.card.roadtrip.dayRoute.removed.zero': 'لم تُزل أي نقطة عبور',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': 'أُزيلت نقطة عبور واحدة',
|
||||
'assistant.card.roadtrip.dayRoute.removed.two': 'أُزيلت نقطتا عبور',
|
||||
'assistant.card.roadtrip.dayRoute.removed.few': 'أُزيلت {count} نقاط عبور',
|
||||
'assistant.card.roadtrip.dayRoute.removed.many': 'أُزيلت {count} نقطة عبور',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} محطة توقف جديدة',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.zero': 'لا محطات توقف جديدة',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': 'محطة توقف جديدة واحدة',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.two': 'محطتا توقف جديدتان',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.few': '{count} محطات توقف جديدة',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.many': '{count} محطة توقف جديدة',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': 'تعذّر تحديد موقع {count} محطة توقف',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.zero': 'لم يتعذّر تحديد موقع أي محطة توقف',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': 'تعذّر تحديد موقع محطة توقف واحدة',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.two': 'تعذّر تحديد موقع محطتي توقف',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.few': 'تعذّر تحديد موقع {count} محطات توقف',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.many': 'تعذّر تحديد موقع {count} محطة توقف',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'بعد {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'يتبع {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'خطوط مستقيمة حاليًا؛ يحسب TREK الطريق بعد تطبيق التغيير.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'ينتهي اليوم عند {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'ينتهي اليوم عند {percent} % من القيادة بعد {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'ينتهي اليوم تلقائيًا من جديد',
|
||||
'assistant.card.roadtrip.quietDays': '{count} يوم بلا قيادة',
|
||||
'assistant.card.roadtrip.quietDays.zero': 'لا أيام بلا قيادة',
|
||||
'assistant.card.roadtrip.quietDays.one': 'يوم واحد بلا قيادة',
|
||||
'assistant.card.roadtrip.quietDays.two': 'يومان بلا قيادة',
|
||||
'assistant.card.roadtrip.quietDays.few': '{count} أيام بلا قيادة',
|
||||
'assistant.card.roadtrip.quietDays.many': '{count} يومًا بلا قيادة',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} سعر آخر',
|
||||
'assistant.card.roadtrip.charging.otherPrices.zero': 'لا أسعار أخرى',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': 'سعر آخر واحد',
|
||||
'assistant.card.roadtrip.charging.otherPrices.two': 'سعران آخران',
|
||||
'assistant.card.roadtrip.charging.otherPrices.few': '{count} أسعار أخرى',
|
||||
'assistant.card.roadtrip.charging.otherPrices.many': '{count} سعرًا آخر',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,91 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Səfəri bir nöqtədən keçir',
|
||||
'assistant.change.verb.shapeRoute': 'Səfərə forma ver',
|
||||
'assistant.change.verb.moveRouteVia': 'Ara nöqtəni köçür',
|
||||
'assistant.change.verb.removeRouteVia': 'Ara nöqtəni sil',
|
||||
'assistant.change.verb.repinRouteVias': 'Ara nöqtələri yenidən bağla',
|
||||
'assistant.change.verb.updateDriveSettings': 'Sürücülük ayarlarını dəyiş',
|
||||
'assistant.change.verb.setDayBoundary': 'Günün harada bitdiyini təyin et',
|
||||
'assistant.change.verb.importRoute': 'Marşrut idxal et',
|
||||
'assistant.change.verb.addTransit': 'Əlaqə əlavə et',
|
||||
'assistant.tool.add_route_via': 'Səfəri bir nöqtədən keçir',
|
||||
'assistant.tool.add_route_vias': 'Səfərə xətt boyunca forma ver',
|
||||
'assistant.tool.update_route_via': 'Ara nöqtəni köçür',
|
||||
'assistant.tool.remove_route_via': 'Ara nöqtəni sil',
|
||||
'assistant.tool.reanchor_route_vias': 'Günün ara nöqtələrini yenidən bağla',
|
||||
'assistant.tool.update_roadtrip_settings': 'Sürücülük ayarlarını dəyiş',
|
||||
'assistant.tool.set_day_boundary': 'Günün harada bitdiyini təyin et',
|
||||
'assistant.tool.import_google_maps_route': 'Google Maps marşrutunu idxal et',
|
||||
'assistant.tool.preview_google_maps_route': 'Google Maps marşrutunu oxu',
|
||||
'assistant.tool.create_transit_journey': 'İctimai nəqliyyat əlaqəsi əlavə et',
|
||||
'assistant.step.roadtrip': 'Səfər hesablanır',
|
||||
'assistant.step.corridor': 'Marşrut boyunca axtarılır',
|
||||
'assistant.step.charging': 'Doldurma məntəqəsi yoxlanılır',
|
||||
'assistant.step.transit': 'Əlaqələr axtarılır',
|
||||
'assistant.followUp.chargers': 'Yolda doldurma məntəqələri tap',
|
||||
'assistant.followUp.stays': 'Yolda qalmaq üçün yer tap',
|
||||
'assistant.followUp.corridorMore': 'Marşrutda daha irəlidə axtar',
|
||||
'assistant.followUp.laterTransit': 'Daha gec əlaqələri göstər',
|
||||
'assistant.followUp.addTransit': 'İlk əlaqəni səyahətə əlavə et',
|
||||
'assistant.card.roadtrip.preview': 'Önizləmə',
|
||||
'assistant.card.roadtrip.saved': 'Saxlanmış ayarlar',
|
||||
'assistant.card.roadtrip.variants': 'Səfərin variantları',
|
||||
'assistant.card.roadtrip.warnings': '{count} xəbərdarlıq',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} xəbərdarlıq',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} doldurma dayanacağı',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} doldurma dayanacağı',
|
||||
'assistant.card.roadtrip.moreDays': 'Yol səfərində daha {count} gün',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Yol səfərində daha {count} gün',
|
||||
'assistant.card.roadtrip.moreStops': 'Bu gündə daha {count} dayanacaq',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Bu gündə daha {count} dayanacaq',
|
||||
'assistant.card.roadtrip.undated': '{count} rezervasiya heç bir günə düşmür',
|
||||
'assistant.card.roadtrip.undated.one': '{count} rezervasiya heç bir günə düşmür',
|
||||
'assistant.card.roadtrip.noDrive': 'Sürüş yoxdur',
|
||||
'assistant.card.roadtrip.days': 'Səfərin günləri',
|
||||
'assistant.card.roadtrip.dayWarning': 'Bu gündə nəzər salmalı bir şey var',
|
||||
'assistant.card.roadtrip.sketch': 'Marşrutun eskizi',
|
||||
'assistant.card.roadtrip.showDrive': 'Səfəri xəritədə göstər',
|
||||
'assistant.card.roadtrip.showDay': '{number}. günü xəritədə göstər',
|
||||
'assistant.card.roadtrip.open': 'Yol səfərində aç',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Bəzi hissələr hesablana bilmədi, ona görə də bu cəmlər bütün səfər deyil.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Bəzi yerlərin mövqeyi yoxdur, ona görə də səfər onları buraxır.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Gündəlik səfər vaxtlarına riayət etmək olmur, ona görə də günlərin sonu qəti deyil.',
|
||||
'assistant.card.roadtrip.setting.on': 'Açıq',
|
||||
'assistant.card.roadtrip.setting.off': 'Bağlı',
|
||||
'assistant.card.roadtrip.corridor.none': 'Marşrutdan {distance} məsafədə heç nə tapılmadı.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'İndiyədək {count} ərazidən {done} axtarılıb.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'İndiyədək {count} ərazidən {done} axtarılıb.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Marşrut boyunca daha {count} nəticə',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Marşrut boyunca daha {count} nəticə',
|
||||
'assistant.card.roadtrip.charging.checked': 'Yoxlanma vaxtı: {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Məlumat: {source}, lisenziya: {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Məlumat: {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Yenilənmə vaxtı: {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Daha {count} əlaqə',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Daha {count} əlaqə',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} əlaqə göstərilə bilmədi',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} əlaqə göstərilə bilmədi',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} ara nöqtə',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} ara nöqtə',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} ara nöqtə silindi',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} ara nöqtə silindi',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} yeni dayanacaq',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} yeni dayanacaq',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} dayanacaq yerləşdirilə bilmədi',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} dayanacaq yerləşdirilə bilmədi',
|
||||
'assistant.card.roadtrip.dayRoute.after': '{name} sonra',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'İzlədiyi iz: {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'Hələlik düz xətlər; dəyişiklik tətbiq olunanda TREK yolu hesablayır.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Gün burada bitir: {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Gün {name} sonra səfərin {percent} %-ində bitir',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Gün yenidən avtomatik bitir',
|
||||
'assistant.card.roadtrip.quietDays': 'Sürüşsüz {count} gün',
|
||||
'assistant.card.roadtrip.quietDays.one': 'Sürüşsüz {count} gün',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} digər qiymət',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} digər qiymət',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,92 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Fazer o trajeto passar por um ponto',
|
||||
'assistant.change.verb.shapeRoute': 'Moldar o trajeto',
|
||||
'assistant.change.verb.moveRouteVia': 'Mover um ponto de passagem',
|
||||
'assistant.change.verb.removeRouteVia': 'Remover um ponto de passagem',
|
||||
'assistant.change.verb.repinRouteVias': 'Reancorar os pontos de passagem',
|
||||
'assistant.change.verb.updateDriveSettings': 'Alterar as configurações de direção',
|
||||
'assistant.change.verb.setDayBoundary': 'Definir onde um dia termina',
|
||||
'assistant.change.verb.importRoute': 'Importar uma rota',
|
||||
'assistant.change.verb.addTransit': 'Adicionar uma conexão',
|
||||
'assistant.tool.add_route_via': 'Fazer o trajeto passar por um ponto',
|
||||
'assistant.tool.add_route_vias': 'Moldar o trajeto ao longo de uma linha',
|
||||
'assistant.tool.update_route_via': 'Mover um ponto de passagem',
|
||||
'assistant.tool.remove_route_via': 'Remover um ponto de passagem',
|
||||
'assistant.tool.reanchor_route_vias': 'Reancorar os pontos de passagem de um dia',
|
||||
'assistant.tool.update_roadtrip_settings': 'Alterar as configurações de direção',
|
||||
'assistant.tool.set_day_boundary': 'Definir onde o dia termina',
|
||||
'assistant.tool.import_google_maps_route': 'Importar uma rota do Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Ler uma rota do Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Adicionar uma conexão de transporte público',
|
||||
'assistant.step.roadtrip': 'Calculando o trajeto',
|
||||
'assistant.step.corridor': 'Buscando ao longo da rota',
|
||||
'assistant.step.charging': 'Verificando o carregador',
|
||||
'assistant.step.transit': 'Buscando conexões',
|
||||
'assistant.followUp.chargers': 'Encontrar carregadores pelo caminho',
|
||||
'assistant.followUp.stays': 'Encontrar hospedagem pelo caminho',
|
||||
'assistant.followUp.corridorMore': 'Buscar mais adiante na rota',
|
||||
'assistant.followUp.laterTransit': 'Mostrar conexões mais tarde',
|
||||
'assistant.followUp.addTransit': 'Adicionar a primeira conexão à viagem',
|
||||
'assistant.card.roadtrip.preview': 'Prévia',
|
||||
'assistant.card.roadtrip.saved': 'Configurações salvas',
|
||||
'assistant.card.roadtrip.variants': 'Formas de fazer o trajeto',
|
||||
'assistant.card.roadtrip.warnings': '{count} avisos',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} aviso',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} paradas para recarga',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} parada para recarga',
|
||||
'assistant.card.roadtrip.moreDays': 'Mais {count} dias na road trip',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Mais {count} dia na road trip',
|
||||
'assistant.card.roadtrip.moreStops': 'Mais {count} paradas neste dia',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Mais {count} parada neste dia',
|
||||
'assistant.card.roadtrip.undated': '{count} reservas não caem em nenhum dos dias',
|
||||
'assistant.card.roadtrip.undated.one': '{count} reserva não cai em nenhum dos dias',
|
||||
'assistant.card.roadtrip.noDrive': 'Sem trajeto',
|
||||
'assistant.card.roadtrip.days': 'Dias do trajeto',
|
||||
'assistant.card.roadtrip.dayWarning': 'Há algo neste dia para conferir',
|
||||
'assistant.card.roadtrip.sketch': 'Esboço da rota',
|
||||
'assistant.card.roadtrip.showDrive': 'Mostrar o trajeto no mapa',
|
||||
'assistant.card.roadtrip.showDay': 'Mostrar o dia {number} no mapa',
|
||||
'assistant.card.roadtrip.open': 'Abrir na road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Alguns trechos não puderam ser calculados, então estes totais não são o trajeto inteiro.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Alguns lugares não têm posição, então o trajeto os deixa de fora.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Os horários diários não podem ser cumpridos, então os finais de dia não são definitivos.',
|
||||
'assistant.card.roadtrip.setting.on': 'Ligado',
|
||||
'assistant.card.roadtrip.setting.off': 'Desligado',
|
||||
'assistant.card.roadtrip.corridor.none': 'Nada encontrado a menos de {distance} da rota.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Buscado em {done} de {count} áreas até agora.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Buscado em {done} de {count} área até agora.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Mais {count} resultados ao longo da rota',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Mais {count} resultado ao longo da rota',
|
||||
'assistant.card.roadtrip.charging.checked': 'Verificado às {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Dados de {source} sob {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Dados de {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Atualizado às {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Mais {count} conexões',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Mais {count} conexão',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} conexões não puderam ser mostradas',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} conexão não pôde ser mostrada',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} pontos de passagem',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} ponto de passagem',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} pontos de passagem removidos',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} ponto de passagem removido',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} paradas novas',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} parada nova',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} paradas não puderam ser localizadas',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} parada não pôde ser localizada',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Depois de {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Segue {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Por enquanto, linhas retas; o TREK calcula a estrada quando a alteração for aplicada.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'O dia termina em {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'O dia termina a {percent} % do trajeto depois de {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'O dia volta a terminar automaticamente',
|
||||
'assistant.card.roadtrip.quietDays': '{count} dias sem dirigir',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} dia sem dirigir',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} outros preços',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} outro preço',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,92 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Fer passar el trajecte per un punt',
|
||||
'assistant.change.verb.shapeRoute': 'Donar forma al trajecte',
|
||||
'assistant.change.verb.moveRouteVia': 'Moure un punt de pas',
|
||||
'assistant.change.verb.removeRouteVia': 'Treure un punt de pas',
|
||||
'assistant.change.verb.repinRouteVias': 'Tornar a ancorar els punts de pas',
|
||||
'assistant.change.verb.updateDriveSettings': 'Canviar els ajustos de conducció',
|
||||
'assistant.change.verb.setDayBoundary': 'Fixar on acaba un dia',
|
||||
'assistant.change.verb.importRoute': 'Importar una ruta',
|
||||
'assistant.change.verb.addTransit': 'Afegir una connexió',
|
||||
'assistant.tool.add_route_via': 'Fer passar el trajecte per un punt',
|
||||
'assistant.tool.add_route_vias': 'Donar forma al trajecte al llarg d’una línia',
|
||||
'assistant.tool.update_route_via': 'Moure un punt de pas',
|
||||
'assistant.tool.remove_route_via': 'Treure un punt de pas',
|
||||
'assistant.tool.reanchor_route_vias': 'Tornar a ancorar els punts de pas d’un dia',
|
||||
'assistant.tool.update_roadtrip_settings': 'Canviar els ajustos de conducció',
|
||||
'assistant.tool.set_day_boundary': 'Fixar on acaba el dia',
|
||||
'assistant.tool.import_google_maps_route': 'Importar una ruta de Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Llegir una ruta de Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Afegir una connexió de transport públic',
|
||||
'assistant.step.roadtrip': 'Calculant el trajecte',
|
||||
'assistant.step.corridor': 'Cercant al llarg de la ruta',
|
||||
'assistant.step.charging': 'Comprovant el carregador',
|
||||
'assistant.step.transit': 'Cercant connexions',
|
||||
'assistant.followUp.chargers': 'Trobar carregadors pel camí',
|
||||
'assistant.followUp.stays': 'Trobar allotjament pel camí',
|
||||
'assistant.followUp.corridorMore': 'Cercar més endavant a la ruta',
|
||||
'assistant.followUp.laterTransit': 'Mostrar connexions més tard',
|
||||
'assistant.followUp.addTransit': 'Afegir la primera connexió al viatge',
|
||||
'assistant.card.roadtrip.preview': 'Previsualització',
|
||||
'assistant.card.roadtrip.saved': 'Ajustos desats',
|
||||
'assistant.card.roadtrip.variants': 'Maneres de fer el trajecte',
|
||||
'assistant.card.roadtrip.warnings': '{count} avisos',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} avís',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} parades de càrrega',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} parada de càrrega',
|
||||
'assistant.card.roadtrip.moreDays': '{count} dies més al road trip',
|
||||
'assistant.card.roadtrip.moreDays.one': '{count} dia més al road trip',
|
||||
'assistant.card.roadtrip.moreStops': '{count} parades més aquest dia',
|
||||
'assistant.card.roadtrip.moreStops.one': '{count} parada més aquest dia',
|
||||
'assistant.card.roadtrip.undated': '{count} reserves no cauen en cap dels dies',
|
||||
'assistant.card.roadtrip.undated.one': '{count} reserva no cau en cap dels dies',
|
||||
'assistant.card.roadtrip.noDrive': 'Sense trajecte',
|
||||
'assistant.card.roadtrip.days': 'Dies del trajecte',
|
||||
'assistant.card.roadtrip.dayWarning': 'Hi ha alguna cosa d’aquest dia per revisar',
|
||||
'assistant.card.roadtrip.sketch': 'Esbós de la ruta',
|
||||
'assistant.card.roadtrip.showDrive': 'Mostrar el trajecte al mapa',
|
||||
'assistant.card.roadtrip.showDay': 'Mostrar el dia {number} al mapa',
|
||||
'assistant.card.roadtrip.open': 'Obrir al road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Alguns trams no s’han pogut calcular, així que aquests totals no són tot el trajecte.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Alguns llocs no tenen posició, així que el trajecte els deixa fora.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Els horaris diaris no es poden complir, així que els finals de dia no són definitius.',
|
||||
'assistant.card.roadtrip.setting.on': 'Activat',
|
||||
'assistant.card.roadtrip.setting.off': 'Desactivat',
|
||||
'assistant.card.roadtrip.corridor.none': 'No s’ha trobat res a menys de {distance} de la ruta.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Cercat en {done} de {count} zones fins ara.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Cercat en {done} de {count} zona fins ara.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} resultats més al llarg de la ruta',
|
||||
'assistant.card.roadtrip.corridor.more.one': '{count} resultat més al llarg de la ruta',
|
||||
'assistant.card.roadtrip.charging.checked': 'Comprovat a les {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Dades de {source} amb llicència {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Dades de {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Actualitzat a les {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} connexions més',
|
||||
'assistant.card.roadtrip.transit.more.one': '{count} connexió més',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} connexions no s’han pogut mostrar',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} connexió no s’ha pogut mostrar',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} punts de pas',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} punt de pas',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} punts de pas trets',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} punt de pas tret',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} parades noves',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} parada nova',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} parades no s’han pogut situar',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} parada no s’ha pogut situar',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Després de {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Segueix {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'De moment, línies rectes; TREK calcula la carretera quan s’aplica el canvi.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'El dia acaba a {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'El dia acaba al {percent} % del trajecte després de {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'El dia torna a acabar automàticament',
|
||||
'assistant.card.roadtrip.quietDays': '{count} dies sense conduir',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} dia sense conduir',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} preus més',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} preu més',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,105 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Vést jízdu přes bod',
|
||||
'assistant.change.verb.shapeRoute': 'Tvarovat jízdu',
|
||||
'assistant.change.verb.moveRouteVia': 'Přesunout průjezdní bod',
|
||||
'assistant.change.verb.removeRouteVia': 'Odebrat průjezdní bod',
|
||||
'assistant.change.verb.repinRouteVias': 'Znovu ukotvit průjezdní body',
|
||||
'assistant.change.verb.updateDriveSettings': 'Změnit nastavení jízdy',
|
||||
'assistant.change.verb.setDayBoundary': 'Určit, kde den končí',
|
||||
'assistant.change.verb.importRoute': 'Importovat trasu',
|
||||
'assistant.change.verb.addTransit': 'Přidat spojení',
|
||||
'assistant.tool.add_route_via': 'Vést jízdu přes bod',
|
||||
'assistant.tool.add_route_vias': 'Tvarovat jízdu podél čáry',
|
||||
'assistant.tool.update_route_via': 'Přesunout průjezdní bod',
|
||||
'assistant.tool.remove_route_via': 'Odebrat průjezdní bod',
|
||||
'assistant.tool.reanchor_route_vias': 'Znovu ukotvit průjezdní body dne',
|
||||
'assistant.tool.update_roadtrip_settings': 'Změnit nastavení jízdy',
|
||||
'assistant.tool.set_day_boundary': 'Určit, kde den končí',
|
||||
'assistant.tool.import_google_maps_route': 'Importovat trasu z Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Načíst trasu z Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Přidat spojení veřejnou dopravou',
|
||||
'assistant.step.roadtrip': 'Počítám jízdu',
|
||||
'assistant.step.corridor': 'Hledám podél trasy',
|
||||
'assistant.step.charging': 'Kontroluji nabíječku',
|
||||
'assistant.step.transit': 'Vyhledávám spojení',
|
||||
'assistant.followUp.chargers': 'Najít nabíječky po cestě',
|
||||
'assistant.followUp.stays': 'Najít ubytování po cestě',
|
||||
'assistant.followUp.corridorMore': 'Hledat dál podél trasy',
|
||||
'assistant.followUp.laterTransit': 'Ukázat pozdější spojení',
|
||||
'assistant.followUp.addTransit': 'Přidat první spojení do cesty',
|
||||
'assistant.card.roadtrip.preview': 'Náhled',
|
||||
'assistant.card.roadtrip.saved': 'Uložené nastavení',
|
||||
'assistant.card.roadtrip.variants': 'Varianty jízdy',
|
||||
'assistant.card.roadtrip.warnings': '{count} upozornění',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} upozornění',
|
||||
'assistant.card.roadtrip.warnings.few': '{count} upozornění',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} zastávek na nabíjení',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} zastávka na nabíjení',
|
||||
'assistant.card.roadtrip.chargingStops.few': '{count} zastávky na nabíjení',
|
||||
'assistant.card.roadtrip.moreDays': 'Dalších {count} dní v road tripu',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Další {count} den v road tripu',
|
||||
'assistant.card.roadtrip.moreDays.few': 'Další {count} dny v road tripu',
|
||||
'assistant.card.roadtrip.moreStops': 'Dalších {count} zastávek v tento den',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Další {count} zastávka v tento den',
|
||||
'assistant.card.roadtrip.moreStops.few': 'Další {count} zastávky v tento den',
|
||||
'assistant.card.roadtrip.undated': '{count} rezervací nepřipadá na žádný den',
|
||||
'assistant.card.roadtrip.undated.one': '{count} rezervace nepřipadá na žádný den',
|
||||
'assistant.card.roadtrip.undated.few': '{count} rezervace nepřipadají na žádný den',
|
||||
'assistant.card.roadtrip.noDrive': 'Bez jízdy',
|
||||
'assistant.card.roadtrip.days': 'Dny jízdy',
|
||||
'assistant.card.roadtrip.dayWarning': 'Na tomto dni je něco ke kontrole',
|
||||
'assistant.card.roadtrip.sketch': 'Náčrt trasy',
|
||||
'assistant.card.roadtrip.showDrive': 'Ukázat jízdu na mapě',
|
||||
'assistant.card.roadtrip.showDay': 'Ukázat den {number} na mapě',
|
||||
'assistant.card.roadtrip.open': 'Otevřít v road tripu',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Některé úseky se nepodařilo spočítat, takže tyto součty nejsou celá jízda.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Některá místa nemají polohu, takže je jízda vynechává.',
|
||||
'assistant.card.roadtrip.problem.dayWindow': 'Denní časy cestování nelze dodržet, takže konce dnů nejsou konečné.',
|
||||
'assistant.card.roadtrip.setting.on': 'Zapnuto',
|
||||
'assistant.card.roadtrip.setting.off': 'Vypnuto',
|
||||
'assistant.card.roadtrip.corridor.none': 'Do vzdálenosti {distance} od trasy se nic nenašlo.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Zatím prohledáno {done} z {count} oblastí.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Zatím prohledáno {done} z {count} oblasti.',
|
||||
'assistant.card.roadtrip.corridor.partial.few': 'Zatím prohledáno {done} ze {count} oblastí.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Dalších {count} výsledků podél trasy',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Další {count} výsledek podél trasy',
|
||||
'assistant.card.roadtrip.corridor.more.few': 'Další {count} výsledky podél trasy',
|
||||
'assistant.card.roadtrip.charging.checked': 'Zkontrolováno v {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Data od {source} pod licencí {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Data od {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Aktualizováno v {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Dalších {count} spojení',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Další {count} spojení',
|
||||
'assistant.card.roadtrip.transit.more.few': 'Další {count} spojení',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} spojení nešlo zobrazit',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} spojení nešlo zobrazit',
|
||||
'assistant.card.roadtrip.transit.dropped.few': '{count} spojení nešla zobrazit',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} průjezdních bodů',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} průjezdní bod',
|
||||
'assistant.card.roadtrip.dayRoute.vias.few': '{count} průjezdní body',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} průjezdních bodů odebráno',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} průjezdní bod odebrán',
|
||||
'assistant.card.roadtrip.dayRoute.removed.few': '{count} průjezdní body odebrány',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} nových zastávek',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} nová zastávka',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.few': '{count} nové zastávky',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} zastávek nešlo umístit',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} zastávku nešlo umístit',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.few': '{count} zastávky nešlo umístit',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Po {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Sleduje {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'Zatím rovné čáry; TREK spočítá silnici, jakmile se změna použije.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Den končí v místě {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Den končí po {percent} % jízdy za místem {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Den opět končí automaticky',
|
||||
'assistant.card.roadtrip.quietDays': '{count} dní bez jízdy',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} den bez jízdy',
|
||||
'assistant.card.roadtrip.quietDays.few': '{count} dny bez jízdy',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} dalších cen',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} další cena',
|
||||
'assistant.card.roadtrip.charging.otherPrices.few': '{count} další ceny',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,92 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Fahrt über einen Punkt führen',
|
||||
'assistant.change.verb.shapeRoute': 'Fahrt formen',
|
||||
'assistant.change.verb.moveRouteVia': 'Wegpunkt verschieben',
|
||||
'assistant.change.verb.removeRouteVia': 'Wegpunkt entfernen',
|
||||
'assistant.change.verb.repinRouteVias': 'Wegpunkte neu zuordnen',
|
||||
'assistant.change.verb.updateDriveSettings': 'Fahreinstellungen ändern',
|
||||
'assistant.change.verb.setDayBoundary': 'Tagesende festlegen',
|
||||
'assistant.change.verb.importRoute': 'Route importieren',
|
||||
'assistant.change.verb.addTransit': 'Verbindung hinzufügen',
|
||||
'assistant.tool.add_route_via': 'Fahrt über einen Punkt führen',
|
||||
'assistant.tool.add_route_vias': 'Fahrt entlang einer Linie formen',
|
||||
'assistant.tool.update_route_via': 'Wegpunkt verschieben',
|
||||
'assistant.tool.remove_route_via': 'Wegpunkt entfernen',
|
||||
'assistant.tool.reanchor_route_vias': 'Wegpunkte eines Tages neu zuordnen',
|
||||
'assistant.tool.update_roadtrip_settings': 'Fahreinstellungen ändern',
|
||||
'assistant.tool.set_day_boundary': 'Festlegen, wo der Tag endet',
|
||||
'assistant.tool.import_google_maps_route': 'Google-Maps-Route importieren',
|
||||
'assistant.tool.preview_google_maps_route': 'Google-Maps-Route lesen',
|
||||
'assistant.tool.create_transit_journey': 'ÖPNV-Verbindung hinzufügen',
|
||||
'assistant.step.roadtrip': 'Berechne die Fahrt',
|
||||
'assistant.step.corridor': 'Suche entlang der Strecke',
|
||||
'assistant.step.charging': 'Prüfe die Ladestation',
|
||||
'assistant.step.transit': 'Suche Verbindungen',
|
||||
'assistant.followUp.chargers': 'Ladestationen unterwegs finden',
|
||||
'assistant.followUp.stays': 'Unterkünfte unterwegs finden',
|
||||
'assistant.followUp.corridorMore': 'Weiter entlang der Strecke suchen',
|
||||
'assistant.followUp.laterTransit': 'Spätere Verbindungen zeigen',
|
||||
'assistant.followUp.addTransit': 'Erste Verbindung zur Reise hinzufügen',
|
||||
'assistant.card.roadtrip.preview': 'Vorschau',
|
||||
'assistant.card.roadtrip.saved': 'Gespeicherte Einstellungen',
|
||||
'assistant.card.roadtrip.variants': 'Varianten der Fahrt',
|
||||
'assistant.card.roadtrip.warnings': '{count} Hinweise',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} Hinweis',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} Ladestopps',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} Ladestopp',
|
||||
'assistant.card.roadtrip.moreDays': '{count} weitere Tage im Roadtrip',
|
||||
'assistant.card.roadtrip.moreDays.one': '{count} weiterer Tag im Roadtrip',
|
||||
'assistant.card.roadtrip.moreStops': '{count} weitere Stopps an diesem Tag',
|
||||
'assistant.card.roadtrip.moreStops.one': '{count} weiterer Stopp an diesem Tag',
|
||||
'assistant.card.roadtrip.undated': '{count} Buchungen liegen auf keinem der Tage',
|
||||
'assistant.card.roadtrip.undated.one': '{count} Buchung liegt auf keinem der Tage',
|
||||
'assistant.card.roadtrip.noDrive': 'Keine Fahrt',
|
||||
'assistant.card.roadtrip.days': 'Tage der Fahrt',
|
||||
'assistant.card.roadtrip.dayWarning': 'An diesem Tag gibt es etwas zu prüfen',
|
||||
'assistant.card.roadtrip.sketch': 'Skizze der Route',
|
||||
'assistant.card.roadtrip.showDrive': 'Fahrt auf der Karte zeigen',
|
||||
'assistant.card.roadtrip.showDay': 'Tag {number} auf der Karte zeigen',
|
||||
'assistant.card.roadtrip.open': 'Im Roadtrip öffnen',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Einige Etappen ließen sich nicht berechnen, die Summen sind also nicht die ganze Fahrt.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Einige Orte haben keine Position, die Fahrt lässt sie deshalb aus.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Die täglichen Reisezeiten lassen sich nicht einhalten, die Tagesenden stehen also noch nicht fest.',
|
||||
'assistant.card.roadtrip.setting.on': 'An',
|
||||
'assistant.card.roadtrip.setting.off': 'Aus',
|
||||
'assistant.card.roadtrip.corridor.none': 'Nichts gefunden im Umkreis von {distance} um die Strecke.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Bisher {done} von {count} Gebieten durchsucht.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Bisher {done} von {count} Gebiet durchsucht.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} weitere Treffer entlang der Strecke',
|
||||
'assistant.card.roadtrip.corridor.more.one': '{count} weiterer Treffer entlang der Strecke',
|
||||
'assistant.card.roadtrip.charging.checked': 'Geprüft um {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Daten von {source} unter {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Daten von {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Aktualisiert um {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} weitere Verbindungen',
|
||||
'assistant.card.roadtrip.transit.more.one': '{count} weitere Verbindung',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} Verbindungen konnten nicht angezeigt werden',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} Verbindung konnte nicht angezeigt werden',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} Wegpunkte',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} Wegpunkt',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} Wegpunkte entfernt',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} Wegpunkt entfernt',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} neue Stopps',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} neuer Stopp',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} Stopps ließen sich nicht verorten',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} Stopp ließ sich nicht verorten',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Nach {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Folgt {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Vorerst gerade Linien; TREK berechnet die Straße, sobald die Änderung übernommen ist.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Der Tag endet bei {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Der Tag endet nach {percent} % der Fahrt ab {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Der Tag endet wieder automatisch',
|
||||
'assistant.card.roadtrip.quietDays': '{count} Tage ohne Fahrt',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} Tag ohne Fahrt',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} weitere Preise',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} weiterer Preis',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,91 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Send the drive through a point',
|
||||
'assistant.change.verb.shapeRoute': 'Shape the drive',
|
||||
'assistant.change.verb.moveRouteVia': 'Move a via point',
|
||||
'assistant.change.verb.removeRouteVia': 'Remove a via point',
|
||||
'assistant.change.verb.repinRouteVias': 'Re-pin via points',
|
||||
'assistant.change.verb.updateDriveSettings': 'Change driving settings',
|
||||
'assistant.change.verb.setDayBoundary': 'Set where a day ends',
|
||||
'assistant.change.verb.importRoute': 'Import a route',
|
||||
'assistant.change.verb.addTransit': 'Add a connection',
|
||||
'assistant.tool.add_route_via': 'Send the drive through a point',
|
||||
'assistant.tool.add_route_vias': 'Shape the drive along a line',
|
||||
'assistant.tool.update_route_via': 'Move a via point',
|
||||
'assistant.tool.remove_route_via': 'Remove a via point',
|
||||
'assistant.tool.reanchor_route_vias': 'Re-pin the via points of a day',
|
||||
'assistant.tool.update_roadtrip_settings': 'Change the driving settings',
|
||||
'assistant.tool.set_day_boundary': 'Set where the day ends',
|
||||
'assistant.tool.import_google_maps_route': 'Import a Google Maps route',
|
||||
'assistant.tool.preview_google_maps_route': 'Read a Google Maps route',
|
||||
'assistant.tool.create_transit_journey': 'Add a public transport connection',
|
||||
'assistant.step.roadtrip': 'Working out the drive',
|
||||
'assistant.step.corridor': 'Searching along the route',
|
||||
'assistant.step.charging': 'Checking the charger',
|
||||
'assistant.step.transit': 'Looking up connections',
|
||||
'assistant.followUp.chargers': 'Find chargers along the way',
|
||||
'assistant.followUp.stays': 'Find places to stay along the way',
|
||||
'assistant.followUp.corridorMore': 'Search further along the route',
|
||||
'assistant.followUp.laterTransit': 'Show later connections',
|
||||
'assistant.followUp.addTransit': 'Add the first connection to the trip',
|
||||
'assistant.card.roadtrip.preview': 'Preview',
|
||||
'assistant.card.roadtrip.saved': 'Saved settings',
|
||||
'assistant.card.roadtrip.variants': 'Ways to drive it',
|
||||
'assistant.card.roadtrip.warnings': '{count} warnings',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} warning',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} charging stops',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} charging stop',
|
||||
'assistant.card.roadtrip.moreDays': '{count} more days in the road trip',
|
||||
'assistant.card.roadtrip.moreDays.one': '{count} more day in the road trip',
|
||||
'assistant.card.roadtrip.moreStops': '{count} more stops on this day',
|
||||
'assistant.card.roadtrip.moreStops.one': '{count} more stop on this day',
|
||||
'assistant.card.roadtrip.undated': '{count} bookings are on none of the days',
|
||||
'assistant.card.roadtrip.undated.one': '{count} booking is on none of the days',
|
||||
'assistant.card.roadtrip.noDrive': 'No drive',
|
||||
'assistant.card.roadtrip.days': 'Days of the drive',
|
||||
'assistant.card.roadtrip.dayWarning': 'Something on this day needs a look',
|
||||
'assistant.card.roadtrip.sketch': 'Sketch of the route',
|
||||
'assistant.card.roadtrip.showDrive': 'Show the drive on the map',
|
||||
'assistant.card.roadtrip.showDay': 'Show day {number} on the map',
|
||||
'assistant.card.roadtrip.open': 'Open in the road trip',
|
||||
'assistant.card.roadtrip.problem.routing': 'Some legs could not be routed, so these totals are not the whole drive.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Some places have no position, so the drive leaves them out.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'The daily travel times cannot be kept, so the day endings are not final.',
|
||||
'assistant.card.roadtrip.setting.on': 'On',
|
||||
'assistant.card.roadtrip.setting.off': 'Off',
|
||||
'assistant.card.roadtrip.corridor.none': 'Nothing found within {distance} of the route.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Searched {done} of {count} areas so far.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Searched {done} of {count} area so far.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} more found along the route',
|
||||
'assistant.card.roadtrip.corridor.more.one': '{count} more found along the route',
|
||||
'assistant.card.roadtrip.charging.checked': 'Checked at {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Data from {source} under {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Data from {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Updated at {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} more connections',
|
||||
'assistant.card.roadtrip.transit.more.one': '{count} more connection',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} connections could not be shown',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} connection could not be shown',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} via points',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} via point',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} via points removed',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} via point removed',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} new stops',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} new stop',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} stops could not be placed',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} stop could not be placed',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'After {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Follows {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Straight lines for now; TREK works out the road once the change is applied.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'The day ends at {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'The day ends {percent} % along the drive after {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'The day ends automatically again',
|
||||
'assistant.card.roadtrip.quietDays': '{count} days without a drive',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} day without a drive',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} other prices',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} other price',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,93 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Hacer pasar el trayecto por un punto',
|
||||
'assistant.change.verb.shapeRoute': 'Dar forma al trayecto',
|
||||
'assistant.change.verb.moveRouteVia': 'Mover un punto de paso',
|
||||
'assistant.change.verb.removeRouteVia': 'Quitar un punto de paso',
|
||||
'assistant.change.verb.repinRouteVias': 'Volver a anclar los puntos de paso',
|
||||
'assistant.change.verb.updateDriveSettings': 'Cambiar los ajustes de conducción',
|
||||
'assistant.change.verb.setDayBoundary': 'Fijar dónde termina un día',
|
||||
'assistant.change.verb.importRoute': 'Importar una ruta',
|
||||
'assistant.change.verb.addTransit': 'Añadir una conexión',
|
||||
'assistant.tool.add_route_via': 'Hacer pasar el trayecto por un punto',
|
||||
'assistant.tool.add_route_vias': 'Dar forma al trayecto a lo largo de una línea',
|
||||
'assistant.tool.update_route_via': 'Mover un punto de paso',
|
||||
'assistant.tool.remove_route_via': 'Quitar un punto de paso',
|
||||
'assistant.tool.reanchor_route_vias': 'Volver a anclar los puntos de paso de un día',
|
||||
'assistant.tool.update_roadtrip_settings': 'Cambiar los ajustes de conducción',
|
||||
'assistant.tool.set_day_boundary': 'Fijar dónde termina el día',
|
||||
'assistant.tool.import_google_maps_route': 'Importar una ruta de Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Leer una ruta de Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Añadir una conexión de transporte público',
|
||||
'assistant.step.roadtrip': 'Calculando el trayecto',
|
||||
'assistant.step.corridor': 'Buscando a lo largo de la ruta',
|
||||
'assistant.step.charging': 'Comprobando el cargador',
|
||||
'assistant.step.transit': 'Buscando conexiones',
|
||||
'assistant.followUp.chargers': 'Buscar cargadores por el camino',
|
||||
'assistant.followUp.stays': 'Buscar alojamiento por el camino',
|
||||
'assistant.followUp.corridorMore': 'Buscar más adelante en la ruta',
|
||||
'assistant.followUp.laterTransit': 'Mostrar conexiones más tarde',
|
||||
'assistant.followUp.addTransit': 'Añadir la primera conexión al viaje',
|
||||
'assistant.card.roadtrip.preview': 'Vista previa',
|
||||
'assistant.card.roadtrip.saved': 'Ajustes guardados',
|
||||
'assistant.card.roadtrip.variants': 'Formas de hacer el trayecto',
|
||||
'assistant.card.roadtrip.warnings': '{count} avisos',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} aviso',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} paradas de carga',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} parada de carga',
|
||||
'assistant.card.roadtrip.moreDays': '{count} días más en el road trip',
|
||||
'assistant.card.roadtrip.moreDays.one': '{count} día más en el road trip',
|
||||
'assistant.card.roadtrip.moreStops': '{count} paradas más este día',
|
||||
'assistant.card.roadtrip.moreStops.one': '{count} parada más este día',
|
||||
'assistant.card.roadtrip.undated': '{count} reservas no caen en ninguno de los días',
|
||||
'assistant.card.roadtrip.undated.one': '{count} reserva no cae en ninguno de los días',
|
||||
'assistant.card.roadtrip.noDrive': 'Sin trayecto',
|
||||
'assistant.card.roadtrip.days': 'Días del trayecto',
|
||||
'assistant.card.roadtrip.dayWarning': 'Hay algo en este día que conviene revisar',
|
||||
'assistant.card.roadtrip.sketch': 'Esbozo de la ruta',
|
||||
'assistant.card.roadtrip.showDrive': 'Mostrar el trayecto en el mapa',
|
||||
'assistant.card.roadtrip.showDay': 'Mostrar el día {number} en el mapa',
|
||||
'assistant.card.roadtrip.open': 'Abrir en el road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Algunos tramos no se pudieron calcular, así que estos totales no son todo el trayecto.',
|
||||
'assistant.card.roadtrip.problem.coordinates':
|
||||
'Algunos lugares no tienen posición, así que el trayecto los deja fuera.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Los horarios diarios no se pueden cumplir, así que los finales de día no son definitivos.',
|
||||
'assistant.card.roadtrip.setting.on': 'Activado',
|
||||
'assistant.card.roadtrip.setting.off': 'Desactivado',
|
||||
'assistant.card.roadtrip.corridor.none': 'No se encontró nada a menos de {distance} de la ruta.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Buscado en {done} de {count} zonas hasta ahora.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Buscado en {done} de {count} zona hasta ahora.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} resultados más a lo largo de la ruta',
|
||||
'assistant.card.roadtrip.corridor.more.one': '{count} resultado más a lo largo de la ruta',
|
||||
'assistant.card.roadtrip.charging.checked': 'Comprobado a las {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Datos de {source} bajo {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Datos de {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Actualizado a las {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} conexiones más',
|
||||
'assistant.card.roadtrip.transit.more.one': '{count} conexión más',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} conexiones no se pudieron mostrar',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} conexión no se pudo mostrar',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} puntos de paso',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} punto de paso',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} puntos de paso quitados',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} punto de paso quitado',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} paradas nuevas',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} parada nueva',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} paradas no se pudieron ubicar',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} parada no se pudo ubicar',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Después de {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Sigue {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Por ahora, líneas rectas; TREK calcula la carretera cuando se aplica el cambio.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'El día termina en {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'El día termina al {percent} % del trayecto después de {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'El día vuelve a terminar automáticamente',
|
||||
'assistant.card.roadtrip.quietDays': '{count} días sin conducir',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} día sin conducir',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} precios más',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} precio más',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,91 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Juhi sõit punkti kaudu',
|
||||
'assistant.change.verb.shapeRoute': 'Kujunda sõitu',
|
||||
'assistant.change.verb.moveRouteVia': 'Liiguta vahepunkti',
|
||||
'assistant.change.verb.removeRouteVia': 'Eemalda vahepunkt',
|
||||
'assistant.change.verb.repinRouteVias': 'Kinnita vahepunktid uuesti',
|
||||
'assistant.change.verb.updateDriveSettings': 'Muuda sõiduseadeid',
|
||||
'assistant.change.verb.setDayBoundary': 'Määra, kus päev lõpeb',
|
||||
'assistant.change.verb.importRoute': 'Impordi marsruut',
|
||||
'assistant.change.verb.addTransit': 'Lisa ühendus',
|
||||
'assistant.tool.add_route_via': 'Juhi sõit punkti kaudu',
|
||||
'assistant.tool.add_route_vias': 'Kujunda sõitu mööda joont',
|
||||
'assistant.tool.update_route_via': 'Liiguta vahepunkti',
|
||||
'assistant.tool.remove_route_via': 'Eemalda vahepunkt',
|
||||
'assistant.tool.reanchor_route_vias': 'Kinnita päeva vahepunktid uuesti',
|
||||
'assistant.tool.update_roadtrip_settings': 'Muuda sõiduseadeid',
|
||||
'assistant.tool.set_day_boundary': 'Määra, kus päev lõpeb',
|
||||
'assistant.tool.import_google_maps_route': 'Impordi Google Mapsi marsruut',
|
||||
'assistant.tool.preview_google_maps_route': 'Loe Google Mapsi marsruuti',
|
||||
'assistant.tool.create_transit_journey': 'Lisa ühistranspordi ühendus',
|
||||
'assistant.step.roadtrip': 'Arvutan sõitu',
|
||||
'assistant.step.corridor': 'Otsin marsruudi äärest',
|
||||
'assistant.step.charging': 'Kontrollin laadijat',
|
||||
'assistant.step.transit': 'Otsin ühendusi',
|
||||
'assistant.followUp.chargers': 'Leia laadijad teel',
|
||||
'assistant.followUp.stays': 'Leia majutus teel',
|
||||
'assistant.followUp.corridorMore': 'Otsi marsruudil edasi',
|
||||
'assistant.followUp.laterTransit': 'Näita hilisemaid ühendusi',
|
||||
'assistant.followUp.addTransit': 'Lisa esimene ühendus reisile',
|
||||
'assistant.card.roadtrip.preview': 'Eelvaade',
|
||||
'assistant.card.roadtrip.saved': 'Salvestatud seaded',
|
||||
'assistant.card.roadtrip.variants': 'Sõiduvõimalused',
|
||||
'assistant.card.roadtrip.warnings': '{count} hoiatust',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} hoiatus',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} laadimispeatust',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} laadimispeatus',
|
||||
'assistant.card.roadtrip.moreDays': 'Veel {count} päeva automatkas',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Veel {count} päev automatkas',
|
||||
'assistant.card.roadtrip.moreStops': 'Veel {count} peatust sel päeval',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Veel {count} peatus sel päeval',
|
||||
'assistant.card.roadtrip.undated': '{count} broneeringut ei ole ühelgi päeval',
|
||||
'assistant.card.roadtrip.undated.one': '{count} broneering ei ole ühelgi päeval',
|
||||
'assistant.card.roadtrip.noDrive': 'Sõitu pole',
|
||||
'assistant.card.roadtrip.days': 'Sõidu päevad',
|
||||
'assistant.card.roadtrip.dayWarning': 'Selle päeva juures on midagi üle vaadata',
|
||||
'assistant.card.roadtrip.sketch': 'Marsruudi visand',
|
||||
'assistant.card.roadtrip.showDrive': 'Näita sõitu kaardil',
|
||||
'assistant.card.roadtrip.showDay': 'Näita päeva {number} kaardil',
|
||||
'assistant.card.roadtrip.open': 'Ava automatkas',
|
||||
'assistant.card.roadtrip.problem.routing': 'Mõnda lõiku ei saanud arvutada, seega pole need summad kogu sõit.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Mõnel kohal pole asukohta, seega jätab sõit need välja.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Igapäevaseid sõiduaegu ei saa pidada, seega pole päevade lõpud lõplikud.',
|
||||
'assistant.card.roadtrip.setting.on': 'Sees',
|
||||
'assistant.card.roadtrip.setting.off': 'Väljas',
|
||||
'assistant.card.roadtrip.corridor.none': 'Marsruudist {distance} raadiuses ei leitud midagi.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Seni otsitud {done} piirkonnas {count}-st.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Seni otsitud {done} piirkonnas {count}-st.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Veel {count} tulemust marsruudi ääres',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Veel {count} tulemus marsruudi ääres',
|
||||
'assistant.card.roadtrip.charging.checked': 'Kontrollitud kell {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Andmed: {source}, litsents {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Andmed: {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Uuendatud kell {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Veel {count} ühendust',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Veel {count} ühendus',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} ühendust ei saanud näidata',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} ühendust ei saanud näidata',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} vahepunkti',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} vahepunkt',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} vahepunkti eemaldatud',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} vahepunkt eemaldatud',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} uut peatust',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} uus peatus',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} peatust ei saanud paigutada',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} peatust ei saanud paigutada',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Pärast kohta {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Järgib rada {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Praegu sirged jooned; TREK arvutab tee välja, kui muudatus on rakendatud.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Päev lõpeb kohas {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Päev lõpeb {percent} % sõidu järel pärast kohta {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Päev lõpeb taas automaatselt',
|
||||
'assistant.card.roadtrip.quietDays': '{count} päeva ilma sõiduta',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} päev ilma sõiduta',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} muud hinda',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} muu hind',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,93 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Faire passer le trajet par un point',
|
||||
'assistant.change.verb.shapeRoute': 'Dessiner le trajet',
|
||||
'assistant.change.verb.moveRouteVia': 'Déplacer un point de passage',
|
||||
'assistant.change.verb.removeRouteVia': 'Retirer un point de passage',
|
||||
'assistant.change.verb.repinRouteVias': 'Réancrer les points de passage',
|
||||
'assistant.change.verb.updateDriveSettings': 'Modifier les réglages de conduite',
|
||||
'assistant.change.verb.setDayBoundary': 'Fixer la fin d’une journée',
|
||||
'assistant.change.verb.importRoute': 'Importer un itinéraire',
|
||||
'assistant.change.verb.addTransit': 'Ajouter une correspondance',
|
||||
'assistant.tool.add_route_via': 'Faire passer le trajet par un point',
|
||||
'assistant.tool.add_route_vias': 'Dessiner le trajet le long d’une ligne',
|
||||
'assistant.tool.update_route_via': 'Déplacer un point de passage',
|
||||
'assistant.tool.remove_route_via': 'Retirer un point de passage',
|
||||
'assistant.tool.reanchor_route_vias': 'Réancrer les points de passage d’une journée',
|
||||
'assistant.tool.update_roadtrip_settings': 'Modifier les réglages de conduite',
|
||||
'assistant.tool.set_day_boundary': 'Fixer où se termine la journée',
|
||||
'assistant.tool.import_google_maps_route': 'Importer un itinéraire Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Lire un itinéraire Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Ajouter une correspondance en transports en commun',
|
||||
'assistant.step.roadtrip': 'Calcul du trajet',
|
||||
'assistant.step.corridor': 'Recherche le long de l’itinéraire',
|
||||
'assistant.step.charging': 'Vérification de la borne',
|
||||
'assistant.step.transit': 'Recherche de correspondances',
|
||||
'assistant.followUp.chargers': 'Trouver des bornes sur le trajet',
|
||||
'assistant.followUp.stays': 'Trouver des hébergements sur le trajet',
|
||||
'assistant.followUp.corridorMore': 'Chercher plus loin sur l’itinéraire',
|
||||
'assistant.followUp.laterTransit': 'Afficher des correspondances plus tardives',
|
||||
'assistant.followUp.addTransit': 'Ajouter la première correspondance au voyage',
|
||||
'assistant.card.roadtrip.preview': 'Aperçu',
|
||||
'assistant.card.roadtrip.saved': 'Réglages enregistrés',
|
||||
'assistant.card.roadtrip.variants': 'Façons de faire le trajet',
|
||||
'assistant.card.roadtrip.warnings': '{count} avertissements',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} avertissement',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} arrêts de recharge',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} arrêt de recharge',
|
||||
'assistant.card.roadtrip.moreDays': '{count} jours de plus dans le road trip',
|
||||
'assistant.card.roadtrip.moreDays.one': '{count} jour de plus dans le road trip',
|
||||
'assistant.card.roadtrip.moreStops': '{count} arrêts de plus ce jour-là',
|
||||
'assistant.card.roadtrip.moreStops.one': '{count} arrêt de plus ce jour-là',
|
||||
'assistant.card.roadtrip.undated': '{count} réservations ne tombent sur aucun des jours',
|
||||
'assistant.card.roadtrip.undated.one': '{count} réservation ne tombe sur aucun des jours',
|
||||
'assistant.card.roadtrip.noDrive': 'Pas de trajet',
|
||||
'assistant.card.roadtrip.days': 'Jours du trajet',
|
||||
'assistant.card.roadtrip.dayWarning': 'Un point de cette journée mérite un coup d’œil',
|
||||
'assistant.card.roadtrip.sketch': 'Croquis de l’itinéraire',
|
||||
'assistant.card.roadtrip.showDrive': 'Afficher le trajet sur la carte',
|
||||
'assistant.card.roadtrip.showDay': 'Afficher le jour {number} sur la carte',
|
||||
'assistant.card.roadtrip.open': 'Ouvrir dans le road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Certaines étapes n’ont pas pu être calculées, ces totaux ne couvrent donc pas tout le trajet.',
|
||||
'assistant.card.roadtrip.problem.coordinates':
|
||||
'Certains lieux n’ont pas de position, le trajet les laisse donc de côté.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Les horaires quotidiens ne peuvent pas être tenus, les fins de journée ne sont donc pas définitives.',
|
||||
'assistant.card.roadtrip.setting.on': 'Activé',
|
||||
'assistant.card.roadtrip.setting.off': 'Désactivé',
|
||||
'assistant.card.roadtrip.corridor.none': 'Rien trouvé à moins de {distance} de l’itinéraire.',
|
||||
'assistant.card.roadtrip.corridor.partial': '{done} zones sur {count} parcourues pour l’instant.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': '{done} zone sur {count} parcourue pour l’instant.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} autres résultats le long de l’itinéraire',
|
||||
'assistant.card.roadtrip.corridor.more.one': '{count} autre résultat le long de l’itinéraire',
|
||||
'assistant.card.roadtrip.charging.checked': 'Vérifié à {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Données de {source} sous {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Données de {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Mis à jour à {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} autres correspondances',
|
||||
'assistant.card.roadtrip.transit.more.one': '{count} autre correspondance',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} correspondances n’ont pas pu être affichées',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} correspondance n’a pas pu être affichée',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} points de passage',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} point de passage',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} points de passage retirés',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} point de passage retiré',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} nouveaux arrêts',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} nouvel arrêt',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} arrêts n’ont pas pu être placés',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} arrêt n’a pas pu être placé',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Après {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Suit {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Lignes droites pour l’instant ; TREK calcule la route une fois la modification appliquée.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'La journée se termine à {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'La journée se termine à {percent} % du trajet après {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'La journée se termine de nouveau automatiquement',
|
||||
'assistant.card.roadtrip.quietDays': '{count} jours sans trajet',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} jour sans trajet',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} autres prix',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} autre prix',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,92 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Πέρασμα της διαδρομής από ένα σημείο',
|
||||
'assistant.change.verb.shapeRoute': 'Διαμόρφωση της διαδρομής',
|
||||
'assistant.change.verb.moveRouteVia': 'Μετακίνηση ενδιάμεσου σημείου',
|
||||
'assistant.change.verb.removeRouteVia': 'Αφαίρεση ενδιάμεσου σημείου',
|
||||
'assistant.change.verb.repinRouteVias': 'Επανασύνδεση ενδιάμεσων σημείων',
|
||||
'assistant.change.verb.updateDriveSettings': 'Αλλαγή ρυθμίσεων οδήγησης',
|
||||
'assistant.change.verb.setDayBoundary': 'Ορισμός του τέλους μιας ημέρας',
|
||||
'assistant.change.verb.importRoute': 'Εισαγωγή διαδρομής',
|
||||
'assistant.change.verb.addTransit': 'Προσθήκη ανταπόκρισης',
|
||||
'assistant.tool.add_route_via': 'Πέρασμα της διαδρομής από ένα σημείο',
|
||||
'assistant.tool.add_route_vias': 'Διαμόρφωση της διαδρομής κατά μήκος μιας γραμμής',
|
||||
'assistant.tool.update_route_via': 'Μετακίνηση ενδιάμεσου σημείου',
|
||||
'assistant.tool.remove_route_via': 'Αφαίρεση ενδιάμεσου σημείου',
|
||||
'assistant.tool.reanchor_route_vias': 'Επανασύνδεση των ενδιάμεσων σημείων μιας ημέρας',
|
||||
'assistant.tool.update_roadtrip_settings': 'Αλλαγή των ρυθμίσεων οδήγησης',
|
||||
'assistant.tool.set_day_boundary': 'Ορισμός του πού τελειώνει η ημέρα',
|
||||
'assistant.tool.import_google_maps_route': 'Εισαγωγή διαδρομής Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Ανάγνωση διαδρομής Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Προσθήκη ανταπόκρισης με δημόσια συγκοινωνία',
|
||||
'assistant.step.roadtrip': 'Υπολογισμός της διαδρομής',
|
||||
'assistant.step.corridor': 'Αναζήτηση κατά μήκος της διαδρομής',
|
||||
'assistant.step.charging': 'Έλεγχος του φορτιστή',
|
||||
'assistant.step.transit': 'Αναζήτηση ανταποκρίσεων',
|
||||
'assistant.followUp.chargers': 'Εύρεση φορτιστών στον δρόμο',
|
||||
'assistant.followUp.stays': 'Εύρεση καταλυμάτων στον δρόμο',
|
||||
'assistant.followUp.corridorMore': 'Αναζήτηση πιο πέρα στη διαδρομή',
|
||||
'assistant.followUp.laterTransit': 'Εμφάνιση μεταγενέστερων ανταποκρίσεων',
|
||||
'assistant.followUp.addTransit': 'Προσθήκη της πρώτης ανταπόκρισης στο ταξίδι',
|
||||
'assistant.card.roadtrip.preview': 'Προεπισκόπηση',
|
||||
'assistant.card.roadtrip.saved': 'Αποθηκευμένες ρυθμίσεις',
|
||||
'assistant.card.roadtrip.variants': 'Τρόποι να γίνει η διαδρομή',
|
||||
'assistant.card.roadtrip.warnings': '{count} προειδοποιήσεις',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} προειδοποίηση',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} στάσεις φόρτισης',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} στάση φόρτισης',
|
||||
'assistant.card.roadtrip.moreDays': 'Ακόμη {count} ημέρες στο road trip',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Ακόμη {count} ημέρα στο road trip',
|
||||
'assistant.card.roadtrip.moreStops': 'Ακόμη {count} στάσεις αυτή την ημέρα',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Ακόμη {count} στάση αυτή την ημέρα',
|
||||
'assistant.card.roadtrip.undated': '{count} κρατήσεις δεν πέφτουν σε καμία από τις ημέρες',
|
||||
'assistant.card.roadtrip.undated.one': '{count} κράτηση δεν πέφτει σε καμία από τις ημέρες',
|
||||
'assistant.card.roadtrip.noDrive': 'Χωρίς οδήγηση',
|
||||
'assistant.card.roadtrip.days': 'Ημέρες της διαδρομής',
|
||||
'assistant.card.roadtrip.dayWarning': 'Κάτι αυτή την ημέρα θέλει έλεγχο',
|
||||
'assistant.card.roadtrip.sketch': 'Σκίτσο της διαδρομής',
|
||||
'assistant.card.roadtrip.showDrive': 'Εμφάνιση της διαδρομής στον χάρτη',
|
||||
'assistant.card.roadtrip.showDay': 'Εμφάνιση της ημέρας {number} στον χάρτη',
|
||||
'assistant.card.roadtrip.open': 'Άνοιγμα στο road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Ορισμένα σκέλη δεν υπολογίστηκαν, οπότε αυτά τα σύνολα δεν είναι όλη η διαδρομή.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Ορισμένα μέρη δεν έχουν θέση, οπότε η διαδρομή τα παραλείπει.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Οι ημερήσιοι χρόνοι ταξιδιού δεν τηρούνται, οπότε τα τέλη των ημερών δεν είναι οριστικά.',
|
||||
'assistant.card.roadtrip.setting.on': 'Ενεργό',
|
||||
'assistant.card.roadtrip.setting.off': 'Ανενεργό',
|
||||
'assistant.card.roadtrip.corridor.none': 'Δεν βρέθηκε τίποτα σε απόσταση {distance} από τη διαδρομή.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Αναζητήθηκαν {done} από {count} περιοχές μέχρι στιγμής.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Αναζητήθηκαν {done} από {count} περιοχή μέχρι στιγμής.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Ακόμη {count} αποτελέσματα κατά μήκος της διαδρομής',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Ακόμη {count} αποτέλεσμα κατά μήκος της διαδρομής',
|
||||
'assistant.card.roadtrip.charging.checked': 'Ελέγχθηκε στις {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Δεδομένα από {source} με άδεια {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Δεδομένα από {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Ενημερώθηκε στις {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Ακόμη {count} ανταποκρίσεις',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Ακόμη {count} ανταπόκριση',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} ανταποκρίσεις δεν μπόρεσαν να εμφανιστούν',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} ανταπόκριση δεν μπόρεσε να εμφανιστεί',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} ενδιάμεσα σημεία',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} ενδιάμεσο σημείο',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} ενδιάμεσα σημεία αφαιρέθηκαν',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} ενδιάμεσο σημείο αφαιρέθηκε',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} νέες στάσεις',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} νέα στάση',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} στάσεις δεν μπόρεσαν να τοποθετηθούν',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} στάση δεν μπόρεσε να τοποθετηθεί',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Μετά από {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Ακολουθεί {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Ευθείες γραμμές προς το παρόν, το TREK υπολογίζει τον δρόμο όταν εφαρμοστεί η αλλαγή.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Η ημέρα τελειώνει στο {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Η ημέρα τελειώνει στο {percent} % της διαδρομής μετά από {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Η ημέρα τελειώνει ξανά αυτόματα',
|
||||
'assistant.card.roadtrip.quietDays': '{count} ημέρες χωρίς οδήγηση',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} ημέρα χωρίς οδήγηση',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} ακόμη τιμές',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} ακόμη τιμή',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,92 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Út vezetése egy ponton át',
|
||||
'assistant.change.verb.shapeRoute': 'Út alakítása',
|
||||
'assistant.change.verb.moveRouteVia': 'Köztes pont áthelyezése',
|
||||
'assistant.change.verb.removeRouteVia': 'Köztes pont törlése',
|
||||
'assistant.change.verb.repinRouteVias': 'Köztes pontok újrarögzítése',
|
||||
'assistant.change.verb.updateDriveSettings': 'Vezetési beállítások módosítása',
|
||||
'assistant.change.verb.setDayBoundary': 'A nap végének megadása',
|
||||
'assistant.change.verb.importRoute': 'Útvonal importálása',
|
||||
'assistant.change.verb.addTransit': 'Csatlakozás hozzáadása',
|
||||
'assistant.tool.add_route_via': 'Út vezetése egy ponton át',
|
||||
'assistant.tool.add_route_vias': 'Út alakítása egy vonal mentén',
|
||||
'assistant.tool.update_route_via': 'Köztes pont áthelyezése',
|
||||
'assistant.tool.remove_route_via': 'Köztes pont törlése',
|
||||
'assistant.tool.reanchor_route_vias': 'Egy nap köztes pontjainak újrarögzítése',
|
||||
'assistant.tool.update_roadtrip_settings': 'Vezetési beállítások módosítása',
|
||||
'assistant.tool.set_day_boundary': 'Annak megadása, hol ér véget a nap',
|
||||
'assistant.tool.import_google_maps_route': 'Google Maps-útvonal importálása',
|
||||
'assistant.tool.preview_google_maps_route': 'Google Maps-útvonal beolvasása',
|
||||
'assistant.tool.create_transit_journey': 'Tömegközlekedési csatlakozás hozzáadása',
|
||||
'assistant.step.roadtrip': 'Az út kiszámítása',
|
||||
'assistant.step.corridor': 'Keresés az útvonal mentén',
|
||||
'assistant.step.charging': 'A töltő ellenőrzése',
|
||||
'assistant.step.transit': 'Csatlakozások keresése',
|
||||
'assistant.followUp.chargers': 'Töltők keresése útközben',
|
||||
'assistant.followUp.stays': 'Szállások keresése útközben',
|
||||
'assistant.followUp.corridorMore': 'Keresés tovább az útvonalon',
|
||||
'assistant.followUp.laterTransit': 'Későbbi csatlakozások mutatása',
|
||||
'assistant.followUp.addTransit': 'Az első csatlakozás hozzáadása az utazáshoz',
|
||||
'assistant.card.roadtrip.preview': 'Előnézet',
|
||||
'assistant.card.roadtrip.saved': 'Mentett beállítások',
|
||||
'assistant.card.roadtrip.variants': 'Az út változatai',
|
||||
'assistant.card.roadtrip.warnings': '{count} figyelmeztetés',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} figyelmeztetés',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} töltési megálló',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} töltési megálló',
|
||||
'assistant.card.roadtrip.moreDays': 'Még {count} nap a road tripben',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Még {count} nap a road tripben',
|
||||
'assistant.card.roadtrip.moreStops': 'Még {count} megálló ezen a napon',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Még {count} megálló ezen a napon',
|
||||
'assistant.card.roadtrip.undated': '{count} foglalás egyik napra sem esik',
|
||||
'assistant.card.roadtrip.undated.one': '{count} foglalás egyik napra sem esik',
|
||||
'assistant.card.roadtrip.noDrive': 'Nincs vezetés',
|
||||
'assistant.card.roadtrip.days': 'Az út napjai',
|
||||
'assistant.card.roadtrip.dayWarning': 'Ezen a napon van valami, amit érdemes megnézni',
|
||||
'assistant.card.roadtrip.sketch': 'Az útvonal vázlata',
|
||||
'assistant.card.roadtrip.showDrive': 'Az út megjelenítése a térképen',
|
||||
'assistant.card.roadtrip.showDay': 'A(z) {number}. nap megjelenítése a térképen',
|
||||
'assistant.card.roadtrip.open': 'Megnyitás a road tripben',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Néhány szakaszt nem sikerült kiszámítani, így ezek az összesítések nem a teljes utat mutatják.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Néhány helynek nincs pozíciója, ezért az út kihagyja őket.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'A napi utazási idők nem tarthatók, ezért a napok vége még nem végleges.',
|
||||
'assistant.card.roadtrip.setting.on': 'Be',
|
||||
'assistant.card.roadtrip.setting.off': 'Ki',
|
||||
'assistant.card.roadtrip.corridor.none': 'Az útvonal {distance} körzetében nincs találat.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Eddig {count} területből {done} átkeresve.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Eddig {count} területből {done} átkeresve.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Még {count} találat az útvonal mentén',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Még {count} találat az útvonal mentén',
|
||||
'assistant.card.roadtrip.charging.checked': 'Ellenőrizve: {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Adatok forrása: {source}, licenc: {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Adatok forrása: {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Frissítve: {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Még {count} csatlakozás',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Még {count} csatlakozás',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} csatlakozást nem sikerült megjeleníteni',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} csatlakozást nem sikerült megjeleníteni',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} köztes pont',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} köztes pont',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} köztes pont törölve',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} köztes pont törölve',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} új megálló',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} új megálló',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} megállót nem sikerült elhelyezni',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} megállót nem sikerült elhelyezni',
|
||||
'assistant.card.roadtrip.dayRoute.after': '{name} után',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Követi: {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Egyelőre egyenes vonalak; a TREK a módosítás alkalmazása után számítja ki az utat.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'A nap itt ér véget: {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'A nap {name} után az út {percent} %-ánál ér véget',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'A nap ismét automatikusan ér véget',
|
||||
'assistant.card.roadtrip.quietDays': '{count} nap vezetés nélkül',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} nap vezetés nélkül',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} további ár',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} további ár',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,77 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Lewatkan perjalanan melalui satu titik',
|
||||
'assistant.change.verb.shapeRoute': 'Bentuk perjalanan',
|
||||
'assistant.change.verb.moveRouteVia': 'Pindahkan titik lintasan',
|
||||
'assistant.change.verb.removeRouteVia': 'Hapus titik lintasan',
|
||||
'assistant.change.verb.repinRouteVias': 'Sematkan ulang titik lintasan',
|
||||
'assistant.change.verb.updateDriveSettings': 'Ubah pengaturan berkendara',
|
||||
'assistant.change.verb.setDayBoundary': 'Tentukan di mana hari berakhir',
|
||||
'assistant.change.verb.importRoute': 'Impor rute',
|
||||
'assistant.change.verb.addTransit': 'Tambahkan koneksi',
|
||||
'assistant.tool.add_route_via': 'Lewatkan perjalanan melalui satu titik',
|
||||
'assistant.tool.add_route_vias': 'Bentuk perjalanan mengikuti garis',
|
||||
'assistant.tool.update_route_via': 'Pindahkan titik lintasan',
|
||||
'assistant.tool.remove_route_via': 'Hapus titik lintasan',
|
||||
'assistant.tool.reanchor_route_vias': 'Sematkan ulang titik lintasan suatu hari',
|
||||
'assistant.tool.update_roadtrip_settings': 'Ubah pengaturan berkendara',
|
||||
'assistant.tool.set_day_boundary': 'Tentukan di mana hari berakhir',
|
||||
'assistant.tool.import_google_maps_route': 'Impor rute Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Baca rute Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Tambahkan koneksi transportasi umum',
|
||||
'assistant.step.roadtrip': 'Menghitung perjalanan',
|
||||
'assistant.step.corridor': 'Mencari di sepanjang rute',
|
||||
'assistant.step.charging': 'Memeriksa stasiun pengisian',
|
||||
'assistant.step.transit': 'Mencari koneksi',
|
||||
'assistant.followUp.chargers': 'Cari stasiun pengisian di jalan',
|
||||
'assistant.followUp.stays': 'Cari penginapan di jalan',
|
||||
'assistant.followUp.corridorMore': 'Cari lebih jauh di sepanjang rute',
|
||||
'assistant.followUp.laterTransit': 'Tampilkan koneksi yang lebih larut',
|
||||
'assistant.followUp.addTransit': 'Tambahkan koneksi pertama ke perjalanan',
|
||||
'assistant.card.roadtrip.preview': 'Pratinjau',
|
||||
'assistant.card.roadtrip.saved': 'Pengaturan tersimpan',
|
||||
'assistant.card.roadtrip.variants': 'Pilihan cara berkendara',
|
||||
'assistant.card.roadtrip.warnings': '{count} peringatan',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} perhentian pengisian daya',
|
||||
'assistant.card.roadtrip.moreDays': '{count} hari lagi di road trip',
|
||||
'assistant.card.roadtrip.moreStops': '{count} perhentian lagi di hari ini',
|
||||
'assistant.card.roadtrip.undated': '{count} pemesanan tidak jatuh di hari mana pun',
|
||||
'assistant.card.roadtrip.noDrive': 'Tanpa berkendara',
|
||||
'assistant.card.roadtrip.days': 'Hari-hari perjalanan',
|
||||
'assistant.card.roadtrip.dayWarning': 'Ada yang perlu dicek di hari ini',
|
||||
'assistant.card.roadtrip.sketch': 'Sketsa rute',
|
||||
'assistant.card.roadtrip.showDrive': 'Tampilkan perjalanan di peta',
|
||||
'assistant.card.roadtrip.showDay': 'Tampilkan hari {number} di peta',
|
||||
'assistant.card.roadtrip.open': 'Buka di road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Beberapa ruas tidak dapat dihitung, jadi total ini bukan seluruh perjalanan.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Beberapa tempat tidak punya posisi, jadi perjalanan melewatkannya.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Waktu perjalanan harian tidak dapat dipenuhi, jadi akhir hari belum pasti.',
|
||||
'assistant.card.roadtrip.setting.on': 'Aktif',
|
||||
'assistant.card.roadtrip.setting.off': 'Nonaktif',
|
||||
'assistant.card.roadtrip.corridor.none': 'Tidak ada yang ditemukan dalam jarak {distance} dari rute.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Sejauh ini {done} dari {count} area sudah dicari.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} hasil lagi di sepanjang rute',
|
||||
'assistant.card.roadtrip.charging.checked': 'Diperiksa pukul {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Data dari {source} dengan lisensi {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Data dari {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Diperbarui pukul {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} koneksi lagi',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} koneksi tidak dapat ditampilkan',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} titik lintasan',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} titik lintasan dihapus',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} perhentian baru',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} perhentian tidak dapat ditempatkan',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Setelah {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Mengikuti {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Untuk sementara garis lurus; TREK menghitung jalannya setelah perubahan diterapkan.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Hari berakhir di {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Hari berakhir pada {percent} % perjalanan setelah {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Hari kembali berakhir otomatis',
|
||||
'assistant.card.roadtrip.quietDays': '{count} hari tanpa berkendara',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} harga lainnya',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,93 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Far passare il percorso da un punto',
|
||||
'assistant.change.verb.shapeRoute': 'Modellare il percorso',
|
||||
'assistant.change.verb.moveRouteVia': 'Spostare un punto di passaggio',
|
||||
'assistant.change.verb.removeRouteVia': 'Rimuovere un punto di passaggio',
|
||||
'assistant.change.verb.repinRouteVias': 'Riancorare i punti di passaggio',
|
||||
'assistant.change.verb.updateDriveSettings': 'Cambiare le impostazioni di guida',
|
||||
'assistant.change.verb.setDayBoundary': 'Stabilire dove finisce un giorno',
|
||||
'assistant.change.verb.importRoute': 'Importare un percorso',
|
||||
'assistant.change.verb.addTransit': 'Aggiungere un collegamento',
|
||||
'assistant.tool.add_route_via': 'Far passare il percorso da un punto',
|
||||
'assistant.tool.add_route_vias': 'Modellare il percorso lungo una linea',
|
||||
'assistant.tool.update_route_via': 'Spostare un punto di passaggio',
|
||||
'assistant.tool.remove_route_via': 'Rimuovere un punto di passaggio',
|
||||
'assistant.tool.reanchor_route_vias': 'Riancorare i punti di passaggio di un giorno',
|
||||
'assistant.tool.update_roadtrip_settings': 'Cambiare le impostazioni di guida',
|
||||
'assistant.tool.set_day_boundary': 'Stabilire dove finisce il giorno',
|
||||
'assistant.tool.import_google_maps_route': 'Importare un percorso di Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Leggere un percorso di Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Aggiungere un collegamento con i mezzi pubblici',
|
||||
'assistant.step.roadtrip': 'Calcolo del percorso',
|
||||
'assistant.step.corridor': 'Ricerca lungo il percorso',
|
||||
'assistant.step.charging': 'Verifica della colonnina',
|
||||
'assistant.step.transit': 'Ricerca dei collegamenti',
|
||||
'assistant.followUp.chargers': 'Trovare colonnine lungo la strada',
|
||||
'assistant.followUp.stays': 'Trovare alloggi lungo la strada',
|
||||
'assistant.followUp.corridorMore': 'Cercare più avanti lungo il percorso',
|
||||
'assistant.followUp.laterTransit': 'Mostrare collegamenti più tardi',
|
||||
'assistant.followUp.addTransit': 'Aggiungere il primo collegamento al viaggio',
|
||||
'assistant.card.roadtrip.preview': 'Anteprima',
|
||||
'assistant.card.roadtrip.saved': 'Impostazioni salvate',
|
||||
'assistant.card.roadtrip.variants': 'Modi di fare il percorso',
|
||||
'assistant.card.roadtrip.warnings': '{count} avvisi',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} avviso',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} soste di ricarica',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} sosta di ricarica',
|
||||
'assistant.card.roadtrip.moreDays': 'Altri {count} giorni nel road trip',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Altro {count} giorno nel road trip',
|
||||
'assistant.card.roadtrip.moreStops': 'Altre {count} soste in questo giorno',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Altra {count} sosta in questo giorno',
|
||||
'assistant.card.roadtrip.undated': '{count} prenotazioni non cadono in nessuno dei giorni',
|
||||
'assistant.card.roadtrip.undated.one': '{count} prenotazione non cade in nessuno dei giorni',
|
||||
'assistant.card.roadtrip.noDrive': 'Nessun tragitto',
|
||||
'assistant.card.roadtrip.days': 'Giorni del percorso',
|
||||
'assistant.card.roadtrip.dayWarning': 'In questo giorno c’è qualcosa da controllare',
|
||||
'assistant.card.roadtrip.sketch': 'Schizzo del percorso',
|
||||
'assistant.card.roadtrip.showDrive': 'Mostrare il percorso sulla mappa',
|
||||
'assistant.card.roadtrip.showDay': 'Mostrare il giorno {number} sulla mappa',
|
||||
'assistant.card.roadtrip.open': 'Aprire nel road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Alcune tappe non sono state calcolate, quindi questi totali non sono l’intero percorso.',
|
||||
'assistant.card.roadtrip.problem.coordinates':
|
||||
'Alcuni luoghi non hanno una posizione, quindi il percorso li esclude.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Gli orari giornalieri non si possono rispettare, quindi le fini dei giorni non sono definitive.',
|
||||
'assistant.card.roadtrip.setting.on': 'Attivo',
|
||||
'assistant.card.roadtrip.setting.off': 'Disattivo',
|
||||
'assistant.card.roadtrip.corridor.none': 'Niente trovato entro {distance} dal percorso.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Cercato in {done} zone su {count} finora.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Cercato in {done} zona su {count} finora.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Altri {count} risultati lungo il percorso',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Altro {count} risultato lungo il percorso',
|
||||
'assistant.card.roadtrip.charging.checked': 'Verificato alle {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Dati di {source} con licenza {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Dati di {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Aggiornato alle {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Altri {count} collegamenti',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Altro {count} collegamento',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} collegamenti non si sono potuti mostrare',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} collegamento non si è potuto mostrare',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} punti di passaggio',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} punto di passaggio',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} punti di passaggio rimossi',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} punto di passaggio rimosso',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} nuove soste',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} nuova sosta',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} soste non si sono potute collocare',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} sosta non si è potuta collocare',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Dopo {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Segue {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Per ora linee rette; TREK calcola la strada quando la modifica viene applicata.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Il giorno finisce a {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Il giorno finisce al {percent} % del tragitto dopo {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Il giorno torna a finire automaticamente',
|
||||
'assistant.card.roadtrip.quietDays': '{count} giorni senza guida',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} giorno senza guida',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} altri prezzi',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} altro prezzo',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,74 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'ルートを地点経由にする',
|
||||
'assistant.change.verb.shapeRoute': 'ルートの形を整える',
|
||||
'assistant.change.verb.moveRouteVia': '経由地点を移動',
|
||||
'assistant.change.verb.removeRouteVia': '経由地点を削除',
|
||||
'assistant.change.verb.repinRouteVias': '経由地点を付け直す',
|
||||
'assistant.change.verb.updateDriveSettings': '運転設定を変更',
|
||||
'assistant.change.verb.setDayBoundary': '一日の終わりを設定',
|
||||
'assistant.change.verb.importRoute': 'ルートを取り込む',
|
||||
'assistant.change.verb.addTransit': '乗り継ぎを追加',
|
||||
'assistant.tool.add_route_via': 'ルートを地点経由にする',
|
||||
'assistant.tool.add_route_vias': '線に沿ってルートの形を整える',
|
||||
'assistant.tool.update_route_via': '経由地点を移動',
|
||||
'assistant.tool.remove_route_via': '経由地点を削除',
|
||||
'assistant.tool.reanchor_route_vias': 'ある日の経由地点を付け直す',
|
||||
'assistant.tool.update_roadtrip_settings': '運転設定を変更',
|
||||
'assistant.tool.set_day_boundary': '一日の終わる場所を設定',
|
||||
'assistant.tool.import_google_maps_route': 'Google マップのルートを取り込む',
|
||||
'assistant.tool.preview_google_maps_route': 'Google マップのルートを読み取る',
|
||||
'assistant.tool.create_transit_journey': '公共交通の乗り継ぎを追加',
|
||||
'assistant.step.roadtrip': 'ルートを計算中',
|
||||
'assistant.step.corridor': 'ルート沿いを検索中',
|
||||
'assistant.step.charging': '充電スポットを確認中',
|
||||
'assistant.step.transit': '乗り継ぎを検索中',
|
||||
'assistant.followUp.chargers': '道中の充電スポットを探す',
|
||||
'assistant.followUp.stays': '道中の宿を探す',
|
||||
'assistant.followUp.corridorMore': 'ルートのさらに先を探す',
|
||||
'assistant.followUp.laterTransit': 'もっと遅い便を表示',
|
||||
'assistant.followUp.addTransit': '最初の便を旅行に追加',
|
||||
'assistant.card.roadtrip.preview': 'プレビュー',
|
||||
'assistant.card.roadtrip.saved': '保存済みの設定',
|
||||
'assistant.card.roadtrip.variants': '走り方の候補',
|
||||
'assistant.card.roadtrip.warnings': '警告 {count} 件',
|
||||
'assistant.card.roadtrip.chargingStops': '充電停車 {count} 回',
|
||||
'assistant.card.roadtrip.moreDays': 'ロードトリップにあと {count} 日',
|
||||
'assistant.card.roadtrip.moreStops': 'この日のほかの停車地 {count} か所',
|
||||
'assistant.card.roadtrip.undated': 'どの日にも入っていない予約が {count} 件',
|
||||
'assistant.card.roadtrip.noDrive': '運転なし',
|
||||
'assistant.card.roadtrip.days': 'ドライブの日程',
|
||||
'assistant.card.roadtrip.dayWarning': 'この日に確認したいことがあります',
|
||||
'assistant.card.roadtrip.sketch': 'ルートの略図',
|
||||
'assistant.card.roadtrip.showDrive': 'ルートを地図に表示',
|
||||
'assistant.card.roadtrip.showDay': '{number} 日目を地図に表示',
|
||||
'assistant.card.roadtrip.open': 'ロードトリップで開く',
|
||||
'assistant.card.roadtrip.problem.routing': '一部の区間を計算できなかったため、この合計はルート全体ではありません。',
|
||||
'assistant.card.roadtrip.problem.coordinates': '位置のない場所があるため、ルートから外れています。',
|
||||
'assistant.card.roadtrip.problem.dayWindow': '一日の移動時間を守れないため、各日の終わりはまだ確定していません。',
|
||||
'assistant.card.roadtrip.setting.on': 'オン',
|
||||
'assistant.card.roadtrip.setting.off': 'オフ',
|
||||
'assistant.card.roadtrip.corridor.none': 'ルートから {distance} 以内には何も見つかりませんでした。',
|
||||
'assistant.card.roadtrip.corridor.partial': 'これまでに {count} 区域中 {done} 区域を検索しました。',
|
||||
'assistant.card.roadtrip.corridor.more': 'ルート沿いの結果がほかに {count} 件',
|
||||
'assistant.card.roadtrip.charging.checked': '{time} に確認',
|
||||
'assistant.card.roadtrip.charging.source': 'データ提供: {source}({license})。',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'データ提供: {source}。',
|
||||
'assistant.card.roadtrip.charging.updated': '{time} に更新。',
|
||||
'assistant.card.roadtrip.transit.more': 'ほかの便 {count} 件',
|
||||
'assistant.card.roadtrip.transit.dropped': '表示できなかった便が {count} 件',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '経由地点 {count} か所',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '経由地点を {count} か所削除',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '新しい停車地 {count} か所',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '配置できなかった停車地が {count} か所',
|
||||
'assistant.card.roadtrip.dayRoute.after': '{name} の後',
|
||||
'assistant.card.roadtrip.dayRoute.follows': '{name} に沿う',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': '今は直線です。変更を適用すると TREK が道路を計算します。',
|
||||
'assistant.card.roadtrip.dayEnd.at': '一日は {name} で終わります',
|
||||
'assistant.card.roadtrip.dayEnd.along': '一日は {name} の後、走行の {percent} % 地点で終わります',
|
||||
'assistant.card.roadtrip.dayEnd.auto': '一日は再び自動で終わります',
|
||||
'assistant.card.roadtrip.quietDays': '運転のない日 {count} 日',
|
||||
'assistant.card.roadtrip.charging.otherPrices': 'ほかの料金 {count} 件',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,74 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': '경로가 한 지점을 지나게 하기',
|
||||
'assistant.change.verb.shapeRoute': '경로 모양 잡기',
|
||||
'assistant.change.verb.moveRouteVia': '경유지 옮기기',
|
||||
'assistant.change.verb.removeRouteVia': '경유지 삭제',
|
||||
'assistant.change.verb.repinRouteVias': '경유지 다시 고정',
|
||||
'assistant.change.verb.updateDriveSettings': '운전 설정 변경',
|
||||
'assistant.change.verb.setDayBoundary': '하루가 끝나는 곳 정하기',
|
||||
'assistant.change.verb.importRoute': '경로 가져오기',
|
||||
'assistant.change.verb.addTransit': '연결편 추가',
|
||||
'assistant.tool.add_route_via': '경로가 한 지점을 지나게 하기',
|
||||
'assistant.tool.add_route_vias': '선을 따라 경로 모양 잡기',
|
||||
'assistant.tool.update_route_via': '경유지 옮기기',
|
||||
'assistant.tool.remove_route_via': '경유지 삭제',
|
||||
'assistant.tool.reanchor_route_vias': '하루의 경유지 다시 고정',
|
||||
'assistant.tool.update_roadtrip_settings': '운전 설정 변경',
|
||||
'assistant.tool.set_day_boundary': '하루가 끝나는 곳 정하기',
|
||||
'assistant.tool.import_google_maps_route': 'Google 지도 경로 가져오기',
|
||||
'assistant.tool.preview_google_maps_route': 'Google 지도 경로 읽기',
|
||||
'assistant.tool.create_transit_journey': '대중교통 연결편 추가',
|
||||
'assistant.step.roadtrip': '경로 계산 중',
|
||||
'assistant.step.corridor': '경로를 따라 검색 중',
|
||||
'assistant.step.charging': '충전소 확인 중',
|
||||
'assistant.step.transit': '연결편 찾는 중',
|
||||
'assistant.followUp.chargers': '가는 길의 충전소 찾기',
|
||||
'assistant.followUp.stays': '가는 길의 숙소 찾기',
|
||||
'assistant.followUp.corridorMore': '경로를 따라 더 멀리 검색',
|
||||
'assistant.followUp.laterTransit': '더 늦은 연결편 보기',
|
||||
'assistant.followUp.addTransit': '첫 번째 연결편을 여행에 추가',
|
||||
'assistant.card.roadtrip.preview': '미리 보기',
|
||||
'assistant.card.roadtrip.saved': '저장된 설정',
|
||||
'assistant.card.roadtrip.variants': '운전 방법 후보',
|
||||
'assistant.card.roadtrip.warnings': '경고 {count}개',
|
||||
'assistant.card.roadtrip.chargingStops': '충전 정차 {count}회',
|
||||
'assistant.card.roadtrip.moreDays': '로드트립에 {count}일 더',
|
||||
'assistant.card.roadtrip.moreStops': '이날 정차지 {count}곳 더',
|
||||
'assistant.card.roadtrip.undated': '어느 날에도 속하지 않는 예약 {count}건',
|
||||
'assistant.card.roadtrip.noDrive': '운전 없음',
|
||||
'assistant.card.roadtrip.days': '운전 일정',
|
||||
'assistant.card.roadtrip.dayWarning': '이날 확인할 것이 있습니다',
|
||||
'assistant.card.roadtrip.sketch': '경로 스케치',
|
||||
'assistant.card.roadtrip.showDrive': '지도에 경로 표시',
|
||||
'assistant.card.roadtrip.showDay': '지도에 {number}일 차 표시',
|
||||
'assistant.card.roadtrip.open': '로드트립에서 열기',
|
||||
'assistant.card.roadtrip.problem.routing': '일부 구간을 계산하지 못해 이 합계는 전체 경로가 아닙니다.',
|
||||
'assistant.card.roadtrip.problem.coordinates': '위치가 없는 장소가 있어 경로에서 빠졌습니다.',
|
||||
'assistant.card.roadtrip.problem.dayWindow': '하루 이동 시간을 지킬 수 없어 하루의 끝이 아직 확정되지 않았습니다.',
|
||||
'assistant.card.roadtrip.setting.on': '켜짐',
|
||||
'assistant.card.roadtrip.setting.off': '꺼짐',
|
||||
'assistant.card.roadtrip.corridor.none': '경로에서 {distance} 이내에 찾은 것이 없습니다.',
|
||||
'assistant.card.roadtrip.corridor.partial': '지금까지 {count}개 구역 중 {done}개를 검색했습니다.',
|
||||
'assistant.card.roadtrip.corridor.more': '경로를 따라 결과 {count}개 더',
|
||||
'assistant.card.roadtrip.charging.checked': '{time}에 확인',
|
||||
'assistant.card.roadtrip.charging.source': '데이터 출처: {source}, 라이선스: {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': '데이터 출처: {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': '{time}에 업데이트됨.',
|
||||
'assistant.card.roadtrip.transit.more': '연결편 {count}개 더',
|
||||
'assistant.card.roadtrip.transit.dropped': '표시하지 못한 연결편 {count}개',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '경유지 {count}곳',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '경유지 {count}곳 삭제됨',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '새 정차지 {count}곳',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '배치하지 못한 정차지 {count}곳',
|
||||
'assistant.card.roadtrip.dayRoute.after': '{name} 다음',
|
||||
'assistant.card.roadtrip.dayRoute.follows': '{name} 따라가기',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': '지금은 직선입니다. 변경을 적용하면 TREK이 도로를 계산합니다.',
|
||||
'assistant.card.roadtrip.dayEnd.at': '하루는 {name}에서 끝납니다',
|
||||
'assistant.card.roadtrip.dayEnd.along': '하루는 {name} 이후 주행의 {percent} % 지점에서 끝납니다',
|
||||
'assistant.card.roadtrip.dayEnd.auto': '하루가 다시 자동으로 끝납니다',
|
||||
'assistant.card.roadtrip.quietDays': '운전 없는 날 {count}일',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '다른 요금 {count}개',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,92 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'De rit via een punt leiden',
|
||||
'assistant.change.verb.shapeRoute': 'De rit vormgeven',
|
||||
'assistant.change.verb.moveRouteVia': 'Een viapunt verplaatsen',
|
||||
'assistant.change.verb.removeRouteVia': 'Een viapunt verwijderen',
|
||||
'assistant.change.verb.repinRouteVias': 'Viapunten opnieuw vastzetten',
|
||||
'assistant.change.verb.updateDriveSettings': 'Rij-instellingen wijzigen',
|
||||
'assistant.change.verb.setDayBoundary': 'Bepalen waar een dag eindigt',
|
||||
'assistant.change.verb.importRoute': 'Een route importeren',
|
||||
'assistant.change.verb.addTransit': 'Een verbinding toevoegen',
|
||||
'assistant.tool.add_route_via': 'De rit via een punt leiden',
|
||||
'assistant.tool.add_route_vias': 'De rit langs een lijn vormgeven',
|
||||
'assistant.tool.update_route_via': 'Een viapunt verplaatsen',
|
||||
'assistant.tool.remove_route_via': 'Een viapunt verwijderen',
|
||||
'assistant.tool.reanchor_route_vias': 'De viapunten van een dag opnieuw vastzetten',
|
||||
'assistant.tool.update_roadtrip_settings': 'De rij-instellingen wijzigen',
|
||||
'assistant.tool.set_day_boundary': 'Bepalen waar de dag eindigt',
|
||||
'assistant.tool.import_google_maps_route': 'Een Google Maps-route importeren',
|
||||
'assistant.tool.preview_google_maps_route': 'Een Google Maps-route lezen',
|
||||
'assistant.tool.create_transit_journey': 'Een ov-verbinding toevoegen',
|
||||
'assistant.step.roadtrip': 'De rit uitrekenen',
|
||||
'assistant.step.corridor': 'Zoeken langs de route',
|
||||
'assistant.step.charging': 'Het laadpunt controleren',
|
||||
'assistant.step.transit': 'Verbindingen opzoeken',
|
||||
'assistant.followUp.chargers': 'Laadpunten onderweg zoeken',
|
||||
'assistant.followUp.stays': 'Overnachtingen onderweg zoeken',
|
||||
'assistant.followUp.corridorMore': 'Verder langs de route zoeken',
|
||||
'assistant.followUp.laterTransit': 'Latere verbindingen tonen',
|
||||
'assistant.followUp.addTransit': 'De eerste verbinding aan de reis toevoegen',
|
||||
'assistant.card.roadtrip.preview': 'Voorbeeld',
|
||||
'assistant.card.roadtrip.saved': 'Opgeslagen instellingen',
|
||||
'assistant.card.roadtrip.variants': 'Manieren om te rijden',
|
||||
'assistant.card.roadtrip.warnings': '{count} waarschuwingen',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} waarschuwing',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} laadstops',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} laadstop',
|
||||
'assistant.card.roadtrip.moreDays': 'Nog {count} dagen in de roadtrip',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Nog {count} dag in de roadtrip',
|
||||
'assistant.card.roadtrip.moreStops': 'Nog {count} stops op deze dag',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Nog {count} stop op deze dag',
|
||||
'assistant.card.roadtrip.undated': '{count} boekingen vallen op geen van de dagen',
|
||||
'assistant.card.roadtrip.undated.one': '{count} boeking valt op geen van de dagen',
|
||||
'assistant.card.roadtrip.noDrive': 'Geen rit',
|
||||
'assistant.card.roadtrip.days': 'Dagen van de rit',
|
||||
'assistant.card.roadtrip.dayWarning': 'Op deze dag valt iets na te kijken',
|
||||
'assistant.card.roadtrip.sketch': 'Schets van de route',
|
||||
'assistant.card.roadtrip.showDrive': 'De rit op de kaart tonen',
|
||||
'assistant.card.roadtrip.showDay': 'Dag {number} op de kaart tonen',
|
||||
'assistant.card.roadtrip.open': 'Openen in de roadtrip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Sommige etappes konden niet worden berekend, dus deze totalen zijn niet de hele rit.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Sommige plaatsen hebben geen positie, dus de rit laat ze weg.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'De dagelijkse reistijden zijn niet haalbaar, dus de einden van de dagen liggen nog niet vast.',
|
||||
'assistant.card.roadtrip.setting.on': 'Aan',
|
||||
'assistant.card.roadtrip.setting.off': 'Uit',
|
||||
'assistant.card.roadtrip.corridor.none': 'Niets gevonden binnen {distance} van de route.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Tot nu toe {done} van {count} gebieden doorzocht.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Tot nu toe {done} van {count} gebied doorzocht.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Nog {count} resultaten langs de route',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Nog {count} resultaat langs de route',
|
||||
'assistant.card.roadtrip.charging.checked': 'Gecontroleerd om {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Gegevens van {source} onder {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Gegevens van {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Bijgewerkt om {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Nog {count} verbindingen',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Nog {count} verbinding',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} verbindingen konden niet worden getoond',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} verbinding kon niet worden getoond',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} viapunten',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} viapunt',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} viapunten verwijderd',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} viapunt verwijderd',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} nieuwe stops',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} nieuwe stop',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} stops konden niet worden geplaatst',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} stop kon niet worden geplaatst',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Na {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Volgt {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Voorlopig rechte lijnen; TREK berekent de weg zodra de wijziging is toegepast.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'De dag eindigt bij {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'De dag eindigt op {percent} % van de rit na {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'De dag eindigt weer automatisch',
|
||||
'assistant.card.roadtrip.quietDays': '{count} dagen zonder rit',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} dag zonder rit',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} andere prijzen',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} andere prijs',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,121 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Poprowadź trasę przez punkt',
|
||||
'assistant.change.verb.shapeRoute': 'Ukształtuj przejazd',
|
||||
'assistant.change.verb.moveRouteVia': 'Przesuń punkt pośredni',
|
||||
'assistant.change.verb.removeRouteVia': 'Usuń punkt pośredni',
|
||||
'assistant.change.verb.repinRouteVias': 'Ponownie przypnij punkty pośrednie',
|
||||
'assistant.change.verb.updateDriveSettings': 'Zmień ustawienia jazdy',
|
||||
'assistant.change.verb.setDayBoundary': 'Ustal, gdzie kończy się dzień',
|
||||
'assistant.change.verb.importRoute': 'Importuj trasę',
|
||||
'assistant.change.verb.addTransit': 'Dodaj połączenie',
|
||||
'assistant.tool.add_route_via': 'Poprowadź trasę przez punkt',
|
||||
'assistant.tool.add_route_vias': 'Ukształtuj przejazd wzdłuż linii',
|
||||
'assistant.tool.update_route_via': 'Przesuń punkt pośredni',
|
||||
'assistant.tool.remove_route_via': 'Usuń punkt pośredni',
|
||||
'assistant.tool.reanchor_route_vias': 'Ponownie przypnij punkty pośrednie dnia',
|
||||
'assistant.tool.update_roadtrip_settings': 'Zmień ustawienia jazdy',
|
||||
'assistant.tool.set_day_boundary': 'Ustal, gdzie kończy się dzień',
|
||||
'assistant.tool.import_google_maps_route': 'Importuj trasę z Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Odczytaj trasę z Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Dodaj połączenie komunikacją publiczną',
|
||||
'assistant.step.roadtrip': 'Obliczam przejazd',
|
||||
'assistant.step.corridor': 'Szukam wzdłuż trasy',
|
||||
'assistant.step.charging': 'Sprawdzam ładowarkę',
|
||||
'assistant.step.transit': 'Szukam połączeń',
|
||||
'assistant.followUp.chargers': 'Znajdź ładowarki po drodze',
|
||||
'assistant.followUp.stays': 'Znajdź noclegi po drodze',
|
||||
'assistant.followUp.corridorMore': 'Szukaj dalej wzdłuż trasy',
|
||||
'assistant.followUp.laterTransit': 'Pokaż późniejsze połączenia',
|
||||
'assistant.followUp.addTransit': 'Dodaj pierwsze połączenie do podróży',
|
||||
'assistant.card.roadtrip.preview': 'Podgląd',
|
||||
'assistant.card.roadtrip.saved': 'Zapisane ustawienia',
|
||||
'assistant.card.roadtrip.variants': 'Warianty przejazdu',
|
||||
'assistant.card.roadtrip.warnings': '{count} ostrzeżenia',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} ostrzeżenie',
|
||||
'assistant.card.roadtrip.warnings.few': '{count} ostrzeżenia',
|
||||
'assistant.card.roadtrip.warnings.many': '{count} ostrzeżeń',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} postoju na ładowanie',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} postój na ładowanie',
|
||||
'assistant.card.roadtrip.chargingStops.few': '{count} postoje na ładowanie',
|
||||
'assistant.card.roadtrip.chargingStops.many': '{count} postojów na ładowanie',
|
||||
'assistant.card.roadtrip.moreDays': 'Jeszcze {count} dnia w road tripie',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Jeszcze {count} dzień w road tripie',
|
||||
'assistant.card.roadtrip.moreDays.few': 'Jeszcze {count} dni w road tripie',
|
||||
'assistant.card.roadtrip.moreDays.many': 'Jeszcze {count} dni w road tripie',
|
||||
'assistant.card.roadtrip.moreStops': 'Jeszcze {count} przystanku tego dnia',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Jeszcze {count} przystanek tego dnia',
|
||||
'assistant.card.roadtrip.moreStops.few': 'Jeszcze {count} przystanki tego dnia',
|
||||
'assistant.card.roadtrip.moreStops.many': 'Jeszcze {count} przystanków tego dnia',
|
||||
'assistant.card.roadtrip.undated': '{count} rezerwacji nie przypada na żaden dzień',
|
||||
'assistant.card.roadtrip.undated.one': '{count} rezerwacja nie przypada na żaden dzień',
|
||||
'assistant.card.roadtrip.undated.few': '{count} rezerwacje nie przypadają na żaden dzień',
|
||||
'assistant.card.roadtrip.undated.many': '{count} rezerwacji nie przypada na żaden dzień',
|
||||
'assistant.card.roadtrip.noDrive': 'Bez jazdy',
|
||||
'assistant.card.roadtrip.days': 'Dni przejazdu',
|
||||
'assistant.card.roadtrip.dayWarning': 'Tego dnia jest coś do sprawdzenia',
|
||||
'assistant.card.roadtrip.sketch': 'Szkic trasy',
|
||||
'assistant.card.roadtrip.showDrive': 'Pokaż przejazd na mapie',
|
||||
'assistant.card.roadtrip.showDay': 'Pokaż dzień {number} na mapie',
|
||||
'assistant.card.roadtrip.open': 'Otwórz w road tripie',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Niektórych odcinków nie udało się wyznaczyć, więc te sumy nie obejmują całego przejazdu.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Niektóre miejsca nie mają położenia, więc przejazd je pomija.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Dziennych godzin podróży nie da się dotrzymać, więc końce dni nie są ostateczne.',
|
||||
'assistant.card.roadtrip.setting.on': 'Włączone',
|
||||
'assistant.card.roadtrip.setting.off': 'Wyłączone',
|
||||
'assistant.card.roadtrip.corridor.none': 'Nic nie znaleziono w promieniu {distance} od trasy.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Dotąd przeszukano {done} z {count} obszaru.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Dotąd przeszukano {done} z {count} obszaru.',
|
||||
'assistant.card.roadtrip.corridor.partial.few': 'Dotąd przeszukano {done} z {count} obszarów.',
|
||||
'assistant.card.roadtrip.corridor.partial.many': 'Dotąd przeszukano {done} z {count} obszarów.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Jeszcze {count} wyniku wzdłuż trasy',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Jeszcze {count} wynik wzdłuż trasy',
|
||||
'assistant.card.roadtrip.corridor.more.few': 'Jeszcze {count} wyniki wzdłuż trasy',
|
||||
'assistant.card.roadtrip.corridor.more.many': 'Jeszcze {count} wyników wzdłuż trasy',
|
||||
'assistant.card.roadtrip.charging.checked': 'Sprawdzono o {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Dane od {source} na licencji {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Dane od {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Zaktualizowano o {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Jeszcze {count} połączenia',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Jeszcze {count} połączenie',
|
||||
'assistant.card.roadtrip.transit.more.few': 'Jeszcze {count} połączenia',
|
||||
'assistant.card.roadtrip.transit.more.many': 'Jeszcze {count} połączeń',
|
||||
'assistant.card.roadtrip.transit.dropped': 'Nie udało się pokazać {count} połączenia',
|
||||
'assistant.card.roadtrip.transit.dropped.one': 'Nie udało się pokazać {count} połączenia',
|
||||
'assistant.card.roadtrip.transit.dropped.few': 'Nie udało się pokazać {count} połączeń',
|
||||
'assistant.card.roadtrip.transit.dropped.many': 'Nie udało się pokazać {count} połączeń',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} punktu pośredniego',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} punkt pośredni',
|
||||
'assistant.card.roadtrip.dayRoute.vias.few': '{count} punkty pośrednie',
|
||||
'assistant.card.roadtrip.dayRoute.vias.many': '{count} punktów pośrednich',
|
||||
'assistant.card.roadtrip.dayRoute.removed': 'Usunięto {count} punktu pośredniego',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': 'Usunięto {count} punkt pośredni',
|
||||
'assistant.card.roadtrip.dayRoute.removed.few': 'Usunięto {count} punkty pośrednie',
|
||||
'assistant.card.roadtrip.dayRoute.removed.many': 'Usunięto {count} punktów pośrednich',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} nowego przystanku',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} nowy przystanek',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.few': '{count} nowe przystanki',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.many': '{count} nowych przystanków',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': 'Nie udało się umieścić {count} przystanku',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': 'Nie udało się umieścić {count} przystanku',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.few': 'Nie udało się umieścić {count} przystanków',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.many': 'Nie udało się umieścić {count} przystanków',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Po {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Podąża za {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'Na razie proste linie; TREK wyznaczy drogę po zastosowaniu zmiany.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Dzień kończy się w {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Dzień kończy się po {percent} % przejazdu za {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Dzień znów kończy się automatycznie',
|
||||
'assistant.card.roadtrip.quietDays': '{count} dnia bez jazdy',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} dzień bez jazdy',
|
||||
'assistant.card.roadtrip.quietDays.few': '{count} dni bez jazdy',
|
||||
'assistant.card.roadtrip.quietDays.many': '{count} dni bez jazdy',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} innej ceny',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} inna cena',
|
||||
'assistant.card.roadtrip.charging.otherPrices.few': '{count} inne ceny',
|
||||
'assistant.card.roadtrip.charging.otherPrices.many': '{count} innych cen',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,122 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Провести маршрут через точку',
|
||||
'assistant.change.verb.shapeRoute': 'Задать форму маршрута',
|
||||
'assistant.change.verb.moveRouteVia': 'Переместить промежуточную точку',
|
||||
'assistant.change.verb.removeRouteVia': 'Удалить промежуточную точку',
|
||||
'assistant.change.verb.repinRouteVias': 'Заново привязать промежуточные точки',
|
||||
'assistant.change.verb.updateDriveSettings': 'Изменить настройки поездки',
|
||||
'assistant.change.verb.setDayBoundary': 'Задать, где заканчивается день',
|
||||
'assistant.change.verb.importRoute': 'Импортировать маршрут',
|
||||
'assistant.change.verb.addTransit': 'Добавить пересадку',
|
||||
'assistant.tool.add_route_via': 'Провести маршрут через точку',
|
||||
'assistant.tool.add_route_vias': 'Задать форму маршрута вдоль линии',
|
||||
'assistant.tool.update_route_via': 'Переместить промежуточную точку',
|
||||
'assistant.tool.remove_route_via': 'Удалить промежуточную точку',
|
||||
'assistant.tool.reanchor_route_vias': 'Заново привязать промежуточные точки дня',
|
||||
'assistant.tool.update_roadtrip_settings': 'Изменить настройки поездки',
|
||||
'assistant.tool.set_day_boundary': 'Задать, где заканчивается день',
|
||||
'assistant.tool.import_google_maps_route': 'Импортировать маршрут из Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Прочитать маршрут из Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Добавить поездку на общественном транспорте',
|
||||
'assistant.step.roadtrip': 'Рассчитываю поездку',
|
||||
'assistant.step.corridor': 'Ищу вдоль маршрута',
|
||||
'assistant.step.charging': 'Проверяю зарядную станцию',
|
||||
'assistant.step.transit': 'Ищу варианты проезда',
|
||||
'assistant.followUp.chargers': 'Найти зарядки по пути',
|
||||
'assistant.followUp.stays': 'Найти жильё по пути',
|
||||
'assistant.followUp.corridorMore': 'Искать дальше вдоль маршрута',
|
||||
'assistant.followUp.laterTransit': 'Показать более поздние варианты',
|
||||
'assistant.followUp.addTransit': 'Добавить первый вариант в поездку',
|
||||
'assistant.card.roadtrip.preview': 'Предпросмотр',
|
||||
'assistant.card.roadtrip.saved': 'Сохранённые настройки',
|
||||
'assistant.card.roadtrip.variants': 'Варианты поездки',
|
||||
'assistant.card.roadtrip.warnings': '{count} предупреждения',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} предупреждение',
|
||||
'assistant.card.roadtrip.warnings.few': '{count} предупреждения',
|
||||
'assistant.card.roadtrip.warnings.many': '{count} предупреждений',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} остановки для зарядки',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} остановка для зарядки',
|
||||
'assistant.card.roadtrip.chargingStops.few': '{count} остановки для зарядки',
|
||||
'assistant.card.roadtrip.chargingStops.many': '{count} остановок для зарядки',
|
||||
'assistant.card.roadtrip.moreDays': 'Ещё {count} дня в автопутешествии',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Ещё {count} день в автопутешествии',
|
||||
'assistant.card.roadtrip.moreDays.few': 'Ещё {count} дня в автопутешествии',
|
||||
'assistant.card.roadtrip.moreDays.many': 'Ещё {count} дней в автопутешествии',
|
||||
'assistant.card.roadtrip.moreStops': 'Ещё {count} остановки в этот день',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Ещё {count} остановка в этот день',
|
||||
'assistant.card.roadtrip.moreStops.few': 'Ещё {count} остановки в этот день',
|
||||
'assistant.card.roadtrip.moreStops.many': 'Ещё {count} остановок в этот день',
|
||||
'assistant.card.roadtrip.undated': '{count} брони не приходятся ни на один день',
|
||||
'assistant.card.roadtrip.undated.one': '{count} бронь не приходится ни на один день',
|
||||
'assistant.card.roadtrip.undated.few': '{count} брони не приходятся ни на один день',
|
||||
'assistant.card.roadtrip.undated.many': '{count} броней не приходятся ни на один день',
|
||||
'assistant.card.roadtrip.noDrive': 'Без поездки',
|
||||
'assistant.card.roadtrip.days': 'Дни поездки',
|
||||
'assistant.card.roadtrip.dayWarning': 'В этот день есть что проверить',
|
||||
'assistant.card.roadtrip.sketch': 'Набросок маршрута',
|
||||
'assistant.card.roadtrip.showDrive': 'Показать поездку на карте',
|
||||
'assistant.card.roadtrip.showDay': 'Показать день {number} на карте',
|
||||
'assistant.card.roadtrip.open': 'Открыть в автопутешествии',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Некоторые участки не удалось рассчитать, поэтому эти итоги не охватывают всю поездку.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'У некоторых мест нет координат, поэтому поездка их пропускает.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Дневное время в пути выдержать не удаётся, поэтому концы дней не окончательные.',
|
||||
'assistant.card.roadtrip.setting.on': 'Вкл.',
|
||||
'assistant.card.roadtrip.setting.off': 'Выкл.',
|
||||
'assistant.card.roadtrip.corridor.none': 'В пределах {distance} от маршрута ничего не найдено.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Пока проверено {done} из {count} участков.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Пока проверено {done} из {count} участка.',
|
||||
'assistant.card.roadtrip.corridor.partial.few': 'Пока проверено {done} из {count} участков.',
|
||||
'assistant.card.roadtrip.corridor.partial.many': 'Пока проверено {done} из {count} участков.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Ещё {count} результата вдоль маршрута',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Ещё {count} результат вдоль маршрута',
|
||||
'assistant.card.roadtrip.corridor.more.few': 'Ещё {count} результата вдоль маршрута',
|
||||
'assistant.card.roadtrip.corridor.more.many': 'Ещё {count} результатов вдоль маршрута',
|
||||
'assistant.card.roadtrip.charging.checked': 'Проверено в {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Данные: {source}, лицензия {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Данные: {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Обновлено в {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Ещё {count} варианта',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Ещё {count} вариант',
|
||||
'assistant.card.roadtrip.transit.more.few': 'Ещё {count} варианта',
|
||||
'assistant.card.roadtrip.transit.more.many': 'Ещё {count} вариантов',
|
||||
'assistant.card.roadtrip.transit.dropped': 'Не удалось показать {count} варианта',
|
||||
'assistant.card.roadtrip.transit.dropped.one': 'Не удалось показать {count} вариант',
|
||||
'assistant.card.roadtrip.transit.dropped.few': 'Не удалось показать {count} варианта',
|
||||
'assistant.card.roadtrip.transit.dropped.many': 'Не удалось показать {count} вариантов',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} промежуточной точки',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} промежуточная точка',
|
||||
'assistant.card.roadtrip.dayRoute.vias.few': '{count} промежуточные точки',
|
||||
'assistant.card.roadtrip.dayRoute.vias.many': '{count} промежуточных точек',
|
||||
'assistant.card.roadtrip.dayRoute.removed': 'Удалено {count} промежуточной точки',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': 'Удалена {count} промежуточная точка',
|
||||
'assistant.card.roadtrip.dayRoute.removed.few': 'Удалены {count} промежуточные точки',
|
||||
'assistant.card.roadtrip.dayRoute.removed.many': 'Удалено {count} промежуточных точек',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} новой остановки',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} новая остановка',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.few': '{count} новые остановки',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.many': '{count} новых остановок',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': 'Не удалось разместить {count} остановки',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': 'Не удалось разместить {count} остановку',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.few': 'Не удалось разместить {count} остановки',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.many': 'Не удалось разместить {count} остановок',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'После {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Следует треку {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Пока прямые линии; TREK рассчитает дорогу, когда изменение будет применено.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'День заканчивается в {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'День заканчивается на {percent} % пути после {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'День снова заканчивается автоматически',
|
||||
'assistant.card.roadtrip.quietDays': '{count} дня без поездок',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} день без поездок',
|
||||
'assistant.card.roadtrip.quietDays.few': '{count} дня без поездок',
|
||||
'assistant.card.roadtrip.quietDays.many': '{count} дней без поездок',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} другой цены',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} другая цена',
|
||||
'assistant.card.roadtrip.charging.otherPrices.few': '{count} другие цены',
|
||||
'assistant.card.roadtrip.charging.otherPrices.many': '{count} других цен',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,106 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Viesť jazdu cez bod',
|
||||
'assistant.change.verb.shapeRoute': 'Tvarovať jazdu',
|
||||
'assistant.change.verb.moveRouteVia': 'Presunúť prejazdný bod',
|
||||
'assistant.change.verb.removeRouteVia': 'Odobrať prejazdný bod',
|
||||
'assistant.change.verb.repinRouteVias': 'Znova ukotviť prejazdné body',
|
||||
'assistant.change.verb.updateDriveSettings': 'Zmeniť nastavenia jazdy',
|
||||
'assistant.change.verb.setDayBoundary': 'Určiť, kde deň končí',
|
||||
'assistant.change.verb.importRoute': 'Importovať trasu',
|
||||
'assistant.change.verb.addTransit': 'Pridať spojenie',
|
||||
'assistant.tool.add_route_via': 'Viesť jazdu cez bod',
|
||||
'assistant.tool.add_route_vias': 'Tvarovať jazdu pozdĺž čiary',
|
||||
'assistant.tool.update_route_via': 'Presunúť prejazdný bod',
|
||||
'assistant.tool.remove_route_via': 'Odobrať prejazdný bod',
|
||||
'assistant.tool.reanchor_route_vias': 'Znova ukotviť prejazdné body dňa',
|
||||
'assistant.tool.update_roadtrip_settings': 'Zmeniť nastavenia jazdy',
|
||||
'assistant.tool.set_day_boundary': 'Určiť, kde deň končí',
|
||||
'assistant.tool.import_google_maps_route': 'Importovať trasu z Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Načítať trasu z Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Pridať spojenie verejnou dopravou',
|
||||
'assistant.step.roadtrip': 'Počítam jazdu',
|
||||
'assistant.step.corridor': 'Hľadám pozdĺž trasy',
|
||||
'assistant.step.charging': 'Kontrolujem nabíjačku',
|
||||
'assistant.step.transit': 'Vyhľadávam spojenia',
|
||||
'assistant.followUp.chargers': 'Nájsť nabíjačky po ceste',
|
||||
'assistant.followUp.stays': 'Nájsť ubytovanie po ceste',
|
||||
'assistant.followUp.corridorMore': 'Hľadať ďalej pozdĺž trasy',
|
||||
'assistant.followUp.laterTransit': 'Ukázať neskoršie spojenia',
|
||||
'assistant.followUp.addTransit': 'Pridať prvé spojenie do cesty',
|
||||
'assistant.card.roadtrip.preview': 'Náhľad',
|
||||
'assistant.card.roadtrip.saved': 'Uložené nastavenia',
|
||||
'assistant.card.roadtrip.variants': 'Varianty jazdy',
|
||||
'assistant.card.roadtrip.warnings': '{count} upozornení',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} upozornenie',
|
||||
'assistant.card.roadtrip.warnings.few': '{count} upozornenia',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} zastávok na nabíjanie',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} zastávka na nabíjanie',
|
||||
'assistant.card.roadtrip.chargingStops.few': '{count} zastávky na nabíjanie',
|
||||
'assistant.card.roadtrip.moreDays': 'Ďalších {count} dní v road tripe',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Ďalší {count} deň v road tripe',
|
||||
'assistant.card.roadtrip.moreDays.few': 'Ďalšie {count} dni v road tripe',
|
||||
'assistant.card.roadtrip.moreStops': 'Ďalších {count} zastávok v tento deň',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Ďalšia {count} zastávka v tento deň',
|
||||
'assistant.card.roadtrip.moreStops.few': 'Ďalšie {count} zastávky v tento deň',
|
||||
'assistant.card.roadtrip.undated': '{count} rezervácií nepripadá na žiadny deň',
|
||||
'assistant.card.roadtrip.undated.one': '{count} rezervácia nepripadá na žiadny deň',
|
||||
'assistant.card.roadtrip.undated.few': '{count} rezervácie nepripadajú na žiadny deň',
|
||||
'assistant.card.roadtrip.noDrive': 'Bez jazdy',
|
||||
'assistant.card.roadtrip.days': 'Dni jazdy',
|
||||
'assistant.card.roadtrip.dayWarning': 'V tento deň je niečo na kontrolu',
|
||||
'assistant.card.roadtrip.sketch': 'Náčrt trasy',
|
||||
'assistant.card.roadtrip.showDrive': 'Ukázať jazdu na mape',
|
||||
'assistant.card.roadtrip.showDay': 'Ukázať deň {number} na mape',
|
||||
'assistant.card.roadtrip.open': 'Otvoriť v road tripe',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Niektoré úseky sa nepodarilo vypočítať, takže tieto súčty nie sú celá jazda.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Niektoré miesta nemajú polohu, takže ich jazda vynecháva.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Denné časy cestovania sa nedajú dodržať, takže konce dní nie sú konečné.',
|
||||
'assistant.card.roadtrip.setting.on': 'Zapnuté',
|
||||
'assistant.card.roadtrip.setting.off': 'Vypnuté',
|
||||
'assistant.card.roadtrip.corridor.none': 'Do vzdialenosti {distance} od trasy sa nič nenašlo.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Zatiaľ prehľadaných {done} z {count} oblastí.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Zatiaľ prehľadaných {done} z {count} oblasti.',
|
||||
'assistant.card.roadtrip.corridor.partial.few': 'Zatiaľ prehľadaných {done} z {count} oblastí.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Ďalších {count} výsledkov pozdĺž trasy',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Ďalší {count} výsledok pozdĺž trasy',
|
||||
'assistant.card.roadtrip.corridor.more.few': 'Ďalšie {count} výsledky pozdĺž trasy',
|
||||
'assistant.card.roadtrip.charging.checked': 'Skontrolované o {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Údaje od {source} pod licenciou {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Údaje od {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Aktualizované o {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Ďalších {count} spojení',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Ďalšie {count} spojenie',
|
||||
'assistant.card.roadtrip.transit.more.few': 'Ďalšie {count} spojenia',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} spojení sa nepodarilo zobraziť',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} spojenie sa nepodarilo zobraziť',
|
||||
'assistant.card.roadtrip.transit.dropped.few': '{count} spojenia sa nepodarilo zobraziť',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} prejazdných bodov',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} prejazdný bod',
|
||||
'assistant.card.roadtrip.dayRoute.vias.few': '{count} prejazdné body',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} prejazdných bodov odobraných',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} prejazdný bod odobraný',
|
||||
'assistant.card.roadtrip.dayRoute.removed.few': '{count} prejazdné body odobrané',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} nových zastávok',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} nová zastávka',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.few': '{count} nové zastávky',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} zastávok sa nepodarilo umiestniť',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} zastávku sa nepodarilo umiestniť',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.few': '{count} zastávky sa nepodarilo umiestniť',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Po {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Sleduje {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'Zatiaľ rovné čiary; TREK vypočíta cestu, keď sa zmena použije.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Deň končí v mieste {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Deň končí po {percent} % jazdy za miestom {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Deň opäť končí automaticky',
|
||||
'assistant.card.roadtrip.quietDays': '{count} dní bez jazdy',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} deň bez jazdy',
|
||||
'assistant.card.roadtrip.quietDays.few': '{count} dni bez jazdy',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} ďalších cien',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} ďalšia cena',
|
||||
'assistant.card.roadtrip.charging.otherPrices.few': '{count} ďalšie ceny',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,91 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Led resan via en punkt',
|
||||
'assistant.change.verb.shapeRoute': 'Forma resan',
|
||||
'assistant.change.verb.moveRouteVia': 'Flytta en viapunkt',
|
||||
'assistant.change.verb.removeRouteVia': 'Ta bort en viapunkt',
|
||||
'assistant.change.verb.repinRouteVias': 'Fäst viapunkterna på nytt',
|
||||
'assistant.change.verb.updateDriveSettings': 'Ändra körinställningar',
|
||||
'assistant.change.verb.setDayBoundary': 'Bestäm var en dag slutar',
|
||||
'assistant.change.verb.importRoute': 'Importera en rutt',
|
||||
'assistant.change.verb.addTransit': 'Lägg till en förbindelse',
|
||||
'assistant.tool.add_route_via': 'Led resan via en punkt',
|
||||
'assistant.tool.add_route_vias': 'Forma resan längs en linje',
|
||||
'assistant.tool.update_route_via': 'Flytta en viapunkt',
|
||||
'assistant.tool.remove_route_via': 'Ta bort en viapunkt',
|
||||
'assistant.tool.reanchor_route_vias': 'Fäst en dags viapunkter på nytt',
|
||||
'assistant.tool.update_roadtrip_settings': 'Ändra körinställningarna',
|
||||
'assistant.tool.set_day_boundary': 'Bestäm var dagen slutar',
|
||||
'assistant.tool.import_google_maps_route': 'Importera en Google Maps-rutt',
|
||||
'assistant.tool.preview_google_maps_route': 'Läs en Google Maps-rutt',
|
||||
'assistant.tool.create_transit_journey': 'Lägg till en kollektivtrafikförbindelse',
|
||||
'assistant.step.roadtrip': 'Räknar ut resan',
|
||||
'assistant.step.corridor': 'Söker längs rutten',
|
||||
'assistant.step.charging': 'Kollar laddstationen',
|
||||
'assistant.step.transit': 'Söker förbindelser',
|
||||
'assistant.followUp.chargers': 'Hitta laddstationer på vägen',
|
||||
'assistant.followUp.stays': 'Hitta boenden på vägen',
|
||||
'assistant.followUp.corridorMore': 'Sök längre fram längs rutten',
|
||||
'assistant.followUp.laterTransit': 'Visa senare förbindelser',
|
||||
'assistant.followUp.addTransit': 'Lägg till den första förbindelsen i resan',
|
||||
'assistant.card.roadtrip.preview': 'Förhandsvisning',
|
||||
'assistant.card.roadtrip.saved': 'Sparade inställningar',
|
||||
'assistant.card.roadtrip.variants': 'Sätt att köra den',
|
||||
'assistant.card.roadtrip.warnings': '{count} varningar',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} varning',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} laddstopp',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} laddstopp',
|
||||
'assistant.card.roadtrip.moreDays': '{count} dagar till i roadtripen',
|
||||
'assistant.card.roadtrip.moreDays.one': '{count} dag till i roadtripen',
|
||||
'assistant.card.roadtrip.moreStops': '{count} stopp till den här dagen',
|
||||
'assistant.card.roadtrip.moreStops.one': '{count} stopp till den här dagen',
|
||||
'assistant.card.roadtrip.undated': '{count} bokningar ligger inte på någon av dagarna',
|
||||
'assistant.card.roadtrip.undated.one': '{count} bokning ligger inte på någon av dagarna',
|
||||
'assistant.card.roadtrip.noDrive': 'Ingen körning',
|
||||
'assistant.card.roadtrip.days': 'Resans dagar',
|
||||
'assistant.card.roadtrip.dayWarning': 'Något den här dagen behöver ses över',
|
||||
'assistant.card.roadtrip.sketch': 'Skiss av rutten',
|
||||
'assistant.card.roadtrip.showDrive': 'Visa resan på kartan',
|
||||
'assistant.card.roadtrip.showDay': 'Visa dag {number} på kartan',
|
||||
'assistant.card.roadtrip.open': 'Öppna i roadtripen',
|
||||
'assistant.card.roadtrip.problem.routing': 'Vissa etapper kunde inte beräknas, så summorna gäller inte hela resan.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Vissa platser saknar position, så resan hoppar över dem.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'De dagliga restiderna går inte att hålla, så dagarnas slut är inte slutgiltiga.',
|
||||
'assistant.card.roadtrip.setting.on': 'På',
|
||||
'assistant.card.roadtrip.setting.off': 'Av',
|
||||
'assistant.card.roadtrip.corridor.none': 'Inget hittades inom {distance} från rutten.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Sökt i {done} av {count} områden hittills.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Sökt i {done} av {count} område hittills.',
|
||||
'assistant.card.roadtrip.corridor.more': '{count} träffar till längs rutten',
|
||||
'assistant.card.roadtrip.corridor.more.one': '{count} träff till längs rutten',
|
||||
'assistant.card.roadtrip.charging.checked': 'Kollad kl. {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Data från {source} under {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Data från {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Uppdaterad kl. {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} förbindelser till',
|
||||
'assistant.card.roadtrip.transit.more.one': '{count} förbindelse till',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} förbindelser kunde inte visas',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} förbindelse kunde inte visas',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} viapunkter',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} viapunkt',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} viapunkter borttagna',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} viapunkt borttagen',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} nya stopp',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} nytt stopp',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} stopp kunde inte placeras',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} stopp kunde inte placeras',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Efter {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Följer {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch':
|
||||
'Raka linjer tills vidare; TREK räknar ut vägen när ändringen har tillämpats.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Dagen slutar vid {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Dagen slutar efter {percent} % av körningen från {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Dagen slutar automatiskt igen',
|
||||
'assistant.card.roadtrip.quietDays': '{count} dagar utan körning',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} dag utan körning',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} andra priser',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} annat pris',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,75 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'ให้เส้นทางผ่านจุดหนึ่ง',
|
||||
'assistant.change.verb.shapeRoute': 'ปรับรูปเส้นทาง',
|
||||
'assistant.change.verb.moveRouteVia': 'ย้ายจุดผ่าน',
|
||||
'assistant.change.verb.removeRouteVia': 'ลบจุดผ่าน',
|
||||
'assistant.change.verb.repinRouteVias': 'ตรึงจุดผ่านใหม่',
|
||||
'assistant.change.verb.updateDriveSettings': 'เปลี่ยนการตั้งค่าการขับ',
|
||||
'assistant.change.verb.setDayBoundary': 'กำหนดว่าวันสิ้นสุดที่ใด',
|
||||
'assistant.change.verb.importRoute': 'นำเข้าเส้นทาง',
|
||||
'assistant.change.verb.addTransit': 'เพิ่มการเดินทางต่อ',
|
||||
'assistant.tool.add_route_via': 'ให้เส้นทางผ่านจุดหนึ่ง',
|
||||
'assistant.tool.add_route_vias': 'ปรับรูปเส้นทางตามแนวเส้น',
|
||||
'assistant.tool.update_route_via': 'ย้ายจุดผ่าน',
|
||||
'assistant.tool.remove_route_via': 'ลบจุดผ่าน',
|
||||
'assistant.tool.reanchor_route_vias': 'ตรึงจุดผ่านของวันหนึ่งใหม่',
|
||||
'assistant.tool.update_roadtrip_settings': 'เปลี่ยนการตั้งค่าการขับ',
|
||||
'assistant.tool.set_day_boundary': 'กำหนดว่าวันสิ้นสุดที่ใด',
|
||||
'assistant.tool.import_google_maps_route': 'นำเข้าเส้นทางจาก Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'อ่านเส้นทางจาก Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'เพิ่มการเดินทางด้วยขนส่งสาธารณะ',
|
||||
'assistant.step.roadtrip': 'กำลังคำนวณการขับ',
|
||||
'assistant.step.corridor': 'กำลังค้นหาตามเส้นทาง',
|
||||
'assistant.step.charging': 'กำลังตรวจสอบสถานีชาร์จ',
|
||||
'assistant.step.transit': 'กำลังค้นหาการเดินทาง',
|
||||
'assistant.followUp.chargers': 'หาสถานีชาร์จระหว่างทาง',
|
||||
'assistant.followUp.stays': 'หาที่พักระหว่างทาง',
|
||||
'assistant.followUp.corridorMore': 'ค้นหาต่อไปตามเส้นทาง',
|
||||
'assistant.followUp.laterTransit': 'แสดงเที่ยวที่ช้ากว่านี้',
|
||||
'assistant.followUp.addTransit': 'เพิ่มเที่ยวแรกลงในทริป',
|
||||
'assistant.card.roadtrip.preview': 'ตัวอย่าง',
|
||||
'assistant.card.roadtrip.saved': 'การตั้งค่าที่บันทึกไว้',
|
||||
'assistant.card.roadtrip.variants': 'ทางเลือกในการขับ',
|
||||
'assistant.card.roadtrip.warnings': 'คำเตือน {count} รายการ',
|
||||
'assistant.card.roadtrip.chargingStops': 'แวะชาร์จ {count} ครั้ง',
|
||||
'assistant.card.roadtrip.moreDays': 'อีก {count} วันในโรดทริป',
|
||||
'assistant.card.roadtrip.moreStops': 'อีก {count} จุดแวะในวันนี้',
|
||||
'assistant.card.roadtrip.undated': 'การจอง {count} รายการไม่ตรงกับวันใดเลย',
|
||||
'assistant.card.roadtrip.noDrive': 'ไม่มีการขับ',
|
||||
'assistant.card.roadtrip.days': 'วันต่าง ๆ ของการขับ',
|
||||
'assistant.card.roadtrip.dayWarning': 'วันนี้มีบางอย่างที่ควรตรวจดู',
|
||||
'assistant.card.roadtrip.sketch': 'ภาพร่างเส้นทาง',
|
||||
'assistant.card.roadtrip.showDrive': 'แสดงการขับบนแผนที่',
|
||||
'assistant.card.roadtrip.showDay': 'แสดงวันที่ {number} บนแผนที่',
|
||||
'assistant.card.roadtrip.open': 'เปิดในโรดทริป',
|
||||
'assistant.card.roadtrip.problem.routing': 'คำนวณบางช่วงไม่ได้ ยอดรวมนี้จึงไม่ใช่ทั้งการขับ',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'บางสถานที่ไม่มีตำแหน่ง การขับจึงข้ามไป',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'ไม่สามารถรักษาเวลาเดินทางรายวันได้ จุดสิ้นสุดของแต่ละวันจึงยังไม่แน่นอน',
|
||||
'assistant.card.roadtrip.setting.on': 'เปิด',
|
||||
'assistant.card.roadtrip.setting.off': 'ปิด',
|
||||
'assistant.card.roadtrip.corridor.none': 'ไม่พบสิ่งใดภายในระยะ {distance} จากเส้นทาง',
|
||||
'assistant.card.roadtrip.corridor.partial': 'ค้นหาแล้ว {done} จาก {count} พื้นที่',
|
||||
'assistant.card.roadtrip.corridor.more': 'อีก {count} ผลลัพธ์ตามเส้นทาง',
|
||||
'assistant.card.roadtrip.charging.checked': 'ตรวจสอบเมื่อ {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'ข้อมูลจาก {source} ภายใต้สัญญาอนุญาต {license}',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'ข้อมูลจาก {source}',
|
||||
'assistant.card.roadtrip.charging.updated': 'อัปเดตเมื่อ {time}',
|
||||
'assistant.card.roadtrip.transit.more': 'อีก {count} เที่ยว',
|
||||
'assistant.card.roadtrip.transit.dropped': 'แสดงไม่ได้ {count} เที่ยว',
|
||||
'assistant.card.roadtrip.dayRoute.vias': 'จุดผ่าน {count} จุด',
|
||||
'assistant.card.roadtrip.dayRoute.removed': 'ลบจุดผ่านแล้ว {count} จุด',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': 'จุดแวะใหม่ {count} จุด',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': 'วางจุดแวะไม่ได้ {count} จุด',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'หลัง {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'ตามแนว {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'ตอนนี้เป็นเส้นตรงก่อน TREK จะคำนวณถนนเมื่อใช้การเปลี่ยนแปลงแล้ว',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'วันสิ้นสุดที่ {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'วันสิ้นสุดที่ {percent} % ของการขับหลัง {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'วันกลับมาสิ้นสุดโดยอัตโนมัติ',
|
||||
'assistant.card.roadtrip.quietDays': 'วันที่ไม่ได้ขับรถ {count} วัน',
|
||||
'assistant.card.roadtrip.charging.otherPrices': 'ราคาอื่น {count} รายการ',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,90 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Sürüşü bir noktadan geçir',
|
||||
'assistant.change.verb.shapeRoute': 'Sürüşü şekillendir',
|
||||
'assistant.change.verb.moveRouteVia': 'Ara noktayı taşı',
|
||||
'assistant.change.verb.removeRouteVia': 'Ara noktayı kaldır',
|
||||
'assistant.change.verb.repinRouteVias': 'Ara noktaları yeniden sabitle',
|
||||
'assistant.change.verb.updateDriveSettings': 'Sürüş ayarlarını değiştir',
|
||||
'assistant.change.verb.setDayBoundary': 'Günün nerede biteceğini belirle',
|
||||
'assistant.change.verb.importRoute': 'Rota içe aktar',
|
||||
'assistant.change.verb.addTransit': 'Bağlantı ekle',
|
||||
'assistant.tool.add_route_via': 'Sürüşü bir noktadan geçir',
|
||||
'assistant.tool.add_route_vias': 'Sürüşü bir çizgi boyunca şekillendir',
|
||||
'assistant.tool.update_route_via': 'Ara noktayı taşı',
|
||||
'assistant.tool.remove_route_via': 'Ara noktayı kaldır',
|
||||
'assistant.tool.reanchor_route_vias': 'Bir günün ara noktalarını yeniden sabitle',
|
||||
'assistant.tool.update_roadtrip_settings': 'Sürüş ayarlarını değiştir',
|
||||
'assistant.tool.set_day_boundary': 'Günün nerede biteceğini belirle',
|
||||
'assistant.tool.import_google_maps_route': 'Google Maps rotasını içe aktar',
|
||||
'assistant.tool.preview_google_maps_route': 'Google Maps rotasını oku',
|
||||
'assistant.tool.create_transit_journey': 'Toplu taşıma bağlantısı ekle',
|
||||
'assistant.step.roadtrip': 'Sürüş hesaplanıyor',
|
||||
'assistant.step.corridor': 'Rota boyunca aranıyor',
|
||||
'assistant.step.charging': 'Şarj istasyonu kontrol ediliyor',
|
||||
'assistant.step.transit': 'Bağlantılar aranıyor',
|
||||
'assistant.followUp.chargers': 'Yol üzerindeki şarj istasyonlarını bul',
|
||||
'assistant.followUp.stays': 'Yol üzerinde konaklama bul',
|
||||
'assistant.followUp.corridorMore': 'Rotada daha ileride ara',
|
||||
'assistant.followUp.laterTransit': 'Daha sonraki bağlantıları göster',
|
||||
'assistant.followUp.addTransit': 'İlk bağlantıyı geziye ekle',
|
||||
'assistant.card.roadtrip.preview': 'Önizleme',
|
||||
'assistant.card.roadtrip.saved': 'Kayıtlı ayarlar',
|
||||
'assistant.card.roadtrip.variants': 'Sürüş seçenekleri',
|
||||
'assistant.card.roadtrip.warnings': '{count} uyarı',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} uyarı',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} şarj molası',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} şarj molası',
|
||||
'assistant.card.roadtrip.moreDays': 'Yol gezisinde {count} gün daha',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Yol gezisinde {count} gün daha',
|
||||
'assistant.card.roadtrip.moreStops': 'Bu günde {count} durak daha',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Bu günde {count} durak daha',
|
||||
'assistant.card.roadtrip.undated': '{count} rezervasyon hiçbir güne denk gelmiyor',
|
||||
'assistant.card.roadtrip.undated.one': '{count} rezervasyon hiçbir güne denk gelmiyor',
|
||||
'assistant.card.roadtrip.noDrive': 'Sürüş yok',
|
||||
'assistant.card.roadtrip.days': 'Sürüşün günleri',
|
||||
'assistant.card.roadtrip.dayWarning': 'Bu günde göz atılması gereken bir şey var',
|
||||
'assistant.card.roadtrip.sketch': 'Rotanın taslağı',
|
||||
'assistant.card.roadtrip.showDrive': 'Sürüşü haritada göster',
|
||||
'assistant.card.roadtrip.showDay': '{number}. günü haritada göster',
|
||||
'assistant.card.roadtrip.open': 'Yol gezisinde aç',
|
||||
'assistant.card.roadtrip.problem.routing': 'Bazı etaplar hesaplanamadı, bu yüzden bu toplamlar sürüşün tamamı değil.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Bazı yerlerin konumu yok, bu yüzden sürüş onları dışarıda bırakıyor.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Günlük seyahat süreleri tutturulamıyor, bu yüzden gün sonları kesin değil.',
|
||||
'assistant.card.roadtrip.setting.on': 'Açık',
|
||||
'assistant.card.roadtrip.setting.off': 'Kapalı',
|
||||
'assistant.card.roadtrip.corridor.none': 'Rotanın {distance} yakınında bir şey bulunamadı.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Şimdiye kadar {count} alanın {done} tanesi arandı.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Şimdiye kadar {count} alanın {done} tanesi arandı.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Rota boyunca {count} sonuç daha',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Rota boyunca {count} sonuç daha',
|
||||
'assistant.card.roadtrip.charging.checked': 'Kontrol saati: {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Veriler: {source}, lisans: {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Veriler: {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Güncelleme saati: {time}.',
|
||||
'assistant.card.roadtrip.transit.more': '{count} bağlantı daha',
|
||||
'assistant.card.roadtrip.transit.more.one': '{count} bağlantı daha',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} bağlantı gösterilemedi',
|
||||
'assistant.card.roadtrip.transit.dropped.one': '{count} bağlantı gösterilemedi',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} ara nokta',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} ara nokta',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '{count} ara nokta kaldırıldı',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': '{count} ara nokta kaldırıldı',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} yeni durak',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} yeni durak',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} durak yerleştirilemedi',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': '{count} durak yerleştirilemedi',
|
||||
'assistant.card.roadtrip.dayRoute.after': '{name} sonrası',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'İzlediği iz: {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'Şimdilik düz çizgiler; değişiklik uygulandığında TREK yolu hesaplar.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Gün şurada biter: {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Gün, {name} sonrasında sürüşün % {percent} noktasında biter',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Gün yeniden otomatik olarak biter',
|
||||
'assistant.card.roadtrip.quietDays': 'Sürüşsüz {count} gün',
|
||||
'assistant.card.roadtrip.quietDays.one': 'Sürüşsüz {count} gün',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} diğer fiyat',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} diğer fiyat',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,121 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Провести маршрут через точку',
|
||||
'assistant.change.verb.shapeRoute': 'Задати форму маршруту',
|
||||
'assistant.change.verb.moveRouteVia': 'Перемістити проміжну точку',
|
||||
'assistant.change.verb.removeRouteVia': 'Видалити проміжну точку',
|
||||
'assistant.change.verb.repinRouteVias': 'Знову прив’язати проміжні точки',
|
||||
'assistant.change.verb.updateDriveSettings': 'Змінити налаштування поїздки',
|
||||
'assistant.change.verb.setDayBoundary': 'Задати, де закінчується день',
|
||||
'assistant.change.verb.importRoute': 'Імпортувати маршрут',
|
||||
'assistant.change.verb.addTransit': 'Додати сполучення',
|
||||
'assistant.tool.add_route_via': 'Провести маршрут через точку',
|
||||
'assistant.tool.add_route_vias': 'Задати форму маршруту вздовж лінії',
|
||||
'assistant.tool.update_route_via': 'Перемістити проміжну точку',
|
||||
'assistant.tool.remove_route_via': 'Видалити проміжну точку',
|
||||
'assistant.tool.reanchor_route_vias': 'Знову прив’язати проміжні точки дня',
|
||||
'assistant.tool.update_roadtrip_settings': 'Змінити налаштування поїздки',
|
||||
'assistant.tool.set_day_boundary': 'Задати, де закінчується день',
|
||||
'assistant.tool.import_google_maps_route': 'Імпортувати маршрут із Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Прочитати маршрут із Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Додати сполучення громадським транспортом',
|
||||
'assistant.step.roadtrip': 'Розраховую поїздку',
|
||||
'assistant.step.corridor': 'Шукаю вздовж маршруту',
|
||||
'assistant.step.charging': 'Перевіряю зарядну станцію',
|
||||
'assistant.step.transit': 'Шукаю сполучення',
|
||||
'assistant.followUp.chargers': 'Знайти зарядки дорогою',
|
||||
'assistant.followUp.stays': 'Знайти житло дорогою',
|
||||
'assistant.followUp.corridorMore': 'Шукати далі вздовж маршруту',
|
||||
'assistant.followUp.laterTransit': 'Показати пізніші сполучення',
|
||||
'assistant.followUp.addTransit': 'Додати перше сполучення до подорожі',
|
||||
'assistant.card.roadtrip.preview': 'Попередній перегляд',
|
||||
'assistant.card.roadtrip.saved': 'Збережені налаштування',
|
||||
'assistant.card.roadtrip.variants': 'Варіанти поїздки',
|
||||
'assistant.card.roadtrip.warnings': '{count} попередження',
|
||||
'assistant.card.roadtrip.warnings.one': '{count} попередження',
|
||||
'assistant.card.roadtrip.warnings.few': '{count} попередження',
|
||||
'assistant.card.roadtrip.warnings.many': '{count} попереджень',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} зупинки для заряджання',
|
||||
'assistant.card.roadtrip.chargingStops.one': '{count} зупинка для заряджання',
|
||||
'assistant.card.roadtrip.chargingStops.few': '{count} зупинки для заряджання',
|
||||
'assistant.card.roadtrip.chargingStops.many': '{count} зупинок для заряджання',
|
||||
'assistant.card.roadtrip.moreDays': 'Ще {count} дня в автоподорожі',
|
||||
'assistant.card.roadtrip.moreDays.one': 'Ще {count} день в автоподорожі',
|
||||
'assistant.card.roadtrip.moreDays.few': 'Ще {count} дні в автоподорожі',
|
||||
'assistant.card.roadtrip.moreDays.many': 'Ще {count} днів в автоподорожі',
|
||||
'assistant.card.roadtrip.moreStops': 'Ще {count} зупинки цього дня',
|
||||
'assistant.card.roadtrip.moreStops.one': 'Ще {count} зупинка цього дня',
|
||||
'assistant.card.roadtrip.moreStops.few': 'Ще {count} зупинки цього дня',
|
||||
'assistant.card.roadtrip.moreStops.many': 'Ще {count} зупинок цього дня',
|
||||
'assistant.card.roadtrip.undated': '{count} бронювання не припадають на жоден день',
|
||||
'assistant.card.roadtrip.undated.one': '{count} бронювання не припадає на жоден день',
|
||||
'assistant.card.roadtrip.undated.few': '{count} бронювання не припадають на жоден день',
|
||||
'assistant.card.roadtrip.undated.many': '{count} бронювань не припадають на жоден день',
|
||||
'assistant.card.roadtrip.noDrive': 'Без поїздки',
|
||||
'assistant.card.roadtrip.days': 'Дні поїздки',
|
||||
'assistant.card.roadtrip.dayWarning': 'Цього дня є що перевірити',
|
||||
'assistant.card.roadtrip.sketch': 'Ескіз маршруту',
|
||||
'assistant.card.roadtrip.showDrive': 'Показати поїздку на мапі',
|
||||
'assistant.card.roadtrip.showDay': 'Показати день {number} на мапі',
|
||||
'assistant.card.roadtrip.open': 'Відкрити в автоподорожі',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Деякі ділянки не вдалося розрахувати, тож ці підсумки не охоплюють усієї поїздки.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Деякі місця не мають координат, тож поїздка їх пропускає.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Денний час у дорозі витримати не вдається, тож кінці днів не остаточні.',
|
||||
'assistant.card.roadtrip.setting.on': 'Увімк.',
|
||||
'assistant.card.roadtrip.setting.off': 'Вимк.',
|
||||
'assistant.card.roadtrip.corridor.none': 'У межах {distance} від маршруту нічого не знайдено.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Поки перевірено {done} з {count} ділянок.',
|
||||
'assistant.card.roadtrip.corridor.partial.one': 'Поки перевірено {done} з {count} ділянки.',
|
||||
'assistant.card.roadtrip.corridor.partial.few': 'Поки перевірено {done} з {count} ділянок.',
|
||||
'assistant.card.roadtrip.corridor.partial.many': 'Поки перевірено {done} з {count} ділянок.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Ще {count} результату вздовж маршруту',
|
||||
'assistant.card.roadtrip.corridor.more.one': 'Ще {count} результат уздовж маршруту',
|
||||
'assistant.card.roadtrip.corridor.more.few': 'Ще {count} результати вздовж маршруту',
|
||||
'assistant.card.roadtrip.corridor.more.many': 'Ще {count} результатів уздовж маршруту',
|
||||
'assistant.card.roadtrip.charging.checked': 'Перевірено о {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Дані: {source}, ліцензія {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Дані: {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Оновлено о {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Ще {count} сполучення',
|
||||
'assistant.card.roadtrip.transit.more.one': 'Ще {count} сполучення',
|
||||
'assistant.card.roadtrip.transit.more.few': 'Ще {count} сполучення',
|
||||
'assistant.card.roadtrip.transit.more.many': 'Ще {count} сполучень',
|
||||
'assistant.card.roadtrip.transit.dropped': 'Не вдалося показати {count} сполучення',
|
||||
'assistant.card.roadtrip.transit.dropped.one': 'Не вдалося показати {count} сполучення',
|
||||
'assistant.card.roadtrip.transit.dropped.few': 'Не вдалося показати {count} сполучення',
|
||||
'assistant.card.roadtrip.transit.dropped.many': 'Не вдалося показати {count} сполучень',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} проміжної точки',
|
||||
'assistant.card.roadtrip.dayRoute.vias.one': '{count} проміжна точка',
|
||||
'assistant.card.roadtrip.dayRoute.vias.few': '{count} проміжні точки',
|
||||
'assistant.card.roadtrip.dayRoute.vias.many': '{count} проміжних точок',
|
||||
'assistant.card.roadtrip.dayRoute.removed': 'Видалено {count} проміжної точки',
|
||||
'assistant.card.roadtrip.dayRoute.removed.one': 'Видалено {count} проміжну точку',
|
||||
'assistant.card.roadtrip.dayRoute.removed.few': 'Видалено {count} проміжні точки',
|
||||
'assistant.card.roadtrip.dayRoute.removed.many': 'Видалено {count} проміжних точок',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} нової зупинки',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.one': '{count} нова зупинка',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.few': '{count} нові зупинки',
|
||||
'assistant.card.roadtrip.dayRoute.newStops.many': '{count} нових зупинок',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': 'Не вдалося розмістити {count} зупинки',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.one': 'Не вдалося розмістити {count} зупинку',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.few': 'Не вдалося розмістити {count} зупинки',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved.many': 'Не вдалося розмістити {count} зупинок',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Після {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Слідує треку {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'Поки прямі лінії; TREK розрахує дорогу, коли зміну буде застосовано.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'День закінчується в {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'День закінчується на {percent} % шляху після {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'День знову закінчується автоматично',
|
||||
'assistant.card.roadtrip.quietDays': '{count} дня без поїздок',
|
||||
'assistant.card.roadtrip.quietDays.one': '{count} день без поїздок',
|
||||
'assistant.card.roadtrip.quietDays.few': '{count} дні без поїздок',
|
||||
'assistant.card.roadtrip.quietDays.many': '{count} днів без поїздок',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} іншої ціни',
|
||||
'assistant.card.roadtrip.charging.otherPrices.one': '{count} інша ціна',
|
||||
'assistant.card.roadtrip.charging.otherPrices.few': '{count} інші ціни',
|
||||
'assistant.card.roadtrip.charging.otherPrices.many': '{count} інших цін',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,76 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': 'Cho lộ trình đi qua một điểm',
|
||||
'assistant.change.verb.shapeRoute': 'Định hình lộ trình',
|
||||
'assistant.change.verb.moveRouteVia': 'Di chuyển điểm đi qua',
|
||||
'assistant.change.verb.removeRouteVia': 'Xóa điểm đi qua',
|
||||
'assistant.change.verb.repinRouteVias': 'Ghim lại các điểm đi qua',
|
||||
'assistant.change.verb.updateDriveSettings': 'Đổi cài đặt lái xe',
|
||||
'assistant.change.verb.setDayBoundary': 'Đặt nơi một ngày kết thúc',
|
||||
'assistant.change.verb.importRoute': 'Nhập lộ trình',
|
||||
'assistant.change.verb.addTransit': 'Thêm chuyến nối',
|
||||
'assistant.tool.add_route_via': 'Cho lộ trình đi qua một điểm',
|
||||
'assistant.tool.add_route_vias': 'Định hình lộ trình theo một đường',
|
||||
'assistant.tool.update_route_via': 'Di chuyển điểm đi qua',
|
||||
'assistant.tool.remove_route_via': 'Xóa điểm đi qua',
|
||||
'assistant.tool.reanchor_route_vias': 'Ghim lại các điểm đi qua của một ngày',
|
||||
'assistant.tool.update_roadtrip_settings': 'Đổi cài đặt lái xe',
|
||||
'assistant.tool.set_day_boundary': 'Đặt nơi ngày kết thúc',
|
||||
'assistant.tool.import_google_maps_route': 'Nhập lộ trình Google Maps',
|
||||
'assistant.tool.preview_google_maps_route': 'Đọc lộ trình Google Maps',
|
||||
'assistant.tool.create_transit_journey': 'Thêm chuyến đi bằng phương tiện công cộng',
|
||||
'assistant.step.roadtrip': 'Đang tính lộ trình',
|
||||
'assistant.step.corridor': 'Đang tìm dọc tuyến đường',
|
||||
'assistant.step.charging': 'Đang kiểm tra trạm sạc',
|
||||
'assistant.step.transit': 'Đang tìm chuyến nối',
|
||||
'assistant.followUp.chargers': 'Tìm trạm sạc dọc đường',
|
||||
'assistant.followUp.stays': 'Tìm chỗ nghỉ dọc đường',
|
||||
'assistant.followUp.corridorMore': 'Tìm xa hơn dọc tuyến đường',
|
||||
'assistant.followUp.laterTransit': 'Hiện các chuyến muộn hơn',
|
||||
'assistant.followUp.addTransit': 'Thêm chuyến đầu tiên vào chuyến đi',
|
||||
'assistant.card.roadtrip.preview': 'Xem trước',
|
||||
'assistant.card.roadtrip.saved': 'Cài đặt đã lưu',
|
||||
'assistant.card.roadtrip.variants': 'Các cách lái',
|
||||
'assistant.card.roadtrip.warnings': '{count} cảnh báo',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} lần dừng sạc',
|
||||
'assistant.card.roadtrip.moreDays': 'Còn {count} ngày nữa trong road trip',
|
||||
'assistant.card.roadtrip.moreStops': 'Còn {count} điểm dừng nữa trong ngày này',
|
||||
'assistant.card.roadtrip.undated': '{count} đặt chỗ không rơi vào ngày nào',
|
||||
'assistant.card.roadtrip.noDrive': 'Không lái',
|
||||
'assistant.card.roadtrip.days': 'Các ngày của chuyến lái',
|
||||
'assistant.card.roadtrip.dayWarning': 'Ngày này có điều cần xem lại',
|
||||
'assistant.card.roadtrip.sketch': 'Phác thảo lộ trình',
|
||||
'assistant.card.roadtrip.showDrive': 'Hiện chuyến lái trên bản đồ',
|
||||
'assistant.card.roadtrip.showDay': 'Hiện ngày {number} trên bản đồ',
|
||||
'assistant.card.roadtrip.open': 'Mở trong road trip',
|
||||
'assistant.card.roadtrip.problem.routing':
|
||||
'Một số chặng không tính được, nên các tổng này không phải toàn bộ chuyến lái.',
|
||||
'assistant.card.roadtrip.problem.coordinates': 'Một số địa điểm không có vị trí, nên chuyến lái bỏ qua chúng.',
|
||||
'assistant.card.roadtrip.problem.dayWindow':
|
||||
'Không giữ được thời gian di chuyển hằng ngày, nên điểm kết thúc các ngày chưa cố định.',
|
||||
'assistant.card.roadtrip.setting.on': 'Bật',
|
||||
'assistant.card.roadtrip.setting.off': 'Tắt',
|
||||
'assistant.card.roadtrip.corridor.none': 'Không tìm thấy gì trong phạm vi {distance} quanh tuyến đường.',
|
||||
'assistant.card.roadtrip.corridor.partial': 'Đến giờ đã tìm {done} trên {count} khu vực.',
|
||||
'assistant.card.roadtrip.corridor.more': 'Còn {count} kết quả dọc tuyến đường',
|
||||
'assistant.card.roadtrip.charging.checked': 'Kiểm tra lúc {time}',
|
||||
'assistant.card.roadtrip.charging.source': 'Dữ liệu từ {source} theo giấy phép {license}.',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': 'Dữ liệu từ {source}.',
|
||||
'assistant.card.roadtrip.charging.updated': 'Cập nhật lúc {time}.',
|
||||
'assistant.card.roadtrip.transit.more': 'Còn {count} chuyến nữa',
|
||||
'assistant.card.roadtrip.transit.dropped': '{count} chuyến không hiển thị được',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} điểm đi qua',
|
||||
'assistant.card.roadtrip.dayRoute.removed': 'Đã xóa {count} điểm đi qua',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} điểm dừng mới',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '{count} điểm dừng không đặt được',
|
||||
'assistant.card.roadtrip.dayRoute.after': 'Sau {name}',
|
||||
'assistant.card.roadtrip.dayRoute.follows': 'Theo {name}',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': 'Tạm thời là đường thẳng; TREK sẽ tính đường khi thay đổi được áp dụng.',
|
||||
'assistant.card.roadtrip.dayEnd.at': 'Ngày kết thúc tại {name}',
|
||||
'assistant.card.roadtrip.dayEnd.along': 'Ngày kết thúc ở {percent} % quãng lái sau {name}',
|
||||
'assistant.card.roadtrip.dayEnd.auto': 'Ngày lại kết thúc tự động',
|
||||
'assistant.card.roadtrip.quietDays': '{count} ngày không lái xe',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '{count} mức giá khác',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,74 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': '讓路線經過一個點',
|
||||
'assistant.change.verb.shapeRoute': '調整路線形狀',
|
||||
'assistant.change.verb.moveRouteVia': '移動途經點',
|
||||
'assistant.change.verb.removeRouteVia': '刪除途經點',
|
||||
'assistant.change.verb.repinRouteVias': '重新固定途經點',
|
||||
'assistant.change.verb.updateDriveSettings': '變更駕駛設定',
|
||||
'assistant.change.verb.setDayBoundary': '設定一天在哪裡結束',
|
||||
'assistant.change.verb.importRoute': '匯入路線',
|
||||
'assistant.change.verb.addTransit': '新增轉乘行程',
|
||||
'assistant.tool.add_route_via': '讓路線經過一個點',
|
||||
'assistant.tool.add_route_vias': '沿一條線調整路線形狀',
|
||||
'assistant.tool.update_route_via': '移動途經點',
|
||||
'assistant.tool.remove_route_via': '刪除途經點',
|
||||
'assistant.tool.reanchor_route_vias': '重新固定某天的途經點',
|
||||
'assistant.tool.update_roadtrip_settings': '變更駕駛設定',
|
||||
'assistant.tool.set_day_boundary': '設定當天在哪裡結束',
|
||||
'assistant.tool.import_google_maps_route': '匯入 Google 地圖路線',
|
||||
'assistant.tool.preview_google_maps_route': '讀取 Google 地圖路線',
|
||||
'assistant.tool.create_transit_journey': '新增大眾運輸行程',
|
||||
'assistant.step.roadtrip': '正在計算路線',
|
||||
'assistant.step.corridor': '正在沿路線搜尋',
|
||||
'assistant.step.charging': '正在查看充電站',
|
||||
'assistant.step.transit': '正在尋找轉乘行程',
|
||||
'assistant.followUp.chargers': '尋找沿途充電站',
|
||||
'assistant.followUp.stays': '尋找沿途住宿',
|
||||
'assistant.followUp.corridorMore': '沿路線繼續往前搜尋',
|
||||
'assistant.followUp.laterTransit': '顯示更晚的班次',
|
||||
'assistant.followUp.addTransit': '把第一個班次加入行程',
|
||||
'assistant.card.roadtrip.preview': '預覽',
|
||||
'assistant.card.roadtrip.saved': '已儲存的設定',
|
||||
'assistant.card.roadtrip.variants': '可選的駕駛方式',
|
||||
'assistant.card.roadtrip.warnings': '{count} 則提醒',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} 次充電停靠',
|
||||
'assistant.card.roadtrip.moreDays': '公路旅行中還有 {count} 天',
|
||||
'assistant.card.roadtrip.moreStops': '當天還有 {count} 個停靠點',
|
||||
'assistant.card.roadtrip.undated': '{count} 筆預訂不在任何一天',
|
||||
'assistant.card.roadtrip.noDrive': '不駕駛',
|
||||
'assistant.card.roadtrip.days': '行車日程',
|
||||
'assistant.card.roadtrip.dayWarning': '這一天有需要查看的地方',
|
||||
'assistant.card.roadtrip.sketch': '路線草圖',
|
||||
'assistant.card.roadtrip.showDrive': '在地圖上顯示路線',
|
||||
'assistant.card.roadtrip.showDay': '在地圖上顯示第 {number} 天',
|
||||
'assistant.card.roadtrip.open': '在公路旅行中開啟',
|
||||
'assistant.card.roadtrip.problem.routing': '部分路段無法計算,因此這些合計並非整段路線。',
|
||||
'assistant.card.roadtrip.problem.coordinates': '部分地點沒有位置,因此路線略過了它們。',
|
||||
'assistant.card.roadtrip.problem.dayWindow': '無法遵守每日旅行時間,因此每天的結束點尚未確定。',
|
||||
'assistant.card.roadtrip.setting.on': '開',
|
||||
'assistant.card.roadtrip.setting.off': '關',
|
||||
'assistant.card.roadtrip.corridor.none': '路線 {distance} 範圍內沒有找到任何結果。',
|
||||
'assistant.card.roadtrip.corridor.partial': '目前已搜尋 {count} 個區域中的 {done} 個。',
|
||||
'assistant.card.roadtrip.corridor.more': '沿路線還有 {count} 個結果',
|
||||
'assistant.card.roadtrip.charging.checked': '於 {time} 查看',
|
||||
'assistant.card.roadtrip.charging.source': '資料來自 {source},授權:{license}。',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': '資料來自 {source}。',
|
||||
'assistant.card.roadtrip.charging.updated': '於 {time} 更新。',
|
||||
'assistant.card.roadtrip.transit.more': '還有 {count} 個班次',
|
||||
'assistant.card.roadtrip.transit.dropped': '有 {count} 個班次無法顯示',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} 個途經點',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '已刪除 {count} 個途經點',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} 個新停靠點',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '有 {count} 個停靠點無法定位',
|
||||
'assistant.card.roadtrip.dayRoute.after': '{name} 之後',
|
||||
'assistant.card.roadtrip.dayRoute.follows': '沿 {name} 行駛',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': '目前為直線;套用變更後 TREK 會計算實際道路。',
|
||||
'assistant.card.roadtrip.dayEnd.at': '當天在 {name} 結束',
|
||||
'assistant.card.roadtrip.dayEnd.along': '當天在 {name} 之後行程的 {percent} % 處結束',
|
||||
'assistant.card.roadtrip.dayEnd.auto': '當天重新自動結束',
|
||||
'assistant.card.roadtrip.quietDays': '{count} 天無需開車',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '另有 {count} 種價格',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,74 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const assistantRoadtrip: TranslationStrings = {};
|
||||
const assistantRoadtrip: TranslationStrings = {
|
||||
'assistant.change.verb.addRouteVia': '让路线经过一个点',
|
||||
'assistant.change.verb.shapeRoute': '调整路线形状',
|
||||
'assistant.change.verb.moveRouteVia': '移动途经点',
|
||||
'assistant.change.verb.removeRouteVia': '删除途经点',
|
||||
'assistant.change.verb.repinRouteVias': '重新固定途经点',
|
||||
'assistant.change.verb.updateDriveSettings': '更改驾驶设置',
|
||||
'assistant.change.verb.setDayBoundary': '设定一天在哪里结束',
|
||||
'assistant.change.verb.importRoute': '导入路线',
|
||||
'assistant.change.verb.addTransit': '添加换乘行程',
|
||||
'assistant.tool.add_route_via': '让路线经过一个点',
|
||||
'assistant.tool.add_route_vias': '沿一条线调整路线形状',
|
||||
'assistant.tool.update_route_via': '移动途经点',
|
||||
'assistant.tool.remove_route_via': '删除途经点',
|
||||
'assistant.tool.reanchor_route_vias': '重新固定某天的途经点',
|
||||
'assistant.tool.update_roadtrip_settings': '更改驾驶设置',
|
||||
'assistant.tool.set_day_boundary': '设定当天在哪里结束',
|
||||
'assistant.tool.import_google_maps_route': '导入 Google 地图路线',
|
||||
'assistant.tool.preview_google_maps_route': '读取 Google 地图路线',
|
||||
'assistant.tool.create_transit_journey': '添加公共交通行程',
|
||||
'assistant.step.roadtrip': '正在计算路线',
|
||||
'assistant.step.corridor': '正在沿路线搜索',
|
||||
'assistant.step.charging': '正在查看充电站',
|
||||
'assistant.step.transit': '正在查找换乘行程',
|
||||
'assistant.followUp.chargers': '查找沿途充电站',
|
||||
'assistant.followUp.stays': '查找沿途住宿',
|
||||
'assistant.followUp.corridorMore': '沿路线继续往前搜索',
|
||||
'assistant.followUp.laterTransit': '显示更晚的班次',
|
||||
'assistant.followUp.addTransit': '把第一个班次加入行程',
|
||||
'assistant.card.roadtrip.preview': '预览',
|
||||
'assistant.card.roadtrip.saved': '已保存的设置',
|
||||
'assistant.card.roadtrip.variants': '可选的驾驶方式',
|
||||
'assistant.card.roadtrip.warnings': '{count} 条提醒',
|
||||
'assistant.card.roadtrip.chargingStops': '{count} 次充电停靠',
|
||||
'assistant.card.roadtrip.moreDays': '公路旅行中还有 {count} 天',
|
||||
'assistant.card.roadtrip.moreStops': '当天还有 {count} 个停靠点',
|
||||
'assistant.card.roadtrip.undated': '{count} 个预订不在任何一天',
|
||||
'assistant.card.roadtrip.noDrive': '不驾驶',
|
||||
'assistant.card.roadtrip.days': '行车日程',
|
||||
'assistant.card.roadtrip.dayWarning': '这一天有需要查看的地方',
|
||||
'assistant.card.roadtrip.sketch': '路线草图',
|
||||
'assistant.card.roadtrip.showDrive': '在地图上显示路线',
|
||||
'assistant.card.roadtrip.showDay': '在地图上显示第 {number} 天',
|
||||
'assistant.card.roadtrip.open': '在公路旅行中打开',
|
||||
'assistant.card.roadtrip.problem.routing': '部分路段无法计算,因此这些合计并非整段路线。',
|
||||
'assistant.card.roadtrip.problem.coordinates': '部分地点没有位置,因此路线跳过了它们。',
|
||||
'assistant.card.roadtrip.problem.dayWindow': '无法遵守每日出行时间,因此每天的结束点尚未确定。',
|
||||
'assistant.card.roadtrip.setting.on': '开',
|
||||
'assistant.card.roadtrip.setting.off': '关',
|
||||
'assistant.card.roadtrip.corridor.none': '路线 {distance} 范围内未找到任何结果。',
|
||||
'assistant.card.roadtrip.corridor.partial': '目前已搜索 {count} 个区域中的 {done} 个。',
|
||||
'assistant.card.roadtrip.corridor.more': '沿路线还有 {count} 个结果',
|
||||
'assistant.card.roadtrip.charging.checked': '于 {time} 查看',
|
||||
'assistant.card.roadtrip.charging.source': '数据来自 {source},许可:{license}。',
|
||||
'assistant.card.roadtrip.charging.sourceOnly': '数据来自 {source}。',
|
||||
'assistant.card.roadtrip.charging.updated': '于 {time} 更新。',
|
||||
'assistant.card.roadtrip.transit.more': '还有 {count} 个班次',
|
||||
'assistant.card.roadtrip.transit.dropped': '有 {count} 个班次无法显示',
|
||||
'assistant.card.roadtrip.dayRoute.vias': '{count} 个途经点',
|
||||
'assistant.card.roadtrip.dayRoute.removed': '已删除 {count} 个途经点',
|
||||
'assistant.card.roadtrip.dayRoute.newStops': '{count} 个新停靠点',
|
||||
'assistant.card.roadtrip.dayRoute.unresolved': '有 {count} 个停靠点无法定位',
|
||||
'assistant.card.roadtrip.dayRoute.after': '{name} 之后',
|
||||
'assistant.card.roadtrip.dayRoute.follows': '沿 {name} 行驶',
|
||||
'assistant.card.roadtrip.dayRoute.sketch': '目前为直线;应用更改后 TREK 会计算实际道路。',
|
||||
'assistant.card.roadtrip.dayEnd.at': '当天在 {name} 结束',
|
||||
'assistant.card.roadtrip.dayEnd.along': '当天在 {name} 之后行程的 {percent} % 处结束',
|
||||
'assistant.card.roadtrip.dayEnd.auto': '当天重新自动结束',
|
||||
'assistant.card.roadtrip.quietDays': '{count} 天无需驾车',
|
||||
'assistant.card.roadtrip.charging.otherPrices': '另有 {count} 种价格',
|
||||
};
|
||||
export default assistantRoadtrip;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chargingLookupSchema } from './charging.schema';
|
||||
import { chargingLookupSchema, cheapestEnergy, type ChargingInfo } from './charging.schema';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
@@ -22,3 +22,33 @@ describe('Charging station lookup by coordinate', () => {
|
||||
expect(chargingLookupSchema.safeParse([request]).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('The cheapest energy price of a charger', () => {
|
||||
const component = (price: number, extra: Partial<ChargingInfo['tariffs'][number]['components'][number]> = {}) => ({
|
||||
kind: 'ENERGY',
|
||||
price,
|
||||
taxIncluded: true,
|
||||
conditional: false,
|
||||
afterSeconds: null,
|
||||
...extra,
|
||||
});
|
||||
const tariff = (currency: string, components: ChargingInfo['tariffs'][number]['components']) => ({
|
||||
currency,
|
||||
updatedAt: '2026-10-01T10:00:00Z',
|
||||
components,
|
||||
});
|
||||
|
||||
it('RTCARD-001: picks the cheapest unconditional energy price with tax, across tariffs of one currency', () => {
|
||||
const tariffs = [
|
||||
tariff('EUR', [component(0.69), component(0.39, { conditional: true }), component(0.29, { taxIncluded: false })]),
|
||||
tariff('EUR', [component(0.59), { ...component(9), kind: 'FLAT' }]),
|
||||
];
|
||||
expect(cheapestEnergy(tariffs)).toEqual({ price: 0.59, currency: 'EUR' });
|
||||
});
|
||||
|
||||
it('RTCARD-002: gives null for no energy price, and for energy prices in two currencies', () => {
|
||||
expect(cheapestEnergy([])).toBeNull();
|
||||
expect(cheapestEnergy([tariff('EUR', [{ ...component(2), kind: 'TIME' }])])).toBeNull();
|
||||
expect(cheapestEnergy([tariff('EUR', [component(0.5)]), tariff('CHF', [component(0.4)])])).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,6 +31,28 @@ export const chargingInfoSchema = z.object({
|
||||
});
|
||||
export type ChargingInfo = z.infer<typeof chargingInfoSchema>;
|
||||
|
||||
/** A charger's cheapest energy price: per kWh, in its tariff's currency. */
|
||||
export interface ChargingEnergyPrice {
|
||||
price: number;
|
||||
currency: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The cheapest price per kWh a charger publishes that holds for everyone: an
|
||||
* energy component with tax included and no condition attached. Null when it
|
||||
* publishes none, or publishes them in more than one currency, which no single
|
||||
* figure can compare. The planner's badge and the assistant's card both read it.
|
||||
*/
|
||||
export function cheapestEnergy(tariffs: ChargingInfo['tariffs']): ChargingEnergyPrice | null {
|
||||
const energy = tariffs.flatMap((tariff) =>
|
||||
tariff.components
|
||||
.filter((component) => component.kind === 'ENERGY' && component.taxIncluded && !component.conditional)
|
||||
.map((component) => ({ price: component.price, currency: tariff.currency })),
|
||||
);
|
||||
if (new Set(energy.map((component) => component.currency)).size !== 1) return null;
|
||||
return energy.reduce<ChargingEnergyPrice | null>((best, item) => (!best || item.price < best.price ? item : best), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* A charging station addressed by where it is, rather than by a row in `places`.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user