diff --git a/example-config.yml b/example-config.yml index 19cf97e7f..e9c8fca38 100644 --- a/example-config.yml +++ b/example-config.yml @@ -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 \ No newline at end of file +# 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 \ No newline at end of file diff --git a/lib/components/viewers/nearby/stop.tsx b/lib/components/viewers/nearby/stop.tsx index 0fdc0a694..de0ccc0f5 100644 --- a/lib/components/viewers/nearby/stop.tsx +++ b/lib/components/viewers/nearby/stop.tsx @@ -38,9 +38,19 @@ const Stop = ({ const patternRows = (stopData.stoptimesForPatterns || []) ?.reduce((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 { @@ -62,6 +72,7 @@ const Stop = ({ ) return ( { * viewer. */ const PatternRow = ({ + alwaysShowLongName, homeTimezone, pattern, roundedTop = true, @@ -101,6 +103,11 @@ const PatternRow = ({ /> + {alwaysShowLongName && !!pattern.route.longName && ( + + {pattern.route.longName} + + )} {extractHeadsignFromPattern(pattern) || (pattern.route.longName !== routeName && pattern.route.longName)} diff --git a/lib/util/config-types.ts b/lib/util/config-types.ts index cde93c4d1..5549a5dfb 100644 --- a/lib/util/config-types.ts +++ b/lib/util/config-types.ts @@ -69,6 +69,7 @@ export type BugsnagConfig = ApiKeyConfig export type MapillaryConfig = ApiKeyConfig export type NearbyViewConfig = { + alwaysShowLongName?: boolean hideEmptyStops?: boolean radius?: number showShadowDotOnMapDrag?: boolean