update some home styles

This commit is contained in:
gingervitis 2020-11-28 19:26:52 -08:00
parent 1c40d2d428
commit 5a4f380009
9 changed files with 56 additions and 23 deletions

View file

@ -1,5 +1,5 @@
import { LineChart } from 'react-chartkick' import { LineChart } from 'react-chartkick'
import styles from '../../styles/styles.module.css'; import styles from '../../styles/styles.module.scss';
import 'chart.js'; import 'chart.js';
const defaultProps = { const defaultProps = {

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import adminStyles from '../../styles/styles.module.css'; import adminStyles from '../../styles/styles.module.scss';
export default function Logo() { export default function Logo() {
return ( return (

View file

@ -21,7 +21,7 @@ import { parseSecondsToDurationString } from '../../utils/format'
import OwncastLogo from './logo'; import OwncastLogo from './logo';
import { ServerStatusContext } from '../../utils/server-status-context'; import { ServerStatusContext } from '../../utils/server-status-context';
import adminStyles from '../../styles/styles.module.css'; import adminStyles from '../../styles/styles.module.scss';
let performedUpgradeCheck = false; let performedUpgradeCheck = false;

View file

@ -1,4 +1,4 @@
import { Typography, Statistic, Card, Col, Progress} from "antd"; import { Typography, Statistic, Card, Progress} from "antd";
const { Text } = Typography; const { Text } = Typography;
interface StatisticItemProps { interface StatisticItemProps {
@ -8,6 +8,7 @@ interface StatisticItemProps {
color?: string, color?: string,
progress?: boolean, progress?: boolean,
centered?: boolean, centered?: boolean,
formatter?: any,
}; };
const defaultProps = { const defaultProps = {
title: '', title: '',
@ -16,6 +17,7 @@ const defaultProps = {
color: '', color: '',
progress: false, progress: false,
centered: false, centered: false,
formatter: null,
}; };
@ -43,14 +45,15 @@ function ProgressView({ title, value, prefix, color }: StatisticItemProps) {
} }
ProgressView.defaultProps = defaultProps; ProgressView.defaultProps = defaultProps;
function StatisticView({ title, value, prefix }: StatisticItemProps) { function StatisticView({ title, value, prefix, formatter }: StatisticItemProps) {
return ( return (
<Statistic <Statistic
title={title} title={title}
value={value} value={value}
prefix={prefix} prefix={prefix}
/> formatter={formatter}
) />
);
} }
StatisticView.defaultProps = defaultProps; StatisticView.defaultProps = defaultProps;

View file

@ -14,7 +14,7 @@ GW: to do:
*/ */
import React, { useState, useEffect, useContext } from "react"; import React, { useState, useEffect, useContext } from "react";
import { Skeleton, Typography, Card, Statistic } from "antd"; import { Skeleton, Card, Statistic } from "antd";
import { UserOutlined, ClockCircleOutlined } from "@ant-design/icons"; import { UserOutlined, ClockCircleOutlined } from "@ant-design/icons";
import { formatDistanceToNow, formatRelative } from "date-fns"; import { formatDistanceToNow, formatRelative } from "date-fns";
import { ServerStatusContext } from "../utils/server-status-context"; import { ServerStatusContext } from "../utils/server-status-context";
@ -29,6 +29,16 @@ import {
} from "../utils/apis"; } from "../utils/apis";
import { formatIPAddress, isEmptyObject } from "../utils/format"; import { formatIPAddress, isEmptyObject } from "../utils/format";
function streamDetailsFormatter(streamDetails) {
return (
<ul className="statistics-list">
<li>{streamDetails.videoCodec} @ {streamDetails.videoBitrate} kbps</li>
<li>{streamDetails.framerate} fps</li>
<li>{streamDetails.width} x {streamDetails.height}</li>
</ul>
);
}
export default function Home() { export default function Home() {
const serverStatusData = useContext(ServerStatusContext); const serverStatusData = useContext(ServerStatusContext);
const { broadcaster, serverConfig: configData } = serverStatusData || {}; const { broadcaster, serverConfig: configData } = serverStatusData || {};
@ -45,7 +55,6 @@ export default function Home() {
}; };
const getMoreStats = () => { const getMoreStats = () => {
getLogs(); getLogs();
// getConfig();
} }
useEffect(() => { useEffect(() => {
let intervalId = null; let intervalId = null;
@ -74,12 +83,12 @@ export default function Home() {
const { audioPassthrough, videoPassthrough, audioBitrate, videoBitrate, framerate } = setting; const { audioPassthrough, videoPassthrough, audioBitrate, videoBitrate, framerate } = setting;
const audioSetting = const audioSetting =
audioPassthrough || audioBitrate === 0 audioPassthrough || audioBitrate === 0
? `${streamDetails.audioCodec} ${streamDetails.audioBitrate} kpbs` ? `${streamDetails.audioCodec}, ${streamDetails.audioBitrate} kbps`
: `${audioBitrate} kbps`; : `${audioBitrate} kbps`;
const videoSetting = const videoSetting =
videoPassthrough || videoBitrate === 0 videoPassthrough || videoBitrate === 0
? `${streamDetails.videoBitrate} kbps ${streamDetails.framerate}fps ${streamDetails.width}x${streamDetails.height}` ? `${streamDetails.videoBitrate} kbps, ${streamDetails.framerate} fps ${streamDetails.width} x ${streamDetails.height}`
: `${videoBitrate} kbps ${framerate}fps`; : `${videoBitrate} kbps, ${framerate} fps`;
let settingTitle = 'Outbound Stream Details'; let settingTitle = 'Outbound Stream Details';
settingTitle = (videoQualitySettings?.length > 1) ? settingTitle = (videoQualitySettings?.length > 1) ?
@ -100,9 +109,11 @@ export default function Home() {
); );
}); });
// inbound
const { viewerCount, sessionMaxViewerCount } = serverStatusData; const { viewerCount, sessionMaxViewerCount } = serverStatusData;
const streamVideoDetailString = `${streamDetails.videoCodec} ${streamDetails.videoBitrate} kbps ${streamDetails.framerate}fps ${streamDetails.width}x${streamDetails.height}`;
const streamAudioDetailString = `${streamDetails.audioCodec} ${streamDetails.audioBitrate} kbps`; const streamAudioDetailString = `${streamDetails.audioCodec}, ${streamDetails.audioBitrate} kbps`;
const broadcastDate = new Date(broadcaster.time); const broadcastDate = new Date(broadcaster.time);
@ -147,7 +158,8 @@ export default function Home() {
/> />
<StatisticItem <StatisticItem
title="Inbound Video Stream" title="Inbound Video Stream"
value={streamVideoDetailString} value={streamDetails}
formatter={streamDetailsFormatter}
prefix={null} prefix={null}
/> />
<StatisticItem <StatisticItem

View file

@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import LogTable from "./components/log-table" import LogTable from "./components/log-table";
import { import {
LOGS_ALL, LOGS_ALL,

View file

@ -4,7 +4,7 @@ import { Table, Typography, Input } from 'antd';
import { isEmptyObject } from '../utils/format'; import { isEmptyObject } from '../utils/format';
import KeyValueTable from "./components/key-value-table"; import KeyValueTable from "./components/key-value-table";
import { ServerStatusContext } from '../utils/server-status-context'; import { ServerStatusContext } from '../utils/server-status-context';
import adminStyles from '../styles/styles.module.css'; import adminStyles from '../styles/styles.module.scss';
const { Title } = Typography; const { Title } = Typography;
const { TextArea } = Input; const { TextArea } = Input;

View file

@ -1,20 +1,33 @@
.home-container { .home-container {
max-width: 1000px; max-width: 1000px;
.statistics-list {
li {
margin-left: -.5em;
}
}
.section { .section {
margin: 1rem 0; margin: 1rem 0;
.ant-statistic-content {
font-size: 1rem;
}
} }
.online-status-section { .online-status-section {
> .ant-card { > .ant-card {
box-shadow: 0px 1px 1px 0px rgba(0, 22, 40, 0.1); box-shadow: 0px 1px 10px 2px rgba(0, 22, 40, 0.1);
} }
.ant-card-head { .ant-card-head {
background-color: var(--owncast-purple); background-color: #40b246;
border-color: #ccc; border-color: #ccc;
color:#fff; color:#fff;
@media (prefers-color-scheme: dark) {
background-color: #2a762e;
border-bottom-color: black;
}
} }
.ant-card-head-title { .ant-card-head-title {
font-size: .88rem; font-size: .88rem;
@ -32,7 +45,7 @@
text-align: center; text-align: center;
margin: 0 1rem; margin: 0 1rem;
} }
} }
} }
@ -52,6 +65,11 @@
.ant-card-head { .ant-card-head {
background-color: #ccd; background-color: #ccd;
color: black; color: black;
@media (prefers-color-scheme: dark) {
background-color: #000;
color: #ccd;
}
} }
} }
.server-detail { .server-detail {
@ -62,7 +80,7 @@
align-items: flex-start; align-items: flex-start;
.ant-card { .ant-card {
width: 49%; width: 45%;
text-align: center; text-align: center;
} }
} }

View file

@ -85,4 +85,4 @@
.configSection { .configSection {
margin-bottom: 2em; margin-bottom: 2em;
} }