fix(mobile): drop stale up-next cards and open the plan on the next day (#2057)

The UP NEXT card kept pointing at this morning's first stop hours after it had
started, and at day one of a trip that ended last month. A header promising what
comes next, sitting above something that is over. It now stays away on a day that
has passed and once today's timed plan has run out — a day whose stops carry no
times at all still shows its first stop, there is nothing stale about that. The
timeline card already collapses the reserved space when there is no up-next, so
the layout closes cleanly.

Seeding the plan day also lands on the next day still ahead when today falls into
a gap in the dates, instead of dropping back to day one. A trip that is already
over keeps opening on its first day.

And a day that was selected before the shell mounted now counts as seeded, so
clearing the selection is left alone instead of being re-seeded on the next
render — which is what the guard was there for in the first place.

Based on #2055.
This commit is contained in:
Maurice
2026-08-27 11:02:09 +02:00
committed by GitHub
parent f61bab3ffd
commit 495c5e95ec
7 changed files with 125 additions and 30 deletions
@@ -11,7 +11,7 @@ import type {
Accommodation, Assignment, Day, DayNote, Reservation, RouteSegment, TranslationFn,
} from '../../../../src/types'
// FE-MOB-PTLM-001 to FE-MOB-PTLM-043
// FE-MOB-PTLM-001 to FE-MOB-PTLM-044
const DAYS = [
{ id: 1, trip_id: 1, day_number: 1, date: '2026-05-01', title: null },
@@ -345,10 +345,12 @@ describe('planTimelineModel — findUpNext', () => {
expect(up?.minutesUntil).toBe(45)
})
it('FE-MOB-PTLM-033: falls back to the first timed stop once the day is over', () => {
const up = findUpNext(DAY2, [early, noon, late], new Date(2026, 4, 2, 23, 30))
expect(up?.assignment.id).toBe(11)
expect(up?.minutesUntil).toBeNull()
it('FE-MOB-PTLM-033: shows nothing once the timed plan for today has run out', () => {
expect(findUpNext(DAY2, [early, noon, late], new Date(2026, 4, 2, 23, 30))).toBeNull()
})
it('FE-MOB-PTLM-044: shows nothing for a day that is already behind us', () => {
expect(findUpNext(DAY2, [late, noon, early], new Date(2026, 4, 3, 8, 0))).toBeNull()
})
it('FE-MOB-PTLM-034: never counts down on a day that is not today', () => {