mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
fix(transit): show the stop you get off at instead of the walk that follows
Every row of an expanded search result is anchored at its leg's start: the time, the stop name, the platform. A leg's arrival appears as the next row's heading, and the last one gets the closing row. The walking legs broke that and printed their DESTINATION, which is the stop the next row already names. MOTIS brackets every journey in walking legs, so the last leg of a real connection is the walk from the arrival station to wherever you were headed. Its origin is the stop you get off at, and because that row printed the destination instead, the station had no row anywhere in the card and vanished. The same branch blanked the time cell, so the train's arrival time went with it. At the other end the access walk swallowed the origin the user had picked. Rows now read from.name for every mode, and the walk says it is a walk in its badge row instead. The platform tags along, which gives the exit row the arrival platform it was already carrying. The time falls back to scheduledTime the way the save path does, since a schedule-only feed would otherwise leave the row that matters without a clock. Fixes #2106
This commit is contained in:
@@ -234,12 +234,28 @@ function ItineraryCard({ it, tzFrom, tzTo, is12h, expanded, onToggle, onAdd, add
|
||||
{expanded && (
|
||||
<div style={{ borderTop: '1px solid var(--border-faint)', padding: '10px 14px 12px' }}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0 }}>
|
||||
{/*
|
||||
Every row is anchored at the leg's START: its time, its stop name and its
|
||||
platform. A leg's arrival shows up as the next row's heading, and the last
|
||||
arrival gets the closing row below.
|
||||
|
||||
The walking legs used to break that and print leg.to.name, which is the stop
|
||||
the NEXT row already names. The stop where you actually get off is a walking
|
||||
leg's from.name, so it had no row of its own and vanished from the card
|
||||
entirely, along with the train's arrival time, which the same branch blanked
|
||||
(#2106). MOTIS brackets every journey in walking legs, so this hit the exit
|
||||
of any real connection.
|
||||
|
||||
The time falls back to scheduledTime for the same reason the save path does
|
||||
(see stopTime below): a feed without realtime data carries only the schedule,
|
||||
and this row is now the one that shows the arrival.
|
||||
*/}
|
||||
{it.legs.map((leg, i) => {
|
||||
const color = leg.mode === 'WALK' ? 'var(--border-primary)' : (leg.lineColor || 'var(--text-muted)')
|
||||
return (
|
||||
<div key={i} style={{ display: 'grid', gridTemplateColumns: '44px 18px 1fr', gap: 8, alignItems: 'stretch' }}>
|
||||
<div className="text-content-muted" style={{ fontSize: 'calc(11.5px * var(--fs-scale-caption, 1))', fontWeight: 600, paddingTop: 2, textAlign: 'right' }}>
|
||||
{leg.mode === 'WALK' ? '' : fmtTimeInTz(leg.from.time, tzAt(leg.from.lat, leg.from.lng), is12h)}
|
||||
{fmtTimeInTz(leg.from.time ?? leg.from.scheduledTime, tzAt(leg.from.lat, leg.from.lng), is12h)}
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
||||
<span style={{ width: 10, height: 10, borderRadius: '50%', border: `2.5px solid ${color}`, background: 'var(--bg-card)', flexShrink: 0, marginTop: 4 }} />
|
||||
@@ -247,13 +263,14 @@ function ItineraryCard({ it, tzFrom, tzTo, is12h, expanded, onToggle, onAdd, add
|
||||
</div>
|
||||
<div style={{ paddingBottom: 14, minWidth: 0 }}>
|
||||
<div className="text-content" style={{ fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||
{leg.mode === 'WALK' ? t('transit.walkTo', { name: leg.to.name }) : leg.from.name}
|
||||
{leg.from.track && leg.mode !== 'WALK' && <span className="text-content-faint" style={{ fontWeight: 500 }}> · {t('transit.platform', { track: leg.from.track })}</span>}
|
||||
{leg.from.name}
|
||||
{leg.from.track && <span className="text-content-faint" style={{ fontWeight: 500 }}> · {t('transit.platform', { track: leg.from.track })}</span>}
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginTop: 4, flexWrap: 'wrap' }}>
|
||||
{leg.mode === 'WALK' ? (
|
||||
<TransitMetaBadges size="sm" items={[
|
||||
{ icon: Footprints, text: fmtDuration(leg.duration, t) },
|
||||
{ icon: Footprints, text: t('transit.walkLabel') },
|
||||
{ text: fmtDuration(leg.duration, t) },
|
||||
{ text: leg.distance ? (leg.distance >= 1000 ? `${(leg.distance / 1000).toFixed(1)} km` : `${leg.distance} m`) : '' },
|
||||
]} />
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user