-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix warnings #324
fix warnings #324
Conversation
This feature is looking great! Can you fix the other unaddressed comments in #314 as well, including
Example of where hiding short bike legs is problematic: it makes it hard to figure out the 48/44 transfer. |
this is the only suggestion im not taking, BorderlessButton breaks styling. im using |
How does it break styling? I'm sure there's a way to make it work. Maybe BorderlessButton needs to be improved to reset something else. Our coding conventions say:
|
Also this comment from the original PR was not addressed in the way I intended:
You added the mode name to the message description (seen by translators) but not to the actual message (in the UI). There's no reason to do this. Restoring the previous messages like |
i think |
Ah, I see the confusion. That's not what that description does. It's not alt text. It's a description for the translator, because they'll see the string out of context, and sometimes the same string translates differently depending on context. (For example, is "Stop" a verb or a noun?) Personally, I don't think the icons are super clear and like having the redundancy. But if we're getting rid of the text, then the fix is to add a label for the icon. This might take a bit of refactoring because the natural place to select the label is in
For what it's worth, it would actually look like |
|
||
function alertSummary(alertBody) { | ||
return alertBody.slice(0, 40) + '...'; | ||
return alertBody.slice(0, ALERT_SUMMARY_LENGTH) + '...'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might get more consistent results by instead using CSS to set the size (number of lines) you want to show along with overflow: hidden and text-overflow: ellipsis
src/components/ItineraryBikeLeg.jsx
Outdated
<FormattedMessage | ||
defaultMessage="via {streets}" | ||
description="list of major streets taken on bike leg" | ||
values={{ streets: majorStreets.join(', ') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all languages use commas for punctuation so use intl.formatList
for this part. There's an example in Itinerary.jsx.
<span className="ItineraryHeader_alertHeader"> | ||
{alertHeader} | ||
</span> | ||
<div /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this for?
@@ -148,7 +157,7 @@ export default function ItineraryTransitLeg({ | |||
</ItineraryStep> | |||
))} | |||
</div> | |||
) : ( | |||
) : stops.length > 2 ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few lines below this there's a test for stopsBetweenStartAndEnd > 0
which seems equivalent. Is this redundant?
src/features/routes.js
Outdated
} else { | ||
return { ...state, viewingLeg: action.leg }; | ||
} | ||
return { ...state, viewingDetails: false, viewingLeg: null }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viewingLeg is no longer used
src/lib/TransitModes.js
Outdated
case MODES.TRAM_STREETCAR_LIGHT_RAIL: | ||
return 'tram/streetcar/light rail'; | ||
case MODES.MONORAIL: | ||
return 'monorail'; | ||
case MODES.SUBWAY_METRO: | ||
return 'subway/metro'; | ||
case MODES.RAIL_INTERCITY_LONG_DISTANCE: | ||
return 'intercity/long-distance rail'; | ||
case MODES.BUS: | ||
case MODES.TROLLEYBUS: | ||
return 'bus'; | ||
case MODES.FERRY: | ||
return 'ferry'; | ||
case MODES.CABLE_TRAM: | ||
case MODES.AERIAL_TRAM_SUSPENDED_CABLE_CAR: | ||
return 'cable tram/cable car/aerial tram/suspended cable car'; | ||
case MODES.FUNICULAR: | ||
return 'funicular'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need to be localized (which means the strings need to be in a React component, for access to intl
).
Also, all the slashes make it quite wordy. How about plain English? You can provide more detail to the translator in the description.
src/lib/formatMajorStreets.js
Outdated
} | ||
|
||
function quartileStreets(streets, q) { | ||
async function quartileStreets(streets, q) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to do anything as there is no asynchronous stuff in the function body
src/components/Itinerary.jsx
Outdated
if (isOnlyLeg) { | ||
onToggleLegExpand(idx); | ||
if (isOnlyLeg && expandedLeg !== idx) { | ||
setExpandedLeg(idx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work because React doesn't allow you to set state at render time.
If you really want to do it this way, you can use the useEffect hook to set the state in response to the legs
prop changing. However, it would be cleaner and avoid an unnecessary render to incorporate this into the render logic: <ItineraryBikeLeg expanded={isOnlyLeg || expandedLeg === idx}>
also allow expanding multiple legs at one time
got sloppy in #314