Browse Source

fix react warnings on config page

pull/1886/head
gingervitis 6 years ago
parent
commit
1c40d2d428
  1. 8
      web/pages/components/key-value-table.tsx
  2. 5
      web/pages/index.tsx
  3. 40
      web/pages/update-server-config.tsx
  4. 4
      web/styles/styles.module.css

8
web/pages/components/key-value-table.tsx

@ -17,9 +17,9 @@ export default function KeyValueTable({ title, data }) {
]; ];
return ( return (
<div> <>
<Title>{title}</Title> <Title level={2}>{title}</Title>
<Table pagination={false} columns={columns} dataSource={data} /> <Table pagination={false} columns={columns} dataSource={data} rowKey="name" />
</div> </>
); );
} }

5
web/pages/index.tsx

@ -8,9 +8,7 @@ Will display an overview with the following datasources:
TODO: Link each overview value to the sub-page that focuses on it. TODO: Link each overview value to the sub-page that focuses on it.
GW: to do: GW: to do:
- Hardware + Viewer count views- top 3 boxes - restyle
- Home - more box shadoe? - Home - more box shadoe?
- maybe not have "current stream" nav section
- maybe make outbound/inbound smaller (since it's fixed info for current stream) - maybe make outbound/inbound smaller (since it's fixed info for current stream)
- reformat "Inbound Video Stream" section. - reformat "Inbound Video Stream" section.
*/ */
@ -31,9 +29,6 @@ import {
} from "../utils/apis"; } from "../utils/apis";
import { formatIPAddress, isEmptyObject } from "../utils/format"; import { formatIPAddress, isEmptyObject } from "../utils/format";
const { Title } = Typography;
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 || {};

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

@ -4,6 +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';
const { Title } = Typography; const { Title } = Typography;
const { TextArea } = Input; const { TextArea } = Input;
@ -32,12 +33,13 @@ function SocialHandles({ config }) {
} }
return ( return (
<div> <div className={adminStyles.configSection}>
<Title>Social Handles</Title> <Title level={2}>Social Handles</Title>
<Table <Table
pagination={false} pagination={false}
columns={columns} columns={columns}
dataSource={config.instanceDetails.socialHandles} dataSource={config.instanceDetails.socialHandles}
rowKey="platform"
/> />
</div> </div>
); );
@ -98,12 +100,12 @@ function InstanceDetails({ config }) {
return ( return (
<> <>
<p> <div className={adminStyles.configSection}>
<KeyValueTable title="Server details" data={data} /> <KeyValueTable title="Server details" data={data} />
</p> </div>
<p> <div className={adminStyles.configSection}>
<KeyValueTable title="Server configuration" data={configData} /> <KeyValueTable title="Server configuration" data={configData} />
</p> </div>
</> </>
); );
} }
@ -113,8 +115,8 @@ function PageContent({ config }) {
return null; return null;
} }
return ( return (
<div> <div className={adminStyles.configSection}>
<Title>Page content</Title> <Title level={2}>Page content</Title>
<TextArea <TextArea
disabled rows={4} disabled rows={4}
value={config.instanceDetails.extraPageContent} value={config.instanceDetails.extraPageContent}
@ -128,17 +130,13 @@ export default function ServerConfig() {
const { serverConfig: config } = serverStatusData || {}; const { serverConfig: config } = serverStatusData || {};
return ( return (
<div> <>
<p> <InstanceDetails config={config} />
<InstanceDetails config={config} /> <SocialHandles config={config} />
</p> <PageContent config={config} />
<p>
<SocialHandles config={config} /> <Title level={5}>Learn more about configuring Owncast <a href="https://owncast.online/docs/configuration">by visiting the documentation.</a></Title>
</p> </>
<PageContent config={config} />
<br/>
<Title level={5}>Learn more about configuring Owncast <a href="https://owncast.online/docs/configuration">by visiting the documentation.</a></Title>
</div>
); );
} }

4
web/styles/styles.module.css

@ -81,4 +81,8 @@
.lineChartContainer { .lineChartContainer {
margin: 2em auto; margin: 2em auto;
}
.configSection {
margin-bottom: 2em;
} }
Loading…
Cancel
Save