import { memo } from "preact/compat";
import type { RealtimeStopSequence } from "mobility-toolbox-js/types";
const defaultRenderLink = (text: string, url: string) => {
return url ? (
{text}
) : (
text
);
};
function RouteScheduleFooter({
stopSequence,
}: {
stopSequence: RealtimeStopSequence;
}) {
if (!stopSequence.operator && !stopSequence.publisher) {
return null;
}
return (
<>
{stopSequence.operator &&
defaultRenderLink(stopSequence.operator, stopSequence.operatorUrl)}
{stopSequence.operator && stopSequence.publisher && - }
{stopSequence.publisher &&
defaultRenderLink(stopSequence.publisher, stopSequence.publisherUrl)}
{stopSequence.license && (}
{stopSequence.license &&
defaultRenderLink(stopSequence.license, stopSequence.licenseUrl)}
{stopSequence.license && ")"}
>
);
}
export default memo(RouteScheduleFooter);