Skip to content

Commit

Permalink
Merge branch 'dev' into fix-account-help-link
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup authored May 20, 2024
2 parents 7b49b92 + 45d51f6 commit 84334a4
Show file tree
Hide file tree
Showing 10 changed files with 303 additions and 330 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ dist
!example-config.yml
!test-config.yml
!har-mock-config.yml

# vscode extensions
.vscode
2 changes: 2 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ itinerary:
# Whether the plan first/previous/next/last buttons should be shown along with
# plan trip itineraries.
showPlanFirstLastButtons: false
# Show all walking legs regardless of distance
showAllWalkLegs: false
# Filters out trips returned by OTP by default, unless specifically requested.
# e.g. filters out walk-only itineraries if user has not explicitly asked for them.
strictItineraryFiltering: false
Expand Down
18 changes: 11 additions & 7 deletions lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,14 +685,15 @@ export const findRoute = (params) =>
lang
phone
}
bikesAllowed
color
longName
shortName
mode
type
color
textColor
bikesAllowed
routeBikesAllowed: bikesAllowed
shortName
sortOrder
textColor
type
url
patterns {
Expand Down Expand Up @@ -821,11 +822,12 @@ export function findRoutes() {
id: gtfsId
name
}
color
longName
shortName
mode
shortName
sortOrder
type
color
}
}
`,
Expand Down Expand Up @@ -853,6 +855,7 @@ export function findRoutes() {
longName,
mode,
shortName,
sortOrder,
type
} = route
// Set color overrides if present
Expand Down Expand Up @@ -882,6 +885,7 @@ export function findRoutes() {
),
origColor,
shortName,
sortOrder,
type,
v2: true
}
Expand Down
26 changes: 16 additions & 10 deletions lib/components/app/desktop-nav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { connect } from 'react-redux'
import { isMobile } from '@opentripplanner/core-utils/lib/ui'
import { Nav, Navbar } from 'react-bootstrap'
import { useIntl } from 'react-intl'
import React from 'react'
Expand Down Expand Up @@ -104,16 +105,21 @@ const DesktopNav = ({
>
<Navbar.Brand>
<AppMenu />
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore The dynamic tag is causing some trouble */}
<BrandingElement
className={branding && `with-icon icon-${branding}`}
{...brandingProps}
>
{/* A title is always rendered (e.g.for screen readers)
but is visually-hidden if a branding icon is used. */}
<div className="navbar-title">{title}</div>
</BrandingElement>

{!isMobile() && (
<>
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore The dynamic tag is causing some trouble */}
<BrandingElement
className={branding && `with-icon icon-${branding}`}
{...brandingProps}
>
{/* A title is always rendered (e.g.for screen readers)
but is visually-hidden if a branding icon is used. */}
<div className="navbar-title">{title}</div>
</BrandingElement>
</>
)}
</Navbar.Brand>

<ViewSwitcher sticky />
Expand Down
2 changes: 1 addition & 1 deletion lib/components/narrative/metro/attribute-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const getFlexAttributes = (
}
}

export const removeInsignifigantWalkLegs = (leg: Leg): boolean =>
export const removeInsignificantWalkLegs = (leg: Leg): boolean =>
// Return true only for non walk-legs or walking legs over 400 meters
// TODO: Make the 400 meters configurable?
leg.mode !== 'WALK' || leg.distance > 400
Expand Down
15 changes: 10 additions & 5 deletions lib/components/narrative/metro/metro-itinerary-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Itinerary, Leg } from '@opentripplanner/types'
import React from 'react'
import styled from 'styled-components'

import { AppReduxState } from '../../../util/state-types'
import { getFormattedMode } from '../../../util/i18n'
import FormattedDuration, {
formatDuration
Expand All @@ -12,7 +13,7 @@ import InvisibleA11yLabel from '../../util/invisible-a11y-label'

import {
getItineraryRoutes,
removeInsignifigantWalkLegs
removeInsignificantWalkLegs
} from './attribute-utils'
import RouteBlock from './route-block'

Expand Down Expand Up @@ -65,6 +66,7 @@ type Props = {
/** This is true when there is only one itinerary being shown and the itinerary-body is visible */
expanded: boolean
itinerary: Itinerary
showAllWalkLegs?: boolean
showLegDurations?: boolean
}

Expand All @@ -73,10 +75,13 @@ const MetroItineraryRoutes = ({
expanded,
itinerary,
LegIcon,
showAllWalkLegs,
showLegDurations
}: Props): JSX.Element => {
const intl = useIntl()
const routeLegs = itinerary.legs.filter(removeInsignifigantWalkLegs)
const routeLegs = showAllWalkLegs
? itinerary.legs
: itinerary.legs.filter(removeInsignificantWalkLegs)
const transitRoutes = getItineraryRoutes(itinerary, intl)

return (
Expand Down Expand Up @@ -129,9 +134,9 @@ const MetroItineraryRoutes = ({
)
}

// TODO: state type
const mapStateToProps = (state: any) => ({
enableDot: !state.otp.config.itinerary?.disableMetroSeperatorDot
const mapStateToProps = (state: AppReduxState) => ({
enableDot: !state.otp.config.itinerary?.disableMetroSeperatorDot,
showAllWalkLegs: state.otp.config.itinerary?.showAllWalkLegs
})

export default connect(mapStateToProps)(MetroItineraryRoutes)
1 change: 1 addition & 0 deletions lib/util/config-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export interface ItineraryConfig {
onlyShowCountdownForRealtime?: boolean
previewOverlay?: boolean
renderRouteNamesInBlocks?: boolean
showAllWalkLegs?: boolean
showFirstResultByDefault?: boolean
showHeaderText?: boolean
showLegDurations?: boolean
Expand Down
Loading

0 comments on commit 84334a4

Please sign in to comment.