Skip to content

Commit

Permalink
Merge branch 'dev' into date-restricted-requests
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup authored Sep 16, 2024
2 parents a2a30e2 + da454eb commit 68e4dcb
Show file tree
Hide file tree
Showing 23 changed files with 154 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`components > viewers > nearby view renders nothing on a blank page 1`]
"fetching": false,
}
}
defaultLatLon={null}
fetchNearby={[Function]}
homeTimezone="America/Los_Angeles"
nearby={Array []}
Expand Down Expand Up @@ -146,6 +147,7 @@ exports[`components > viewers > nearby view renders proper scooter dates 1`] = `
"fetching": false,
}
}
defaultLatLon={null}
fetchNearby={[Function]}
homeTimezone="America/Los_Angeles"
nearby={
Expand Down
2 changes: 2 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ itinerary:
# - 'WALKTIME'
# - 'COST'
# - 'DEPARTURETIME'
# In the batch itinerary UI, this setting will always show both departure/arrival times
alwaysShowBothTimes: false

# The transitOperators key is a list of transit operators that can be used to
# order transit agencies when sorting by route. Also, this can optionally
Expand Down
5 changes: 3 additions & 2 deletions i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ common:
noItineraryToDisplay: No itinerary to display.
relativeCo2: |
{co2} {isMore, select, true {more} other {less} } CO₂ than driving alone
timeStartEnd: "{start} – {end}"
transfers: "{transfers, plural, =0 {} one {# transfer} other {# transfers}}"
linkOpensNewWindow: (Opens new window)
modes:
Expand Down Expand Up @@ -674,8 +675,8 @@ components:
tripBegins: >-
Trip is due to begin at {tripStart, time, short}. (Realtime monitoring
will begin at {monitoringStart, time, short}.)
tripStartIsDelayed: Trip start time is delayed ${duration}!
tripStartIsEarly: Trip start time is happening ${duration} earlier than expected!
tripStartIsDelayed: Trip start time is delayed {duration}!
tripStartIsEarly: Trip start time is happening {duration} earlier than expected!
tripStartsSoonNoUpdates: Trip is starting soon (no realtime updates available).
tripStartsSoonOnTime: Trip is starting soon and is about on time.
TripSummary:
Expand Down
6 changes: 2 additions & 4 deletions i18n/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,8 @@ components:
tripBegins: >-
El viaje debe comenzar a las {tripStart, time, short}. (El seguimiento
en tiempo real comenzará a las {monitoringStart, time, short}.)
tripStartIsDelayed: ¡La hora de inicio del viaje se retrasa ${duration}!
tripStartIsEarly: >-
¡La hora de inicio del viaje se produce ${duration} antes de lo
previsto!
tripStartIsDelayed: ¡La hora de inicio del viaje se retrasa {duration}!
tripStartIsEarly: ¡La hora de inicio del viaje se produce {duration} antes de lo previsto!
tripStartsSoonNoUpdates: >-
El viaje comienza pronto (no hay actualizaciones disponibles en tiempo
real).
Expand Down
5 changes: 3 additions & 2 deletions i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ common:
noItineraryToDisplay: Aucun trajet à afficher.
relativeCo2: |
{co2} de CO₂ en {isMore, select, true {plus} other {moins} } qu'en voiture
timeStartEnd: "{start} – {end}"
transfers: >-
{transfers, plural, =0 {} one {# correspondance} other {#
correspondances}}
Expand Down Expand Up @@ -708,8 +709,8 @@ components:
tripBegins: >-
Départ prévu à {tripStart, time, short}. (Le suivi en temps réel
débutera à {monitoringStart, time, short}.)
tripStartIsDelayed: Départ retardé de ${duration}.
tripStartIsEarly: Départ avancé de ${duration} !
tripStartIsDelayed: Départ retardé de {duration}.
tripStartIsEarly: Départ avancé de {duration} !
tripStartsSoonNoUpdates: Départ proche (pas de données en temps réel).
tripStartsSoonOnTime: Départ proche et prévu à l'heure.
TripSummary:
Expand Down
4 changes: 2 additions & 2 deletions i18n/ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ components:
tripBegins: >-
트립이 {tripStart, time, short}에 시작될 것으로 예정되어 있습니다. (실시간 모니터링은
{monitoringStart, time, short}에 시작됩니다.)
tripStartIsDelayed: 트립 시작 시간이 ${duration} 지연됩니다!
tripStartIsEarly: 트립이 예상보다 ${duration} 일찍 시작됩니다!
tripStartIsDelayed: 트립 시작 시간이 {duration} 지연됩니다!
tripStartIsEarly: 트립이 예상보다 {duration} 일찍 시작됩니다!
tripStartsSoonNoUpdates: 트립이 곧 시작됩니다 (실시간 업데이트를 사용할 수 없습니다).
tripStartsSoonOnTime: 트립은 곧 정시에 시작됩니다.
TripSummary:
Expand Down
4 changes: 2 additions & 2 deletions i18n/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ components:
tripBegins: >-
Поездка должна начаться в {tripStart, time, short}. (Отслеживание в
реальном времени запустится в {monitoringStart, time, short}.)
tripStartIsDelayed: Начало поездки откладывается на ${duration}!
tripStartIsEarly: Начало поездки произойдет на ${duration} раньше ожидаемого!
tripStartIsDelayed: Начало поездки откладывается на {duration}!
tripStartIsEarly: Начало поездки произойдет на {duration} раньше ожидаемого!
tripStartsSoonNoUpdates: Поездка скоро начнется (обновления в реальном времени недоступны).
tripStartsSoonOnTime: Поездка скоро начнется. Без задержек.
TripSummary:
Expand Down
4 changes: 2 additions & 2 deletions i18n/tl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ components:
tripBegins: >-
Magsisimula ang biyahe nang {tripStart, time, short}. (Magsisimula ang
realtime na pagsubaybay nang {monitoringStart, time, short}.)
tripStartIsDelayed: Naantala ang oras ng pagsisimula ng biyahe nang ${duration}!
tripStartIsEarly: Nagsisimula na ang biyahe ${duration} na mas maaga kaysa sa inaasahan!
tripStartIsDelayed: Naantala ang oras ng pagsisimula ng biyahe nang {duration}!
tripStartIsEarly: Nagsisimula na ang biyahe {duration} na mas maaga kaysa sa inaasahan!
tripStartsSoonNoUpdates: >-
Malapit nang magsimula ang biyahe (walang realtime na update na
available).
Expand Down
4 changes: 2 additions & 2 deletions i18n/vi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,9 @@ components:
tripBegins: >-
Chuyến đi sẽ bắt đầu lúc {tripStart, time, short}. (Việc theo dõi thời
gian thực sẽ bắt đầu lúc {monitoringStart, time, short}.)
tripStartIsDelayed: Thời gian bắt đầu chuyến đi bị trì hoãn ${duration}!
tripStartIsDelayed: Thời gian bắt đầu chuyến đi bị trì hoãn {duration}!
tripStartIsEarly: >-
Thời gian bắt đầu chuyến đi đang diễn ra sớm hơn ${duration} so với dự
Thời gian bắt đầu chuyến đi đang diễn ra sớm hơn {duration} so với dự
kiến!
tripStartsSoonNoUpdates: Chuyến đi đang bắt đầu sớm (không có cập nhật về thời gian thực).
tripStartsSoonOnTime: Chuyến đi đang bắt đầu sớm và sắp đúng giờ.
Expand Down
4 changes: 2 additions & 2 deletions i18n/zh_Hans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ components:
tripBegins: >-
您的行程将于 {tripStart, time, short} 开始. (实时跟踪将于{monitoringStart, time,
short}开始.)
tripStartIsDelayed: 行程开始时间延迟 ${duration}!
tripStartIsEarly: 开始时间比预期早 ${duration}!
tripStartIsDelayed: 行程开始时间延迟 {duration}!
tripStartIsEarly: 开始时间比预期早 {duration}!
tripStartsSoonNoUpdates: 行程即将开始 (没有实时更新).
tripStartsSoonOnTime: 行程即将开始而且大约是准时的.
TripSummary:
Expand Down
4 changes: 2 additions & 2 deletions i18n/zh_Hant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ components:
tripBegins: >-
行程預計在{tripStart, time, short}開始。(即時監控將在{monitoringStart, time,
short}開始。)
tripStartIsDelayed: 行程開始時間延誤${duration}!
tripStartIsEarly: 行程開始時間比預期提早${duration}!
tripStartIsDelayed: 行程開始時間延誤{duration}!
tripStartIsEarly: 行程開始時間比預期提早{duration}!
tripStartsSoonNoUpdates: 行程即將開始 (沒有可用的即時更新)。
tripStartsSoonOnTime: 行程即將開始且大約準時。
TripSummary:
Expand Down
8 changes: 6 additions & 2 deletions lib/actions/field-trip.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export function saveRequestTripItineraries(request, outbound, intl) {
*/
function prepareQueryParams(request, outbound) {
return async function (dispatch, getState) {
const { config } = getState().otp
const { config, currentQuery } = getState().otp
const { modules, transitOperators } = config
const fieldTripOptions = modules?.find((m) => m.id === 'ft')?.options

Expand Down Expand Up @@ -533,7 +533,11 @@ function prepareQueryParams(request, outbound) {
agencies: bannedAgencies
}
}
const locations = await planParamsToQueryAsync(locationsToGeocode, config)
const hasExistingLocations = currentQuery.from || currentQuery.to
const locations =
!hasExistingLocations || window.confirm('Overwrite existing locations?')
? await planParamsToQueryAsync(locationsToGeocode, config)
: { from: currentQuery.from, to: currentQuery.to }
return dispatch(setQueryParam({ ...locations, ...queryParams }))
}
}
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ export function fetchTripRequests() {
const convertedTrips = trips.data
.map(convertRequestToSearch(config))
.filter(
(tripReq) => !isEmpty(tripReq.query) || !!tripReq.otp2QueryParams
(tripReq) =>
(!isEmpty(tripReq.query) || !!tripReq.otp2QueryParams) &&
tripReq.query.modes
)
.reduce(removeDuplicateRequests, [])

Expand Down
2 changes: 1 addition & 1 deletion lib/components/admin/mailables-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class MailablesWindow extends Component {
<IconWithText Icon={Envelope}>Mailables</IconWithText>
</WindowHeader>
}
height="300px"
height="400px"
onClickClose={toggleMailables}
scroll={false}
style={{ width: '600px' }}
Expand Down
1 change: 1 addition & 0 deletions lib/components/admin/query-record.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class QueryRecordLayout extends Component {
<CallRecordIcon type="search" />
{params.from.name} to {params.to.name} at {time}
</CallRecordButton>
<hr style={{ margin: 0 }} />
</li>
)
}
Expand Down
22 changes: 13 additions & 9 deletions lib/components/app/call-taker-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ class CallTakerPanel extends Component {
}
}

// eslint-disable-next-line complexity
render() {
const {
activeSearch,
currentQuery,
fieldTripVisible,
groupSize,
intl,
mainPanelContent,
Expand Down Expand Up @@ -267,15 +269,17 @@ class CallTakerPanel extends Component {
/>
</div>
<div className="search-plan-button-container">
<Button
onClick={this._planTrip}
style={{
fontWeight: 'bold',
width: '100%'
}}
>
Plan
</Button>
{!fieldTripVisible && (
<Button
onClick={this._planTrip}
style={{
fontWeight: 'bold',
width: '100%'
}}
>
Plan
</Button>
)}
</div>
<div className="advanced-search-options-container">
{groupSize !== null && maxGroupSize && (
Expand Down
16 changes: 15 additions & 1 deletion lib/components/narrative/default/default-itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ const ITINERARY_ATTRIBUTES = [
id: 'arrivalTime',
order: 1,
render: (itinerary, options) => {
if (options.alwaysShowBothTimes) {
return (
<FormattedMessage
id="common.itineraryDescriptions.timeStartEnd"
values={{
end: <FormattedTime value={itinerary.endTime} />,
start: <FormattedTime value={itinerary.startTime} />
}}
/>
)
}
if (options.selection === 'ARRIVALTIME') {
return <FormattedTime value={itinerary.endTime} />
}
Expand Down Expand Up @@ -166,7 +177,7 @@ const ITINERARY_ATTRIBUTES = [
includeSeconds={false}
/>
<LegIconWrapper noSpace>
<LegIcon leg={leg} size={5} />
<LegIcon leg={{ ...leg, mode: 'WALK' }} size={5} />
</LegIconWrapper>
</>
)
Expand Down Expand Up @@ -250,6 +261,7 @@ class DefaultItinerary extends NarrativeItinerary {
render() {
const {
accessibilityScoreGradationMap,
alwaysShowBothTimes,
co2Config,
configCosts,
defaultFareType,
Expand Down Expand Up @@ -287,6 +299,7 @@ class DefaultItinerary extends NarrativeItinerary {
}

const itineraryAttributeOptions = {
alwaysShowBothTimes,
co2Config,
configCosts,
LegIcon
Expand Down Expand Up @@ -402,6 +415,7 @@ const mapStateToProps = (state, ownProps) => {
return {
accessibilityScoreGradationMap:
state.otp.config.accessibilityScore?.gradationMap,
alwaysShowBothTimes: state.otp.config.itinerary?.alwaysShowBothTimes,
co2Config: state.otp.config.co2,
configCosts: state.otp.config.itinerary?.costs,
defaultFareType: state.otp.config.itinerary?.defaultFareType || {
Expand Down
4 changes: 3 additions & 1 deletion lib/components/narrative/default/itinerary-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export default class ItinerarySummary extends Component {
}
blocks.push(
<Block
className="summary-block mode-block"
className={`summary-block mode-block ${
company === null ? 'non-company' : ''
}`}
key={blocks.length}
mode={leg.mode}
routeColor={leg.routeColor}
Expand Down
7 changes: 7 additions & 0 deletions lib/components/narrative/default/itinerary.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@
.otp .option.default-itin > .header .title > .summary > .mode-block {
height: 18px;
width: 18px;
}
.otp
.option.default-itin
> .header
.title
> .summary
> .mode-block.non-company {
color: #eee;
fill: #eee;
}
Expand Down
15 changes: 13 additions & 2 deletions lib/components/viewers/nearby/nearby-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type CurrentPosition = { coords?: { latitude: number; longitude: number } }

type Props = {
currentPosition?: CurrentPosition
defaultLatLon: LatLonObj | null
displayedCoords?: LatLonObj
entityId?: string
fetchNearby: (latLon: LatLonObj, radius?: number) => void
Expand Down Expand Up @@ -73,7 +74,8 @@ const getNearbyItem = (place: any) => {
function getNearbyCoordsFromUrlOrLocationOrMapCenter(
coordsFromUrl?: LatLonObj,
currentPosition?: CurrentPosition,
map?: MapRef
map?: MapRef,
defaultLatLon?: LatLonObj | null
): LatLonObj | null {
if (coordsFromUrl) {
return coordsFromUrl
Expand All @@ -92,11 +94,15 @@ function getNearbyCoordsFromUrlOrLocationOrMapCenter(
if (mapCoords) {
return mapCoords
}
if (defaultLatLon) {
return defaultLatLon
}
return null
}

function NearbyView({
currentPosition,
defaultLatLon,
displayedCoords,
entityId,
fetchNearby,
Expand All @@ -119,7 +125,8 @@ function NearbyView({
getNearbyCoordsFromUrlOrLocationOrMapCenter(
nearbyViewCoords,
currentPosition,
map
map,
defaultLatLon
),
[nearbyViewCoords, currentPosition, map]
)
Expand Down Expand Up @@ -283,12 +290,16 @@ function NearbyView({

const mapStateToProps = (state: AppReduxState) => {
const { config, location, transitIndex, ui } = state.otp
const { map } = state.otp.config
const { nearbyViewCoords } = ui
const { nearby } = transitIndex
const { entityId } = state.router.location.query
const { currentPosition } = location
const defaultLatLon =
map?.initLat && map?.initLon ? { lat: map.initLat, lon: map.initLon } : null
return {
currentPosition,
defaultLatLon,
displayedCoords: nearby?.coords,
entityId: entityId && decodeURIComponent(entityId),
homeTimezone: config.homeTimezone,
Expand Down
1 change: 1 addition & 0 deletions lib/util/config-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export interface ItineraryCostWeights {

export interface ItineraryConfig {
allowUserAlertCollapsing?: boolean
alwaysShowBothTimes?: boolean
costs?: ItineraryCostConfig
customBatchUiBackground?: boolean
defaultFareType?: FareProductSelector
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"eslint-plugin-sort-keys-fix": "^1.1.1",
"eslint-plugin-typescript-sort-keys": "^1.8.0",
"execa": "^5.1.1",
"express": "^4.19.2",
"express": "^4.20.0",
"har-express": "^1.1.0",
"husky": "^6.0.0",
"jest-transform-stub": "^2.0.0",
Expand Down
Loading

0 comments on commit 68e4dcb

Please sign in to comment.