Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only render routeName badge when routeName exists #723

Conversation

amy-corson-ibigroup
Copy link
Contributor

Small fix to only show background for transitive route name badge if we are passing a route name.

Before After
image image

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very curious how you figured this out/why this works!

@@ -37,7 +37,7 @@ export function patternToRouteFeature(
const properties = {
color: `#${route.route_color || "000080"}`,
name: routeName,
nameUpper: routeNameUpper,
nameUpper: routeName.length === 0 ? "" : routeNameUpper,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a WILD hack how did you figure this out???

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

routeNameUpper is what generates the background box, and it defaults to "EEE" if the routeName.length is smaller than 3! This just skips it entirely.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you're setting a string with length 0 only when the string length is 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, to clarify, nameUpper, which is what we're setting here, generates the background box. routeNameUpper will default to EEE, so setting it to an empty string removes the background box entirely

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the EEE thing is breaking me

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's right, I did that so that the box for short route numbers still looks rectangular...

Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@@ -37,7 +37,7 @@ export function patternToRouteFeature(
const properties = {
color: `#${route.route_color || "000080"}`,
name: routeName,
nameUpper: routeNameUpper,
nameUpper: routeName.length === 0 ? "" : routeNameUpper,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's right, I did that so that the box for short route numbers still looks rectangular...

@amy-corson-ibigroup amy-corson-ibigroup merged commit 073cf6a into opentripplanner:master Mar 15, 2024
2 checks passed
@amy-corson-ibigroup amy-corson-ibigroup deleted the remove-bg-when-no-routename branch March 15, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants