Browse Source

assorted cleanup

pull/1886/head
gingervitis 5 years ago
parent
commit
72d9ff4edb
  1. 10
      web/pages/components/log-table.tsx
  2. 11
      web/pages/index.tsx
  3. 8
      web/pages/offline-notice.tsx
  4. 12
      web/pages/update-server-config.tsx
  5. 3
      web/pages/viewer-info.tsx
  6. 1
      web/styles/home.scss

10
web/pages/components/log-table.tsx

@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
import React from "react";
import { timeFormat } from "d3-time-format";
import { Table, Tag} from "antd";
import { Table, Tag, Typography } from "antd";
import Linkify from "react-linkify";
import { SortOrder } from "antd/lib/table/interface";
const { Title } = Typography;
function renderColumnLevel(text, entry) {
let color = 'black';
@ -28,6 +30,9 @@ interface Props { @@ -28,6 +30,9 @@ interface Props {
}
export default function LogTable({ logs, pageSize }: Props) {
if (!logs.length) {
return null;
}
const columns = [
{
title: "Level",
@ -69,7 +74,8 @@ export default function LogTable({ logs, pageSize }: Props) { @@ -69,7 +74,8 @@ export default function LogTable({ logs, pageSize }: Props) {
];
return (
<div>
<div className="logs-section">
<Title level={2}>Logs</Title>
<Table
size="middle"
dataSource={logs}

11
web/pages/index.tsx

@ -9,7 +9,7 @@ TODO: Link each overview value to the sub-page that focuses on it. @@ -9,7 +9,7 @@ TODO: Link each overview value to the sub-page that focuses on it.
*/
import React, { useState, useEffect, useContext } from "react";
import { Row, Col, Skeleton, Result, List, Typography, Card, Statistic } from "antd";
import { Skeleton, Typography, Card, Statistic } from "antd";
import { UserOutlined, ClockCircleOutlined } from "@ant-design/icons";
import { formatDistanceToNow, formatRelative } from "date-fns";
import { ServerStatusContext } from "../utils/server-status-context";
@ -94,7 +94,7 @@ export default function Home() { @@ -94,7 +94,7 @@ export default function Home() {
settingTitle = (videoQualitySettings?.length > 1) ?
`${settingTitle} ${index + 1}` : settingTitle;
return (
<Card title={settingTitle} type="inner">
<Card title={settingTitle} type="inner" key={settingTitle}>
<StatisticItem
title="Outbound Video Stream"
value={`${videoBitrate} kbps, ${framerate} fps`}
@ -188,12 +188,7 @@ export default function Home() { @@ -188,12 +188,7 @@ export default function Home() {
</div>
</div>
{logsData.length ? (
<>
<Title level={2}>Stream Logs</Title>
<LogTable logs={logsData} pageSize={5} />
</>
): null}
<LogTable logs={logsData} pageSize={5} />
</div>
);
}

8
web/pages/offline-notice.tsx

@ -69,13 +69,7 @@ export default function Offline({ logs = [] }) { @@ -69,13 +69,7 @@ export default function Offline({ logs = [] }) {
}
</div>
{logs.length ? (
<>
<Title level={2}>Stream Logs</Title>
<LogTable logs={logs} pageSize={5} />
</>
): null}
<LogTable logs={logs} pageSize={5} />
</div>
);
}

12
web/pages/update-server-config.tsx

@ -82,15 +82,15 @@ function InstanceDetails({ config }) { @@ -82,15 +82,15 @@ function InstanceDetails({ config }) {
},
{
name: "Logo",
value: instanceDetails.logo.large,
value: instanceDetails.logo?.large,
},
{
name: "Tags",
value: instanceDetails.tags.join(", "),
value: instanceDetails.tags?.join(", "),
},
{
name: "NSFW",
value: instanceDetails.nsfw.toString(),
value: instanceDetails.nsfw?.toString(),
},
{
name: "Shows in Owncast directory",
@ -150,9 +150,9 @@ export default function ServerConfig() { @@ -150,9 +150,9 @@ export default function ServerConfig() {
setConfig({ ...config, message: error.message });
}
};
getInfo();
useEffect(() => {
getInfo();
}, []);
return (
<div>

3
web/pages/viewer-info.tsx

@ -109,19 +109,16 @@ export default function ViewersOverTime() { @@ -109,19 +109,16 @@ export default function ViewersOverTime() {
title="Current viewers"
value={viewerCount.toString()}
prefix={<UserOutlined />}
color="#334"
/>
<StatisticItem
title="Peak viewers this session"
value={sessionPeakViewerCount.toString()}
prefix={<UserOutlined />}
color="#334"
/>
<StatisticItem
title="Peak viewers overall"
value={overallPeakViewerCount.toString()}
prefix={<UserOutlined />}
color="#334"
/>
</Row>
<div className="chart-container">

1
web/styles/home.scss

@ -63,6 +63,7 @@ @@ -63,6 +63,7 @@
.ant-card {
width: 49%;
text-align: center;
}
}
.ant-card-head {

Loading…
Cancel
Save