Skip to content

armgit / TREK

Public Imported from GitHub
0

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

fix(transit): show every stop name and each ride's arrival in the journey details

Maurice61674cf91883
diff --git a/client/src/components/Planner/bookings/transitParts.test.tsx b/client/src/components/Planner/bookings/transitParts.test.tsx
index 493ac0111..f5ef4f58b 100644
--- a/client/src/components/Planner/bookings/transitParts.test.tsx
+++ b/client/src/components/Planner/bookings/transitParts.test.tsx
@@ -54,6 +54,14 @@ describe('TransitLegs', () => {
expect(screen.getByText('BVG')).toBeInTheDocument();
});
+ it('FE-PLANNER-BKTRANSIT-009: stop names and a walk target wrap instead of being cut off (#3139)', () => {
+ render(<TransitLegs legs={[ride, walk]} compact />);
+ for (const text of ['Alexanderplatz', 'Eberswalder Str.', 'Walk to Mauerpark']) {
+ expect(screen.getByText(text)).not.toHaveClass('truncate');
+ expect(screen.getByText(text)).toHaveClass('break-words');
+ }
+ });
+
it('FE-PLANNER-BKTRANSIT-006: a walk reads as one and leaves out the ride facts', () => {
render(<TransitLegs legs={[walk]} compact />);
expect(screen.getByText('Walk to Mauerpark')).toBeInTheDocument();
diff --git a/client/src/components/Planner/bookings/transitParts.tsx b/client/src/components/Planner/bookings/transitParts.tsx
index ec2057bdf..28dda974a 100644
--- a/client/src/components/Planner/bookings/transitParts.tsx
+++ b/client/src/components/Planner/bookings/transitParts.tsx
@@ -48,9 +48,11 @@ export function TransitLegs({ legs, compact = false }: { legs: TransitLegDisplay
}}>{leg.line || leg.mode}</span>
)}
<div className={`flex min-w-0 flex-1 flex-col ${compact ? 'gap-1' : 'gap-1.5'}`}>
- <div className="flex min-w-0 items-center gap-1 font-medium text-content" style={fs(compact ? 12 : 13, 'body')}>
- {walk ? <span className="truncate text-content-muted">{t('transit.walkTo', { name: leg.to?.name || '' })}</span> : (
- <><span className="truncate">{leg.from?.name}</span><ArrowRight size={compact ? 11 : 12} strokeWidth={2} className="flex-none text-content-faint" /><span className="truncate">{leg.to?.name}</span></>
+ {/* Detail views show a stop name whole: the names wrap and the
+ arrow moves to the next line with them when it has to (#3139). */}
+ <div className="flex min-w-0 flex-wrap items-center gap-1 font-medium text-content" style={fs(compact ? 12 : 13, 'body')}>
+ {walk ? <span className="min-w-0 break-words text-content-muted [overflow-wrap:anywhere]">{t('transit.walkTo', { name: leg.to?.name || '' })}</span> : (
+ <><span dir="auto" className="min-w-0 break-words [overflow-wrap:anywhere]">{leg.from?.name}</span><ArrowRight size={compact ? 11 : 12} strokeWidth={2} className="flex-none text-content-faint" /><span dir="auto" className="min-w-0 break-words [overflow-wrap:anywhere]">{leg.to?.name}</span></>
)}
</div>
<TransitMetaBadges size={compact ? 'sm' : 'md'} items={[
diff --git a/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx b/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx
index f7b8aeed5..203f93805 100644
--- a/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx
+++ b/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx
@@ -350,8 +350,11 @@ function TransitLegRows({ legs, t }: { legs: TransitLegDisplay[]; t: Translation
const hasSeg = i < legs.length - 1
return (
<div key={i} className="flex gap-[9px]">
- <span className="w-9 flex-none pt-[9px] text-end font-geist text-[0.65625rem] font-semibold tabular-nums text-m-muted">
- {isWalk ? '' : leg.from?.time?.slice(0, 5) || ''}
+ {/* A ride's departure stands beside its stops, its arrival at the
+ bottom of its row, so the open card holds the whole journey (#3139). */}
+ <span className="flex w-9 flex-none flex-col justify-between py-[9px] text-end font-geist text-[0.65625rem] font-semibold tabular-nums text-m-muted">
+ <span>{isWalk ? '' : leg.from?.time?.slice(0, 5) || ''}</span>
+ {!isWalk && leg.to?.time && <span className="text-m-faint">{leg.to.time.slice(0, 5)}</span>}
</span>
<div className="flex w-3 flex-none flex-col items-center">
{isWalk ? (
@@ -371,16 +374,16 @@ function TransitLegRows({ legs, t }: { legs: TransitLegDisplay[]; t: Translation
</div>
<div className="min-w-0 flex-1 py-[7px]">
{isWalk ? (
- <div className="truncate font-geist text-[0.6875rem] font-semibold text-m-muted">
+ <div className="break-words font-geist text-[0.6875rem] font-semibold text-m-muted [overflow-wrap:anywhere]">
<Footprints size={10} strokeWidth={2.2} className="me-1 inline-block align-[-1px]" />
{[mins ? t('transit.min', { count: mins }) : '', t('transit.walkTo', { name: leg.to?.name || '' })]
.filter(Boolean).join(' · ')}
</div>
) : (
<div>
- <div className="flex items-center gap-1.5">
- <LineBadge leg={leg} className="flex-none" />
- <span className="truncate text-[0.78125rem] font-bold">
+ <div className="flex items-start gap-1.5">
+ <LineBadge leg={leg} className="mt-px flex-none" />
+ <span dir="auto" className="min-w-0 break-words text-[0.78125rem] font-bold [overflow-wrap:anywhere]">
{flowText([leg.from?.name, leg.to?.name].filter((n): n is string => !!n))}
</span>
</div>
diff --git a/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx b/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx
index 326449d15..392dcc909 100644
--- a/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx
+++ b/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx
@@ -236,7 +236,7 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) {
<div className="flex-none px-[18px] pt-4">
<TileHeader
icon={<ResIcon size={19} strokeWidth={1.8} />}
- title={<span dir="auto" className="truncate text-[1rem]">{res.title}</span>}
+ title={<span dir="auto" className="min-w-0 break-words text-[1rem] [overflow-wrap:anywhere]">{res.title}</span>}
sub={subParts.length > 0 ? subParts.join(' · ') : undefined}
onClose={shell.closeSheet}
closeLabel={t('common.close')}
@@ -314,9 +314,9 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) {
<span className="text-m-muted">{t('transit.walkTo', { name: leg.to?.name || '' })}</span>
) : (
<>
- <span dir="auto" className="truncate">{leg.from?.name}</span>
+ <span dir="auto" className="min-w-0 break-words [overflow-wrap:anywhere]">{leg.from?.name}</span>
<ArrowRight size={10} strokeWidth={2} className="flex-none text-m-faint" />
- <span dir="auto" className="truncate">{leg.to?.name}</span>
+ <span dir="auto" className="min-w-0 break-words [overflow-wrap:anywhere]">{leg.to?.name}</span>
</>
)}
</div>
diff --git a/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx b/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx
index c4f60b9e3..e849dad78 100644
--- a/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx
+++ b/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx
@@ -327,6 +327,18 @@ describe('TransitRow', () => {
expect(screen.getByText('transit.min:1 · transit.walkTo:Hotel')).toBeInTheDocument()
})
+ it('FE-MOB-PLROW-046: the expanded legs show every stop name in full and each ride arrival time (#3139)', () => {
+ const { container } = render(<TransitRow {...base} open />)
+
+ const ride = screen.getByText('Shibuya Sta. → Asakusa Sta.')
+ expect(ride).not.toHaveClass('truncate')
+ expect(ride).toHaveClass('break-words')
+ expect(screen.getByText('transit.min:4 · transit.walkTo:Shibuya Sta.')).not.toHaveClass('truncate')
+ expect(screen.getByText('10:30')).toBeInTheDocument()
+ // the departure keeps its place beside the arrival
+ expect(container.textContent).toContain('10:05')
+ })
+
it('FE-MOB-PLROW-024: tapping the header toggles the row', () => {
const onToggle = vi.fn()
render(<TransitRow {...base} open={false} onToggle={onToggle} />)
diff --git a/client/tests/unit/mobile/trip/MTransportSheet.test.tsx b/client/tests/unit/mobile/trip/MTransportSheet.test.tsx
index 12ef4f3a9..60d1ab98b 100644
--- a/client/tests/unit/mobile/trip/MTransportSheet.test.tsx
+++ b/client/tests/unit/mobile/trip/MTransportSheet.test.tsx
@@ -144,6 +144,24 @@ describe('MTransportSheet', () => {
expect(screen.getByText('Prater')).toBeInTheDocument()
})
+ it('FE-MOB-TRSH-025: the title and every stop name wrap instead of being cut off (#3139)', () => {
+ const res = {
+ ...FLIGHT, type: 'transit', title: 'Basingstoke station → Reading station', endpoints: [], metadata: {
+ transit: {
+ legs: [{
+ mode: 'RAIL', line: 'CrossCountry', duration: 1260,
+ from: { name: 'Basingstoke', time: '12:48' }, to: { name: 'Reading', time: '13:09' },
+ }],
+ },
+ },
+ } as unknown as Reservation
+ render(<MTransportSheet planner={makePlanner({ reservations: [res] })} shell={makeShell()} />)
+ expect(screen.getByText('Basingstoke station → Reading station')).not.toHaveClass('truncate')
+ expect(screen.getByText('Basingstoke')).not.toHaveClass('truncate')
+ expect(screen.getByText('Reading')).not.toHaveClass('truncate')
+ expect(screen.getByText('Reading')).toHaveClass('break-words')
+ })
+
it('FE-MOB-TRSH-010: shows the pending status and the booking code unblurred by default', () => {
render(<MTransportSheet planner={makePlanner()} shell={makeShell()} />)
expect(screen.getByText('Pending')).toBeInTheDocument()