import { Card, Col, Row, Typography } from 'antd'; import Link from 'next/link'; import { FC, useContext } from 'react'; import dynamic from 'next/dynamic'; import { LogTable } from './LogTable'; import { OwncastLogo } from '../common/OwncastLogo/OwncastLogo'; import { NewsFeed } from './NewsFeed'; import { ConfigDetails } from '../../types/config-section'; import { ServerStatusContext } from '../../utils/server-status-context'; const { Paragraph, Text } = Typography; const { Title } = Typography; const { Meta } = Card; // Lazy loaded components const BookTwoTone = dynamic(() => import('@ant-design/icons/BookTwoTone'), { ssr: false, }); const MessageTwoTone = dynamic(() => import('@ant-design/icons/MessageTwoTone'), { ssr: false, }); const PlaySquareTwoTone = dynamic(() => import('@ant-design/icons/PlaySquareTwoTone'), { ssr: false, }); const ProfileTwoTone = dynamic(() => import('@ant-design/icons/ProfileTwoTone'), { ssr: false, }); function generateStreamURL(serverURL, rtmpServerPort) { return `rtmp://${serverURL.replace(/(^\w+:|^)\/\//, '')}:${rtmpServerPort}/live`; } export type OfflineProps = { logs: any[]; config: ConfigDetails; }; export const Offline: FC = ({ logs = [], config }) => { const serverStatusData = useContext(ServerStatusContext); const { serverConfig } = serverStatusData || {}; const { rtmpServerPort, streamKeyOverridden } = serverConfig; const instanceUrl = global.window?.location.hostname || ''; let rtmpURL; if (instanceUrl && rtmpServerPort) { rtmpURL = generateStreamURL(instanceUrl, rtmpServerPort); } const data = [ { icon: , title: 'Use your broadcasting software', content: (
Learn how to point your existing software to your new server and start streaming your content.
Streaming URL: {rtmpURL && ( {rtmpURL} )} Streaming Keys: {!streamKeyOverridden ? ( View ) : ( Overridden via command line. )}
), }, { icon: , title: 'Embed your video onto other sites', content: (
Learn how you can add your Owncast stream to other sites you control.
), }, ]; if (!config?.chatDisabled) { data.push({ icon: , title: 'Chat is disabled', content: Chat will continue to be disabled until you begin a live stream., }); } if (!config?.yp?.enabled) { data.push({ icon: , title: 'Find an audience on the Owncast Directory', content: (
List yourself in the Owncast Directory and show off your stream. Enable it in{' '} settings.
), }); } if (!config?.federation?.enabled) { data.push({ icon: fediverse, title: 'Add your Owncast instance to the Fediverse', content: (
Enable Owncast social features to have your instance join the Fediverse, allowing people to follow, share and engage with your live stream.
), }); } return ( <>
No stream is active

You should start one.

{data.map(item => ( ))} ); }; export default Offline;