import { useTranslation } from 'next-export-i18n'; 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 { t } = useTranslation(); 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: t('Use your broadcasting software'), content: (
{t( 'Learn how to point your existing software to your new server and start streaming your content.', )}
{t('Streaming URL:')} {rtmpURL && ( {rtmpURL} )} {t('Streaming Keys:')} {!streamKeyOverridden ? ( {t('View')} ) : ( {t('Overridden via command line.')} )}
), }, { icon: , title: t('Embed your video onto other sites'), content: (
{t('Learn how you can add your Owncast stream to other sites you control.')}
), }, ]; if (!config?.chatDisabled) { data.push({ icon: , title: t('Chat is disabled'), content: {t('Chat will continue to be disabled until you begin a live stream.')}, }); } if (!config?.yp?.enabled) { data.push({ icon: , title: t('Find an audience on the Owncast Directory'), content: (
{t('List yourself in the Owncast Directory and show off your stream. Enable it in')}{' '} {t('settings.')}
), }); } if (!config?.federation?.enabled) { data.push({ icon: fediverse, title: t('Add your Owncast instance to the Fediverse'), content: (
{t('Enable Owncast social features')}{' '} {t( 'to have your instance join the Fediverse, allowing people to follow, share and engage with your live stream.', )}
), }); } return ( <>
{t('No stream is active')}

{t('You should start one.')}

{data.map(item => ( ))} ); };