{online && }
{!online && !appState.appLoading && (
-
+ setShowNotifyPopup(true)}
+ />
)}
;
-const Template: ComponentStory = args => ;
+const Template: ComponentStory = args => (
+
+
+
+);
-export const ExampleDefault = Template.bind({});
-ExampleDefault.args = {
- name: 'Cool stream 42',
- text: 'To get notifications when is back online you can follow or ask for notifications.',
+export const ExampleDefaultWithNotifications = Template.bind({});
+ExampleDefaultWithNotifications.args = {
+ streamName: 'Cool stream 42',
+ notificationsEnabled: true,
+ lastLive: new Date(),
};
-export const ExampleCustom = Template.bind({});
-ExampleCustom.args = {
- name: 'Dull stream 31337',
- text: 'This is some example offline text that a streamer can leave for a visitor of the page.',
+export const ExampleDefaultWithDateAndFediverse = Template.bind({});
+ExampleDefaultWithDateAndFediverse.args = {
+ streamName: 'Dull stream 31337',
+ lastLive: new Date(),
+ notificationsEnabled: false,
+ fediverseAccount: 'streamer@coolstream.biz',
+};
+
+export const ExampleCustomWithDateAndNotifications = Template.bind({});
+ExampleCustomWithDateAndNotifications.args = {
+ streamName: 'Dull stream 31337',
+ customText:
+ 'This is some example offline text that a streamer can leave for a visitor of the page.',
+ lastLive: new Date(),
+ notificationsEnabled: true,
+};
+
+export const ExampleDefaultWithNotificationsAndFediverse = Template.bind({});
+ExampleDefaultWithNotificationsAndFediverse.args = {
+ streamName: 'Cool stream 42',
+ notificationsEnabled: true,
+ fediverseAccount: 'streamer@coolstream.biz',
+ lastLive: new Date(),
+};
+
+export const ExampleDefaultWithoutNotifications = Template.bind({});
+ExampleDefaultWithoutNotifications.args = {
+ streamName: 'Cool stream 42',
+ notificationsEnabled: false,
+ lastLive: new Date(),
+};
+
+export const ExampleCustomTextWithoutNotifications = Template.bind({});
+ExampleCustomTextWithoutNotifications.args = {
+ streamName: 'Dull stream 31337',
+ customText:
+ 'This is some example offline text that a streamer can leave for a visitor of the page.',
};
diff --git a/web/components/ui/OfflineBanner/OfflineBanner.tsx b/web/components/ui/OfflineBanner/OfflineBanner.tsx
index 43c93cfe0..9363b1b62 100644
--- a/web/components/ui/OfflineBanner/OfflineBanner.tsx
+++ b/web/components/ui/OfflineBanner/OfflineBanner.tsx
@@ -1,26 +1,58 @@
-import { Divider, Button } from 'antd';
-import { NotificationFilled } from '@ant-design/icons';
+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';
+import { FollowButton } from '../../action-buttons/FollowButton';
+import { NotifyButton } from '../../action-buttons/NotifyButton';
export type OfflineBannerProps = {
- title: string;
- text: string;
+ streamName: string;
+ customText?: string;
+ lastLive?: Date;
+ notificationsEnabled: boolean;
+ fediverseAccount?: string;
+ onNotifyClick?: () => void;
};
-export const OfflineBanner: FC = ({ title, text }) => (
-
-
-
{title}
-
-
{text}
+export const OfflineBanner: FC = ({
+ streamName,
+ customText,
+ lastLive,
+ notificationsEnabled,
+ fediverseAccount,
+ onNotifyClick,
+}) => {
+ 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 {
+ text = `This stream is offline. Check back soon!`;
+ }
-
-
+ return (
+
+
+
{streamName}
+
+
{text}
+ {lastLive && (
+
+
+ {`Last live ${formatDistanceToNow(new Date(lastLive))} ago.`}
+