Skip to content

Commit

Permalink
[www] fix display of gtfs-rt and pickup location
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Jul 2, 2024
1 parent 42f9730 commit 38e8470
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
26 changes: 19 additions & 7 deletions services/frontend/www-app/src/components/MultiModalListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@
<q-item-label caption v-if="active">
{{ itinerary.walkingDistanceFormatted }}
</q-item-label>
<div v-if="formattedRealTimeUntilStart() !== undefined">
<!-- FIXME: this isn't *always* realtime, we shouldn't imply that it is -->
<q-icon name="rss_feed" style="margin-right: 4px" />
<div v-if="formattedDurationUntilStart() !== undefined">
<q-icon
v-if="firstTransitLegIsRealTime()"
name="rss_feed"
style="margin-right: 4px"
/>
<span class="real-time-departure-time">
{{ formattedRealTimeUntilStart() }}&nbsp;
{{ formattedDurationUntilStart() }}&nbsp;
</span>
<span class="real-time-departure-location">
<span
v-if="firstTransitLegDepartureLocation()"
class="real-time-departure-location"
>
{{
$t('departs_at_$location', {
location: 'John & 5th',
location: firstTransitLegDepartureLocation(),
})
}}
</span>
Expand Down Expand Up @@ -77,7 +83,13 @@ export default defineComponent({
};
},
methods: {
formattedRealTimeUntilStart(): string | undefined {
firstTransitLegIsRealTime(): boolean {
return this.itinerary.firstTransitLeg?.realTime ?? false;
},
firstTransitLegDepartureLocation(): string | undefined {
return this.itinerary.firstTransitLeg?.departureLocationName;
},
formattedDurationUntilStart(): string | undefined {
let startTime = this.itinerary.firstTransitLeg?.startTime;
if (!startTime) {
return undefined;
Expand Down
4 changes: 4 additions & 0 deletions services/frontend/www-app/src/models/Itinerary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ export class ItineraryLeg {
return this.raw.realTime;
}

get departureLocationName(): string | undefined {
return this.raw.from?.name;
}

get alerts(): LegAlert[] {
return this.raw.alerts?.map((a) => new LegAlert(a)) || [];
}
Expand Down
3 changes: 3 additions & 0 deletions services/travelmux/src/otp/otp_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ pub struct Leg {
/// What time the leg starts, in millis since Unix epoch (UTC)
pub end_time: u64,

/// Whether there is real-time data about this Leg
pub real_time: bool,

#[serde(flatten)]
pub extra: HashMap<String, serde_json::Value>,
}
Expand Down

0 comments on commit 38e8470

Please sign in to comment.