{t('roadtrip.alt.loading')}
- ) : open.error ? ( + ) : phase === 'failed' ? (
{t('roadtrip.alt.onlyOne')}
) : ( @@ -88,9 +88,7 @@ export default function RoadtripAlternativesBar({ {formatDistance(alt.distance / 1000, distanceUnit)} - {alt.note - ? alt.note - : t('roadtrip.alt.slower', { time: formatDurationShort(alt.slowerThanQuickest) })} + {alternativeSubline(alt, time => t('roadtrip.alt.slower', { time }))} {/* Only where the drive time on the map came from the other engine. The diff --git a/client/src/components/Roadtrip/RoadtripSidebar.tsx b/client/src/components/Roadtrip/RoadtripSidebar.tsx index df5afdddd..4c53731f5 100644 --- a/client/src/components/Roadtrip/RoadtripSidebar.tsx +++ b/client/src/components/Roadtrip/RoadtripSidebar.tsx @@ -17,6 +17,7 @@ import { formatDistance } from '../../utils/units' import { formatDate, formatClockTime } from '../../utils/formatters' import { formatDurationShort, isServiceStopType, serviceColor, type ScheduleEntry, type ScheduleWarning, refuelsRange } from './roadtripModel' import { STOP_KIND_BY_KEY } from './stopKinds' +import { legReroutable } from './roadtripRowModel' import { spurWorthLabelling } from './accessSpur' import StopKindPicker from './StopKindPicker' import StopFillPicker from './StopFillPicker' @@ -1416,7 +1417,7 @@ function DaySection({ day, selectedAssignmentId, onSelectStop, onReorderStop, on {i < last && (!day.stops[i + 1].automaticNight || day.legs[i]?.distance !== 0) ? (+ + {t('roadtrip.alt.loading')} +
+ ) + } + if (alts.phase === 'failed') { + return ( ++ + {t('roadtrip.alt.failed')} +
+ ) + } + if (alts.phase === 'onlyOne') { + // One road back is genuinely one sensible way to drive the leg, not a failure. + return ( ++ {t('roadtrip.alt.onlyOne')} +
+ ) + } + // No phase means no open picker. The tab mounts the bar only while one is open, so this + // is at most the render it closes in, and "only one way" there would describe no leg. + if (alts.phase !== 'choose') return null + + // Scrolls sideways rather than wrapping, because the row has a fixed height. The negative + // margin lets a chip slide under the bar's own edge instead of stopping short of it. + return ( +