Scope past/active trip indicators to the selected schedule date - #118
Merged
Conversation
The "hide past trips" toggle and the tr-past-trip/tr-active-trip row styling compared trip times against the current clock time regardless of which date was selected on a route page, so viewing a non-today date produced misleading past/active indicators. These now only apply when the selected schedule date is today; the toggle is hidden entirely on other dates. Also show a "Not Running Today" badge on the trip page when the API reports scheduled_today: false, now that GET /trips/:id can return trips that aren't scheduled for the current service day (transitnownash/gtfs-rails-api#155). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Upgrade to bg-danger to match the Canceled/Skipped severity, and skip the progress meter entirely since a trip with no service today has no meaningful progress to show. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates route/trip UI logic so “past/active trip” indicators and the “hide past trips” toggle only apply when the selected schedule date is today, and it adds a “Not Running Today” badge on trip pages when the API returns scheduled_today: false.
Changes:
- Gate “Hide past trips” toggle visibility and past-trip filtering to only when
scheduleDateis today. - Gate
tr-active-trip/tr-past-triprow styling to only when the schedule date is today. - Add “Not Running Today” badge on the trip page when
trip.scheduled_today === false, and suppress “No Data” / progress bar in that case.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/controllers/Trip.jsx | Adds “Not Running Today” badge based on scheduled_today, and hides some realtime UI when false. |
| src/components/TripTableRow.jsx | Scopes active/past row styling to today via isScheduleDateToday. |
| src/components/TripTable.jsx | Computes isScheduleDateToday, hides the toggle on non-today dates, and disables past-trip filtering on non-today dates. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
13
to
+46
| @@ -38,7 +41,9 @@ function TripTable({ | |||
| <> | |||
| <div className="d-flex align-items-center mb-2"> | |||
| <div className="flex-grow-1"> | |||
| <HidePastTripsToggle hidePastTrips={hidePastTrips} onChange={handleCheckboxChange} /> | |||
| {isScheduleDateToday && ( | |||
| <HidePastTripsToggle hidePastTrips={hidePastTrips} onChange={handleCheckboxChange} /> | |||
| )} | |||
Comment on lines
60
to
76
| @@ -70,7 +70,9 @@ function TripTableRow({ | |||
| if (hidePastTrips) { | |||
| return; | |||
| } | |||
| rowClasses = 'tr-past-trip'; | |||
| if (isScheduleDateToday) { | |||
| rowClasses = 'tr-past-trip'; | |||
| } | |||
| } | |||
Copilot review flagged that the new isScheduleDateToday gating wasn't covered: the hide-past-trips toggle/filtering on a non-today scheduleDate, and tr-active-trip/tr-past-trip styling suppression on TripTableRow. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scheduled_today: false, now thatGET /trips/:idcan return trips that aren't scheduled for the current service day (see Return trips from GET /trips/:id regardless of today's service calendar gtfs-rails-api#155).Test plan
npm run lintnpm test(105 tests)🤖 Generated with Claude Code