/* eslint-disable jsx-a11y/click-events-have-key-events */ import { Divider } from 'antd'; import { ClockCircleOutlined } from '@ant-design/icons'; import { FC } from 'react'; import formatDistanceToNow from 'date-fns/formatDistanceToNow'; import styles from './OfflineBanner.module.scss'; export type OfflineBannerProps = { streamName: string; customText?: string; lastLive?: Date; notificationsEnabled: boolean; fediverseAccount?: string; onNotifyClick?: () => void; onFollowClick?: () => void; }; export const OfflineBanner: FC = ({ streamName, customText, lastLive, notificationsEnabled, fediverseAccount, onNotifyClick, onFollowClick, }) => { let text; if (customText) { text = customText; } else if (!customText && notificationsEnabled && fediverseAccount) { text = ( This stream is offline. You can{' '} be notified {' '} the next time {streamName} goes live or{' '} follow {' '} {fediverseAccount} on the Fediverse. ); } else if (!customText && notificationsEnabled) { text = ( This stream is offline.{' '} Be notified {' '} the next time {streamName} goes live. ); } else if (!customText && fediverseAccount) { text = ( This stream is offline.{' '} Follow {' '} {fediverseAccount} on the Fediverse to see the next time {streamName} goes live. ); } else { text = `This stream is offline. Check back soon!`; } return (
{streamName}
{text}
{lastLive && (
{`Last live ${formatDistanceToNow(new Date(lastLive))} ago.`}
)}
); };