-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add scooter stop fallback message #767
base: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
|
||
const SelectedStopPopupContent = ({ stop }) => ( | ||
<div className="origin-popup"> | ||
<div className="origin-popup-header"> | ||
<div className="selected-stop-header">{stop.name}</div> | ||
<div className="selected-stop-header"> | ||
{!stop.name || stop.networks[0] === 'tier_REUTLINGEN' ? ( | ||
<FormattedMessage | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not use network specific code here. Is there a way to deduce the vehicleType from the stop and use a vehicleType specific message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used this solution because originally the popup should show the |
||
id={`${stop.networks}-station-no-id`} | ||
defaultMessage="Station" | ||
/> | ||
) : ( | ||
stop.name | ||
)} | ||
</div> | ||
</div> | ||
{(stop.code || stop.desc) && ( | ||
<div> | ||
|
@@ -22,6 +33,10 @@ const SelectedStopPopupContent = ({ stop }) => ( | |
|
||
SelectedStopPopupContent.propTypes = { | ||
stop: PropTypes.object.isRequired, | ||
networks: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.arrayOf(PropTypes.string), | ||
]).isRequired, | ||
}; | ||
|
||
SelectedStopPopupContent.displayName = 'SelectedStopPopupContent'; | ||
|
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.
When will networks be string, when array?
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.
It's always a string array. When it has only one element, it can be handled as a string.