0
owncast/web/pages/components/config/public-facing-details.tsx

59 lines
1.5 KiB
TypeScript
Raw Normal View History

import React, { useContext, useEffect } from 'react';
import { Typography, Form } from 'antd';
2020-12-26 19:44:09 -08:00
import TextField, { TEXTFIELD_TYPE_TEXTAREA } from './form-textfield';
2020-12-26 18:04:23 -08:00
import { ServerStatusContext } from '../../../utils/server-status-context';
const { Title } = Typography;
export default function PublicFacingDetails() {
const [form] = Form.useForm();
2020-12-26 18:04:23 -08:00
const serverStatusData = useContext(ServerStatusContext);
const { serverConfig } = serverStatusData || {};
2020-12-26 18:04:23 -08:00
const { instanceDetails = {} } = serverConfig;
useEffect(() => {
form.setFieldsValue({...instanceDetails});
}, [instanceDetails]);
const handleResetValue = (fieldName: string) => {
form.setFieldsValue({ [fieldName]: instanceDetails[fieldName]});
}
const extraProps = {
handleResetValue,
initialValues: instanceDetails,
};
2020-12-26 18:04:23 -08:00
return (
<>
<Title level={2}>Edit your public facing instance details</Title>
2020-12-26 18:04:23 -08:00
<div className="config-public-details-container">
2020-12-26 19:44:09 -08:00
<div className="text-fields">
<Form
form={form}
layout="vertical"
>
<TextField fieldName="name" {...extraProps} />
<TextField fieldName="summary" type={TEXTFIELD_TYPE_TEXTAREA} {...extraProps} />
<TextField fieldName="title" {...extraProps} />
<TextField fieldName="streamTitle" {...extraProps} />
2020-12-26 19:44:09 -08:00
</Form>
2020-12-26 18:04:23 -08:00
</div>
2020-12-29 14:47:31 -08:00
<div className="misc-fields">
2020-12-26 19:44:09 -08:00
add social handles comp
2020-12-26 18:04:23 -08:00
<br/>
2020-12-26 19:44:09 -08:00
add tags comp
2020-12-26 18:04:23 -08:00
</div>
</div>
</>
);
}