Skip to content

Commit

Permalink
Merge branch 'dev' into allow-more-styling
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Jul 1, 2024
2 parents 07a5da1 + a4efecf commit 31a7b04
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
5 changes: 4 additions & 1 deletion example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -670,4 +670,7 @@ itinerary:
### Setting this to true will use the route viewer sort algorithm on routes
# useRouteViewSort: false
### Setting this to false will hide the shadowey dot that appears when dragging the map
# showShadowDotOnMapDrag: false
# showShadowDotOnMapDrag: false
### In routes, this will always show the routeLongName before the headsign
### !!! WARNING: in some feeds, this may show the long name twice. In some feeds, this may cause layout issues !!!
# alwaysShowLongName: false
17 changes: 14 additions & 3 deletions lib/components/viewers/nearby/stop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ const Stop = ({
const patternRows = (stopData.stoptimesForPatterns || [])
?.reduce<PatternStopTime[]>((acc, cur) => {
const currentHeadsign = extractHeadsignFromPattern(cur.pattern)
const dupe = acc.findIndex(
(p) => extractHeadsignFromPattern(p.pattern) === currentHeadsign
)
const dupe = acc.findIndex((p) => {
// TODO: use OTP_generated ids
let sameRoute = false
if (p.pattern.route?.shortName && cur.pattern.route?.shortName) {
sameRoute =
p.pattern.route?.shortName === cur.pattern.route?.shortName
} else if (p.pattern.route?.longName && cur.pattern.route?.longName) {
sameRoute = p.pattern.route?.longName === cur.pattern.route?.longName
}
return (
extractHeadsignFromPattern(p.pattern) === currentHeadsign && sameRoute
)
})
if (dupe === -1) {
acc.push(cur)
} else {
Expand All @@ -62,6 +72,7 @@ const Stop = ({
)
return (
<PatternRow
alwaysShowLongName={nearbyViewConfig?.alwaysShowLongName}
homeTimezone={homeTimezone}
key={index}
pattern={st.pattern}
Expand Down
7 changes: 7 additions & 0 deletions lib/components/viewers/pattern-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { NextTripPreview, PatternRowItem } from './styled'
import StopTimeCell from './stop-time-cell'

type Props = {
alwaysShowLongName?: boolean
homeTimezone?: string
pattern: Pattern
roundedTop?: boolean
Expand Down Expand Up @@ -58,6 +59,7 @@ const renderDay = (homeTimezone: string, day: number): JSX.Element => {
* viewer.
*/
const PatternRow = ({
alwaysShowLongName,
homeTimezone,
pattern,
roundedTop = true,
Expand Down Expand Up @@ -101,6 +103,11 @@ const PatternRow = ({
/>
</span>
<span style={{ wordBreak: 'break-word' }} title={pattern.headsign}>
{alwaysShowLongName && !!pattern.route.longName && (
<strong style={{ display: 'block' }}>
{pattern.route.longName}
</strong>
)}
{extractHeadsignFromPattern(pattern) ||
(pattern.route.longName !== routeName && pattern.route.longName)}
</span>
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 @@ -69,6 +69,7 @@ export type BugsnagConfig = ApiKeyConfig
export type MapillaryConfig = ApiKeyConfig

export type NearbyViewConfig = {
alwaysShowLongName?: boolean
hideEmptyStops?: boolean
radius?: number
showShadowDotOnMapDrag?: boolean
Expand Down

0 comments on commit 31a7b04

Please sign in to comment.