mirror of
https://github.com/owncast/owncast.git
synced 2024-11-22 21:03:19 +03:00
continue initial setup
This commit is contained in:
parent
48aea8024e
commit
f446385a7e
5 changed files with 87 additions and 0 deletions
5
web/pages/components/config/defaults.ts
Normal file
5
web/pages/components/config/defaults.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// DEFAULT VALUES
|
||||||
|
|
||||||
|
export const DEFAULT_NAME = 'Owncast User';
|
||||||
|
export const DEFAULT_TITLE = 'Owncast Server';
|
||||||
|
export const DEFAULT_SUMMARY = '';
|
25
web/pages/components/config/form-textfield.tsx
Normal file
25
web/pages/components/config/form-textfield.tsx
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
- auto saves ,ajax call
|
||||||
|
- set default text
|
||||||
|
- show error state/confirm states
|
||||||
|
- show info
|
||||||
|
- label
|
||||||
|
- min/max length
|
||||||
|
|
||||||
|
- populate with curren val (from local sstate)
|
||||||
|
|
||||||
|
load page,
|
||||||
|
get all config vals,
|
||||||
|
save to local state/context.
|
||||||
|
read vals from there.
|
||||||
|
update vals to state, andthru api.
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
import React, { useContext } from 'react';
|
||||||
|
import { ServerStatusContext } from '../../../utils/server-status-context';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Server Name
|
||||||
|
<Input placeholder="Owncast" value={name} />
|
37
web/pages/components/config/public-facing-details.tsx
Normal file
37
web/pages/components/config/public-facing-details.tsx
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import React, { useContext } from 'react';
|
||||||
|
import { Typography, Input } from 'antd';
|
||||||
|
|
||||||
|
|
||||||
|
import { ServerStatusContext } from '../../../utils/server-status-context';
|
||||||
|
|
||||||
|
const { Title } = Typography;
|
||||||
|
|
||||||
|
export default function PublicFacingDetails() {
|
||||||
|
const serverStatusData = useContext(ServerStatusContext);
|
||||||
|
const { serverConfig, setConfigField } = serverStatusData || {};
|
||||||
|
|
||||||
|
const { instanceDetails = {}, } = serverConfig;
|
||||||
|
|
||||||
|
const { name, summary, title } = instanceDetails;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Title level={2}>Edit your public facing instance details</Title>
|
||||||
|
<div className="config-public-details-container">
|
||||||
|
<div className="text-fields" role="form">
|
||||||
|
Server Name
|
||||||
|
<Input placeholder="Owncast" value={name} />
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className="misc-optionals">
|
||||||
|
add social handles
|
||||||
|
<br/>
|
||||||
|
add tags
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
7
web/styles/config.scss
Normal file
7
web/styles/config.scss
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
.config-public-details-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import { STATUS, fetchData, FETCH_INTERVAL, SERVER_CONFIG } from './apis';
|
||||||
|
|
||||||
export const initialServerConfigState = {
|
export const initialServerConfigState = {
|
||||||
streamKey: '',
|
streamKey: '',
|
||||||
|
instanceDetails: {},
|
||||||
yp: {
|
yp: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
@ -36,6 +37,8 @@ const initialServerStatusState = {
|
||||||
export const ServerStatusContext = React.createContext({
|
export const ServerStatusContext = React.createContext({
|
||||||
...initialServerStatusState,
|
...initialServerStatusState,
|
||||||
serverConfig: initialServerConfigState,
|
serverConfig: initialServerConfigState,
|
||||||
|
|
||||||
|
setConfigField: () => {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const ServerStatusProvider = ({ children }) => {
|
const ServerStatusProvider = ({ children }) => {
|
||||||
|
@ -60,6 +63,14 @@ const ServerStatusProvider = ({ children }) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setConfigField = ({ fieldName, value }) => {
|
||||||
|
const updatedConfig = {
|
||||||
|
...config,
|
||||||
|
[fieldName]: value,
|
||||||
|
};
|
||||||
|
setConfig(updatedConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let getStatusIntervalId = null;
|
let getStatusIntervalId = null;
|
||||||
|
@ -78,6 +89,8 @@ const ServerStatusProvider = ({ children }) => {
|
||||||
const providerValue = {
|
const providerValue = {
|
||||||
...status,
|
...status,
|
||||||
serverConfig: config,
|
serverConfig: config,
|
||||||
|
|
||||||
|
setConfigField,
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<ServerStatusContext.Provider value={providerValue}>
|
<ServerStatusContext.Provider value={providerValue}>
|
||||||
|
|
Loading…
Reference in a new issue