From 1a2dbd8d756571a810c2baaea014a0a0692936c5 Mon Sep 17 00:00:00 2001 From: gingervitis Date: Sat, 7 Nov 2020 15:32:51 -0800 Subject: [PATCH] make offline view a sep componenet --- web/pages/index.tsx | 64 +++--------------------------------- web/pages/offline-notice.tsx | 56 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 59 deletions(-) create mode 100644 web/pages/offline-notice.tsx diff --git a/web/pages/index.tsx b/web/pages/index.tsx index 1b7077f0e..dacd1cd5d 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -8,12 +8,13 @@ TODO: Link each overview value to the sub-page that focuses on it. */ import React, { useState, useEffect, useContext } from "react"; -import { Row, Skeleton, Result, List, Typography, Card } from "antd"; +import { Row, Skeleton, Typography } from "antd"; import { UserOutlined, ClockCircleOutlined } from "@ant-design/icons"; import { formatDistanceToNow, formatRelative } from "date-fns"; import { BroadcastStatusContext } from "../utils/broadcast-status-context"; import StatisticItem from "./components/statistic" import LogTable from "./components/log-table"; +import Offline from './offline-notice'; import { STREAM_STATUS, @@ -23,65 +24,11 @@ import { FETCH_INTERVAL, } from "../utils/apis"; import { formatIPAddress, isEmptyObject } from "../utils/format"; -import OwncastLogo from "./components/logo" const { Title } = Typography; -function Offline() { - const data = [ - { - title: "Send some test content", - content: ( -
- With any video you have around you can pass it to the test script and start streaming it. -
- ./test/ocTestStream.sh yourVideo.mp4 -
-
- ), - }, - { - title: "Use your broadcasting software", - content: ( -
- Learn how to point your existing software to your new server and start streaming your content. -
- ) - }, - { - title: "Something else", - }, - ]; - return ( -
- } - title="No stream is active." - subTitle="You should start one." - /> - ( - - {item.content} - - )} - /> -
- ); -} - -export default function Stats() { +export default function Home() { const context = useContext(BroadcastStatusContext); const { broadcaster } = context || {}; const { remoteAddr, streamDetails } = broadcaster || {}; @@ -158,15 +105,14 @@ export default function Stats() { } const videoSettings = config.videoSettings.videoQualityVariants; - const videoQualitySettings = videoSettings.map((setting, index) => { + const videoQualitySettings = videoSettings.map((setting) => { const audioSetting = setting.audioPassthrough || setting.audioBitrate === 0 ? `${streamDetails.audioBitrate} kpbs (passthrough)` : `${setting.audioBitrate} kbps`; return ( - // eslint-disable-next-line react/no-array-index-key - + + With any video you have around you can pass it to the test script and start streaming it. +
+ ./test/ocTestStream.sh yourVideo.mp4 +
+ + ), + }, + { + title: "Use your broadcasting software", + content: ( +
+ Learn how to point your existing software to your new server and start streaming your content. +
+ ) + }, + { + title: "Something else", + }, + ]; + return ( +
+ } + title="No stream is active." + subTitle="You should start one." + /> + + ( + + {item.content} + + )} + /> +
+ ); +}