Skip to content

Commit

Permalink
Merge branch 'dev' into pass-render-other-first
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-corson-ibigroup authored Dec 2, 2024
2 parents bfbddf3 + 0c4625f commit 17cd30e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ import React from 'react'

import FormattedDuration from '../../../util/formatted-duration'

/**
* Helper function that changes alert timestamps from milliseconds to seconds
* for display using the alerts body component from itinerary-body.
*/
function withAlertTimestampsInSeconds(alert) {
return {
...alert,
effectiveEndDate: alert.effectiveEndDate / 1000,
effectiveStartDate: alert.effectiveStartDate / 1000
}
}

/**
* Calculate commonly-used pieces of data used to render the trip status
* component. The monitoredTrip param can be undefined.
Expand Down Expand Up @@ -63,9 +51,7 @@ export default function baseRenderer(monitoredTrip) {

// Set some alert data if the matching itinerary exists.
// (Convert alert timestamps in milliseconds to seconds for display using alerts body.)
data.alerts = data.matchingItinerary?.alerts?.map(
withAlertTimestampsInSeconds
)
data.alerts = data.matchingItinerary?.alerts
data.hasMoreThanOneAlert = !!(data.alerts?.length > 0)
data.shouldRenderAlerts = data.hasMoreThanOneAlert

Expand Down
3 changes: 2 additions & 1 deletion lib/util/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ async function loadOtpUiLocaleData(matchedLocale) {
.filter((pkg) => pkg.startsWith('@opentripplanner'))
.map(async (pkg) => {
try {
const packagePath = pkg.replace('@opentripplanner/', '')
const msgs = await import(
`../../node_modules/${pkg}/i18n/${matchedLocale}.yml`
`@opentripplanner/${packagePath}/i18n/${matchedLocale}.yml`
)
if (msgs) return msgs.default
} catch (ex) {
Expand Down

0 comments on commit 17cd30e

Please sign in to comment.