mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-06 01:00:37 +02:00

Also: - Move generic Toggle to componentfolder root - Remove dead styles - Refactor some componets
45 lines
1.1 KiB
JavaScript
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,
|
|
};
|