digitransit-ui/app/component/itinerary/ItinerariesNotFound.js
Vesa Meskanen 3f2fa2ae0b feat: move all itinerary page related components to a dedicated folder
Also:
- Move generic Toggle to componentfolder root
- Remove dead styles
- Refactor some componets
2024-04-22 08:49:15 +03:00

45 lines
1.1 KiB
JavaScript

import React from 'react';
import { FormattedMessage } from 'react-intl';
import NoItinerariesNote from './NoItinerariesNote';
import { locationShape } from '../../util/shapes';
export default function ItinerariesNotFound(props) {
const { from, to } = props;
let msg;
if ((!from.lat || !from.lon) && (!to.lat || !to.lon)) {
msg = (
<FormattedMessage
id="no-route-start-end"
defaultMessage="Please select origin and destination"
/>
);
} else if (!from.lat || !from.lon) {
msg = (
<FormattedMessage
id="no-route-start"
defaultMessage="Please select origin"
/>
);
} else if (!to.lat || !to.lon) {
msg = (
<FormattedMessage
id="no-route-end"
defaultMessage="Please select destination"
/>
);
}
if (msg) {
return (
<div className="summary-list-container">
<div className="summary-no-route-found">{msg}</div>
</div>
);
}
return <NoItinerariesNote {...props} />;
}
ItinerariesNotFound.propTypes = {
from: locationShape.isRequired,
to: locationShape.isRequired,
};