Reorganize admin components to help bundling

This commit is contained in:
Gabe Kangas 2023-01-09 20:57:29 -08:00
parent 29882f1291
commit 7392ae8a54
No known key found for this signature in database
GPG key ID: 4345B2060657F330
67 changed files with 138 additions and 126 deletions

View file

@ -1,8 +1,8 @@
import { Modal, Button } from 'antd'; import { Modal, Button } from 'antd';
import { ExclamationCircleFilled, QuestionCircleFilled, StopTwoTone } from '@ant-design/icons'; import { ExclamationCircleFilled, QuestionCircleFilled, StopTwoTone } from '@ant-design/icons';
import { FC } from 'react'; import { FC } from 'react';
import { USER_ENABLED_TOGGLE, fetchData } from '../utils/apis'; import { USER_ENABLED_TOGGLE, fetchData } from '../../utils/apis';
import { User } from '../types/chat'; import { User } from '../../types/chat';
export type BanUserButtonProps = { export type BanUserButtonProps = {
user: User; user: User;

View file

@ -3,8 +3,8 @@ import format from 'date-fns/format';
import { SortOrder } from 'antd/lib/table/interface'; import { SortOrder } from 'antd/lib/table/interface';
import React, { FC } from 'react'; import React, { FC } from 'react';
import { StopTwoTone } from '@ant-design/icons'; import { StopTwoTone } from '@ant-design/icons';
import { User } from '../types/chat'; import { User } from '../../types/chat';
import { BANNED_IP_REMOVE, fetchData } from '../utils/apis'; import { BANNED_IP_REMOVE, fetchData } from '../../utils/apis';
function formatDisplayDate(date: string | Date) { function formatDisplayDate(date: string | Date) {
return format(new Date(date), 'MMM d H:mma'); return format(new Date(date), 'MMM d H:mma');

View file

@ -4,10 +4,10 @@ import { ColumnsType } from 'antd/es/table';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import { formatDistanceToNow } from 'date-fns'; import { formatDistanceToNow } from 'date-fns';
import { FC } from 'react'; import { FC } from 'react';
import { Client } from '../types/chat'; import { Client } from '../../types/chat';
import { UserPopover } from './UserPopover'; import { UserPopover } from './UserPopover';
import { BanUserButton } from './BanUserButton'; import { BanUserButton } from './BanUserButton';
import { formatUAstring } from '../utils/format'; import { formatUAstring } from '../../utils/format';
export type ClientTableProps = { export type ClientTableProps = {
data: Client[]; data: Client[];

View file

@ -1,8 +1,8 @@
import React, { FC, useState } from 'react'; import React, { FC, useState } from 'react';
import { Button, Input, Modal } from 'antd'; import { Button, Input, Modal } from 'antd';
import { STATUS_ERROR, STATUS_SUCCESS } from '../utils/input-statuses'; import { STATUS_ERROR, STATUS_SUCCESS } from '../../utils/input-statuses';
import { fetchData, FEDERATION_MESSAGE_SEND } from '../utils/apis'; import { fetchData, FEDERATION_MESSAGE_SEND } from '../../utils/apis';
const { TextArea } = Input; const { TextArea } = Input;

View file

@ -28,6 +28,7 @@ import { FormStatusIndicator } from './FormStatusIndicator';
const { Title } = Typography; const { Title } = Typography;
// eslint-disable-next-line import/prefer-default-export
export const CurrentVariantsTable: FC = () => { export const CurrentVariantsTable: FC = () => {
const [displayModal, setDisplayModal] = useState(false); const [displayModal, setDisplayModal] = useState(false);
const [modalProcessing, setModalProcessing] = useState(false); const [modalProcessing, setModalProcessing] = useState(false);

View file

@ -22,6 +22,7 @@ import { FormStatusIndicator } from './FormStatusIndicator';
const { Title } = Typography; const { Title } = Typography;
// eslint-disable-next-line import/prefer-default-export
export const EditCustomStyles: FC = () => { export const EditCustomStyles: FC = () => {
const [content, setContent] = useState('/* Enter custom CSS here */'); const [content, setContent] = useState('/* Enter custom CSS here */');
const [submitStatus, setSubmitStatus] = useState<StatusState>(null); const [submitStatus, setSubmitStatus] = useState<StatusState>(null);

View file

@ -22,7 +22,8 @@ const Tooltip = dynamic(() => import('antd').then(mod => mod.Tooltip));
const { Panel } = Collapse; const { Panel } = Collapse;
export const EditInstanceDetails = () => { // eslint-disable-next-line react/function-component-definition
export default function EditInstanceDetails() {
const [formDataValues, setFormDataValues] = useState(null); const [formDataValues, setFormDataValues] = useState(null);
const serverStatusData = useContext(ServerStatusContext); const serverStatusData = useContext(ServerStatusContext);
const { setMessage } = useContext(AlertMessageContext); const { setMessage } = useContext(AlertMessageContext);
@ -161,4 +162,4 @@ export const EditInstanceDetails = () => {
</Collapse> </Collapse>
</div> </div>
); );
}; }

View file

@ -25,6 +25,7 @@ import {
readableBytes, readableBytes,
} from '../../utils/images'; } from '../../utils/images';
// eslint-disable-next-line import/prefer-default-export
export const EditLogo: FC = () => { export const EditLogo: FC = () => {
const [logoUrl, setlogoUrl] = useState(null); const [logoUrl, setlogoUrl] = useState(null);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);

View file

@ -8,6 +8,7 @@ import { FIELD_PROPS_NSFW, FIELD_PROPS_YP } from '../../utils/config-constants';
const { Title } = Typography; const { Title } = Typography;
// eslint-disable-next-line import/prefer-default-export
export const EditYPDetails: FC = () => { export const EditYPDetails: FC = () => {
const [formDataValues, setFormDataValues] = useState(null); const [formDataValues, setFormDataValues] = useState(null);

View file

@ -20,19 +20,19 @@ import {
import classNames from 'classnames'; import classNames from 'classnames';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { upgradeVersionAvailable } from '../utils/apis'; import { upgradeVersionAvailable } from '../../utils/apis';
import { parseSecondsToDurationString } from '../utils/format'; import { parseSecondsToDurationString } from '../../utils/format';
import { OwncastLogo } from './common/OwncastLogo/OwncastLogo'; import { OwncastLogo } from '../common/OwncastLogo/OwncastLogo';
import { ServerStatusContext } from '../utils/server-status-context'; import { ServerStatusContext } from '../../utils/server-status-context';
import { AlertMessageContext } from '../utils/alert-message-context'; import { AlertMessageContext } from '../../utils/alert-message-context';
import { TextFieldWithSubmit } from './config/TextFieldWithSubmit'; import { TextFieldWithSubmit } from './TextFieldWithSubmit';
import { TEXTFIELD_PROPS_STREAM_TITLE } from '../utils/config-constants'; import { TEXTFIELD_PROPS_STREAM_TITLE } from '../../utils/config-constants';
import { ComposeFederatedPost } from './ComposeFederatedPost'; import { ComposeFederatedPost } from './ComposeFederatedPost';
import { UpdateArgs } from '../types/config-section'; import { UpdateArgs } from '../../types/config-section';
import FediverseIcon from '../assets/images/fediverse-black.png'; import FediverseIcon from '../../assets/images/fediverse-black.png';
// Lazy loaded components // Lazy loaded components

View file

@ -8,10 +8,9 @@ import {
ExclamationCircleFilled, ExclamationCircleFilled,
} from '@ant-design/icons'; } from '@ant-design/icons';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { fetchData, UPDATE_CHAT_MESSGAE_VIZ } from '../utils/apis'; import { fetchData, UPDATE_CHAT_MESSGAE_VIZ } from '../../utils/apis';
import { MessageType } from '../types/chat'; import { MessageType } from '../../types/chat';
import { OUTCOME_TIMEOUT } from '../pages/admin/chat/messages'; import { isEmptyObject } from '../../utils/format';
import { isEmptyObject } from '../utils/format';
// Lazy loaded components // Lazy loaded components
@ -40,7 +39,7 @@ export const MessageVisiblityToggle: FC<MessageToggleProps> = ({
const resetOutcome = () => { const resetOutcome = () => {
outcomeTimeout = setTimeout(() => { outcomeTimeout = setTimeout(() => {
setOutcome(0); setOutcome(0);
}, OUTCOME_TIMEOUT); }, 3000);
}; };
useEffect(() => () => { useEffect(() => () => {

View file

@ -6,8 +6,8 @@ import {
SafetyCertificateTwoTone, SafetyCertificateTwoTone,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { FC } from 'react'; import { FC } from 'react';
import { USER_SET_MODERATOR, fetchData } from '../utils/apis'; import { USER_SET_MODERATOR, fetchData } from '../../utils/apis';
import { User } from '../types/chat'; import { User } from '../../types/chat';
export type ModeratorUserButtonProps = { export type ModeratorUserButtonProps = {
user: User; user: User;

View file

@ -4,7 +4,7 @@ import React, { useState, useEffect, FC } from 'react';
import { Collapse, Typography, Skeleton } from 'antd'; import { Collapse, Typography, Skeleton } from 'antd';
import format from 'date-fns/format'; import format from 'date-fns/format';
import { fetchExternalData } from '../utils/apis'; import { fetchExternalData } from '../../utils/apis';
const { Panel } = Collapse; const { Panel } = Collapse;
const { Title, Link } = Typography; const { Title, Link } = Typography;

View file

@ -3,10 +3,10 @@ import { Card, Col, Row, Typography } from 'antd';
import Link from 'next/link'; import Link from 'next/link';
import { FC, useContext } from 'react'; import { FC, useContext } from 'react';
import { LogTable } from './LogTable'; import { LogTable } from './LogTable';
import { OwncastLogo } from './common/OwncastLogo/OwncastLogo'; import { OwncastLogo } from '../common/OwncastLogo/OwncastLogo';
import { NewsFeed } from './NewsFeed'; import { NewsFeed } from './NewsFeed';
import { ConfigDetails } from '../types/config-section'; import { ConfigDetails } from '../../types/config-section';
import { ServerStatusContext } from '../utils/server-status-context'; import { ServerStatusContext } from '../../utils/server-status-context';
const { Paragraph, Text } = Typography; const { Paragraph, Text } = Typography;

View file

@ -12,6 +12,7 @@ import {
} from '../../utils/input-statuses'; } from '../../utils/input-statuses';
import { FormStatusIndicator } from './FormStatusIndicator'; import { FormStatusIndicator } from './FormStatusIndicator';
// eslint-disable-next-line import/prefer-default-export
export const ResetYP: FC = () => { export const ResetYP: FC = () => {
const { setMessage } = useContext(AlertMessageContext); const { setMessage } = useContext(AlertMessageContext);

View file

@ -2,7 +2,7 @@ import { CheckCircleOutlined, ExclamationCircleOutlined } from '@ant-design/icon
import { Alert, Button, Col, Row, Statistic, Typography } from 'antd'; import { Alert, Button, Col, Row, Statistic, Typography } from 'antd';
import Link from 'next/link'; import Link from 'next/link';
import React, { FC, useContext } from 'react'; import React, { FC, useContext } from 'react';
import { ServerStatusContext } from '../utils/server-status-context'; import { ServerStatusContext } from '../../utils/server-status-context';
export type StreamHealthOverviewProps = { export type StreamHealthOverviewProps = {
showTroubleshootButton?: Boolean; showTroubleshootButton?: Boolean;

View file

@ -10,9 +10,9 @@ import dynamic from 'next/dynamic';
import { BanUserButton } from './BanUserButton'; import { BanUserButton } from './BanUserButton';
import { ModeratorUserButton } from './ModeratorUserButton'; import { ModeratorUserButton } from './ModeratorUserButton';
import { User, UserConnectionInfo } from '../types/chat'; import { User, UserConnectionInfo } from '../../types/chat';
import { formatDisplayDate } from './UserTable'; import { formatDisplayDate } from './UserTable';
import { formatUAstring } from '../utils/format'; import { formatUAstring } from '../../utils/format';
// Lazy loaded components // Lazy loaded components

View file

@ -2,7 +2,7 @@ import { Table } from 'antd';
import format from 'date-fns/format'; import format from 'date-fns/format';
import { SortOrder } from 'antd/lib/table/interface'; import { SortOrder } from 'antd/lib/table/interface';
import { FC } from 'react'; import { FC } from 'react';
import { User } from '../types/chat'; import { User } from '../../types/chat';
import { UserPopover } from './UserPopover'; import { UserPopover } from './UserPopover';
import { BanUserButton } from './BanUserButton'; import { BanUserButton } from './BanUserButton';

View file

@ -34,6 +34,7 @@ const SLIDER_COMMENTS = {
4: 'Highest latency, highest error tolerance', 4: 'Highest latency, highest error tolerance',
}; };
// eslint-disable-next-line import/prefer-default-export
export const VideoLatency: FC = () => { export const VideoLatency: FC = () => {
const [submitStatus, setSubmitStatus] = useState<StatusState>(null); const [submitStatus, setSubmitStatus] = useState<StatusState>(null);
const [selectedOption, setSelectedOption] = useState(null); const [selectedOption, setSelectedOption] = useState(null);

View file

@ -3,8 +3,8 @@ import format from 'date-fns/format';
import { SortOrder } from 'antd/lib/table/interface'; import { SortOrder } from 'antd/lib/table/interface';
import { formatDistanceToNow } from 'date-fns'; import { formatDistanceToNow } from 'date-fns';
import { FC } from 'react'; import { FC } from 'react';
import { User } from '../types/chat'; import { User } from '../../types/chat';
import { formatUAstring } from '../utils/format'; import { formatUAstring } from '../../utils/format';
export function formatDisplayDate(date: string | Date) { export function formatDisplayDate(date: string | Date) {
return format(new Date(date), 'MMM d H:mma'); return format(new Date(date), 'MMM d H:mma');

View file

@ -3,17 +3,17 @@ import React, { useContext, useEffect, useState } from 'react';
import { Button, Col, Collapse, Row, Slider, Space } from 'antd'; import { Button, Col, Collapse, Row, Slider, Space } from 'antd';
import Paragraph from 'antd/lib/typography/Paragraph'; import Paragraph from 'antd/lib/typography/Paragraph';
import Title from 'antd/lib/typography/Title'; import Title from 'antd/lib/typography/Title';
import { EditCustomStyles } from '../../../../../components/config/EditCustomStyles'; import { EditCustomStyles } from '../../EditCustomStyles';
import s from '../appearance.module.scss'; import s from './appearance.module.scss';
import { postConfigUpdateToAPI, RESET_TIMEOUT } from '../../../../../utils/config-constants'; import { postConfigUpdateToAPI, RESET_TIMEOUT } from '../../../../utils/config-constants';
import { import {
createInputStatus, createInputStatus,
StatusState, StatusState,
STATUS_ERROR, STATUS_ERROR,
STATUS_SUCCESS, STATUS_SUCCESS,
} from '../../../../../utils/input-statuses'; } from '../../../../utils/input-statuses';
import { ServerStatusContext } from '../../../../../utils/server-status-context'; import { ServerStatusContext } from '../../../../utils/server-status-context';
import { FormStatusIndicator } from '../../../../../components/config/FormStatusIndicator'; import { FormStatusIndicator } from '../../FormStatusIndicator';
const { Panel } = Collapse; const { Panel } = Collapse;
@ -79,6 +79,7 @@ const allAvailableValues = [
return obj; return obj;
}, {}); }, {});
// eslint-disable-next-line react/function-component-definition
function ColorPicker({ function ColorPicker({
value, value,
name, name,
@ -105,6 +106,7 @@ function ColorPicker({
</Col> </Col>
); );
} }
// eslint-disable-next-line react/function-component-definition
export default function Appearance() { export default function Appearance() {
const serverStatusData = useContext(ServerStatusContext); const serverStatusData = useContext(ServerStatusContext);
const { serverConfig } = serverStatusData; const { serverConfig } = serverStatusData;

View file

@ -4,8 +4,8 @@ import {
TextFieldWithSubmit, TextFieldWithSubmit,
TEXTFIELD_TYPE_TEXTAREA, TEXTFIELD_TYPE_TEXTAREA,
TEXTFIELD_TYPE_URL, TEXTFIELD_TYPE_URL,
} from '../../../../../components/config/TextFieldWithSubmit'; } from '../../TextFieldWithSubmit';
import { ServerStatusContext } from '../../../../../utils/server-status-context'; import { ServerStatusContext } from '../../../../utils/server-status-context';
import { import {
postConfigUpdateToAPI, postConfigUpdateToAPI,
TEXTFIELD_PROPS_INSTANCE_URL, TEXTFIELD_PROPS_INSTANCE_URL,
@ -16,13 +16,14 @@ import {
FIELD_PROPS_YP, FIELD_PROPS_YP,
FIELD_PROPS_NSFW, FIELD_PROPS_NSFW,
FIELD_PROPS_HIDE_VIEWER_COUNT, FIELD_PROPS_HIDE_VIEWER_COUNT,
} from '../../../../../utils/config-constants'; } from '../../../../utils/config-constants';
import { UpdateArgs } from '../../../../../types/config-section'; import { UpdateArgs } from '../../../../types/config-section';
import { ToggleSwitch } from '../../../../../components/config/ToggleSwitch'; import { ToggleSwitch } from '../../ToggleSwitch';
import { EditLogo } from '../../../../../components/config/EditLogo'; import { EditLogo } from '../../EditLogo';
const { Title } = Typography; const { Title } = Typography;
// eslint-disable-next-line react/function-component-definition
export default function EditInstanceDetails() { export default function EditInstanceDetails() {
const [formDataValues, setFormDataValues] = useState(null); const [formDataValues, setFormDataValues] = useState(null);
const serverStatusData = useContext(ServerStatusContext); const serverStatusData = useContext(ServerStatusContext);

View file

@ -1,14 +1,14 @@
/* eslint-disable react/no-array-index-key */ /* eslint-disable react/no-array-index-key */
import React, { useContext, useState, useEffect } from 'react'; import React, { useContext, useState, useEffect } from 'react';
import { Typography, Tag } from 'antd'; import { Typography, Tag } from 'antd';
import { ServerStatusContext } from '../../../../../utils/server-status-context'; import { ServerStatusContext } from '../../../../utils/server-status-context';
import { import {
FIELD_PROPS_TAGS, FIELD_PROPS_TAGS,
RESET_TIMEOUT, RESET_TIMEOUT,
postConfigUpdateToAPI, postConfigUpdateToAPI,
} from '../../../../../utils/config-constants'; } from '../../../../utils/config-constants';
import { TextField } from '../../../../../components/config/TextField'; import { TextField } from '../../TextField';
import { UpdateArgs } from '../../../../../types/config-section'; import { UpdateArgs } from '../../../../types/config-section';
import { import {
createInputStatus, createInputStatus,
StatusState, StatusState,
@ -16,11 +16,12 @@ import {
STATUS_PROCESSING, STATUS_PROCESSING,
STATUS_SUCCESS, STATUS_SUCCESS,
STATUS_WARNING, STATUS_WARNING,
} from '../../../../../utils/input-statuses'; } from '../../../../utils/input-statuses';
import { TAG_COLOR } from '../../../../../components/config/EditValueArray'; import { TAG_COLOR } from '../../EditValueArray';
const { Title } = Typography; const { Title } = Typography;
// eslint-disable-next-line react/function-component-definition
export default function EditInstanceTags() { export default function EditInstanceTags() {
const [newTagInput, setNewTagInput] = useState<string>(''); const [newTagInput, setNewTagInput] = useState<string>('');
const [submitStatus, setSubmitStatus] = useState<StatusState>(null); const [submitStatus, setSubmitStatus] = useState<StatusState>(null);

View file

@ -6,23 +6,24 @@ import { bbedit } from '@uiw/codemirror-theme-bbedit';
import { markdown, markdownLanguage } from '@codemirror/lang-markdown'; import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
import { languages } from '@codemirror/language-data'; import { languages } from '@codemirror/language-data';
import { ServerStatusContext } from '../../../../../utils/server-status-context'; import { ServerStatusContext } from '../../../../utils/server-status-context';
import { import {
postConfigUpdateToAPI, postConfigUpdateToAPI,
RESET_TIMEOUT, RESET_TIMEOUT,
API_CUSTOM_CONTENT, API_CUSTOM_CONTENT,
} from '../../../../../utils/config-constants'; } from '../../../../utils/config-constants';
import { import {
createInputStatus, createInputStatus,
StatusState, StatusState,
STATUS_ERROR, STATUS_ERROR,
STATUS_PROCESSING, STATUS_PROCESSING,
STATUS_SUCCESS, STATUS_SUCCESS,
} from '../../../../../utils/input-statuses'; } from '../../../../utils/input-statuses';
import { FormStatusIndicator } from '../../../../../components/config/FormStatusIndicator'; import { FormStatusIndicator } from '../../FormStatusIndicator';
const { Title } = Typography; const { Title } = Typography;
// eslint-disable-next-line react/function-component-definition
export default function EditPageContent() { export default function EditPageContent() {
const [content, setContent] = useState(''); const [content, setContent] = useState('');
const [submitStatus, setSubmitStatus] = useState<StatusState>(null); const [submitStatus, setSubmitStatus] = useState<StatusState>(null);

View file

@ -2,33 +2,30 @@ import React, { useState, useContext, useEffect } from 'react';
import { Typography, Table, Button, Modal, Input } from 'antd'; import { Typography, Table, Button, Modal, Input } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { CaretDownOutlined, CaretUpOutlined, DeleteOutlined } from '@ant-design/icons'; import { CaretDownOutlined, CaretUpOutlined, DeleteOutlined } from '@ant-design/icons';
import { SocialDropdown } from '../../../../../components/config/SocialDropdown'; import { SocialDropdown } from '../../SocialDropdown';
import { fetchData, SOCIAL_PLATFORMS_LIST } from '../../../../../utils/apis'; import { fetchData, SOCIAL_PLATFORMS_LIST } from '../../../../utils/apis';
import { ServerStatusContext } from '../../../../../utils/server-status-context'; import { ServerStatusContext } from '../../../../utils/server-status-context';
import { import {
API_SOCIAL_HANDLES, API_SOCIAL_HANDLES,
postConfigUpdateToAPI, postConfigUpdateToAPI,
RESET_TIMEOUT, RESET_TIMEOUT,
DEFAULT_SOCIAL_HANDLE, DEFAULT_SOCIAL_HANDLE,
OTHER_SOCIAL_HANDLE_OPTION, OTHER_SOCIAL_HANDLE_OPTION,
} from '../../../../../utils/config-constants'; } from '../../../../utils/config-constants';
import { SocialHandle, UpdateArgs } from '../../../../../types/config-section'; import { SocialHandle, UpdateArgs } from '../../../../types/config-section';
import { import {
isValidMatrixAccount, isValidMatrixAccount,
isValidAccount, isValidAccount,
isValidUrl, isValidUrl,
DEFAULT_TEXTFIELD_URL_PATTERN, DEFAULT_TEXTFIELD_URL_PATTERN,
} from '../../../../../utils/urls'; } from '../../../../utils/urls';
import { TextField } from '../../../../../components/config/TextField'; import { TextField } from '../../TextField';
import { import { createInputStatus, STATUS_ERROR, STATUS_SUCCESS } from '../../../../utils/input-statuses';
createInputStatus, import { FormStatusIndicator } from '../../FormStatusIndicator';
STATUS_ERROR,
STATUS_SUCCESS,
} from '../../../../../utils/input-statuses';
import { FormStatusIndicator } from '../../../../../components/config/FormStatusIndicator';
const { Title } = Typography; const { Title } = Typography;
// eslint-disable-next-line react/function-component-definition
export default function EditSocialLinks() { export default function EditSocialLinks() {
const [availableIconsList, setAvailableIconsList] = useState([]); const [availableIconsList, setAvailableIconsList] = useState([]);
const [currentSocialHandles, setCurrentSocialHandles] = useState([]); const [currentSocialHandles, setCurrentSocialHandles] = useState([]);

View file

@ -5,6 +5,7 @@ import EditInstanceTags from './EditInstanceTags';
import EditSocialLinks from './EditSocialLinks'; import EditSocialLinks from './EditSocialLinks';
import EditPageContent from './EditPageContent'; import EditPageContent from './EditPageContent';
// eslint-disable-next-line react/function-component-definition
export default function PublicFacingDetails() { export default function PublicFacingDetails() {
return ( return (
<div className="config-public-details-page"> <div className="config-public-details-page">

View file

@ -1,27 +1,27 @@
import { Button, Collapse } from 'antd'; import { Button, Collapse } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import React, { useContext, useState, useEffect } from 'react'; import React, { useContext, useState, useEffect } from 'react';
import { UpdateArgs } from '../../../../../types/config-section'; import { UpdateArgs } from '../../../../types/config-section';
import { ServerStatusContext } from '../../../../../utils/server-status-context'; import { ServerStatusContext } from '../../../../utils/server-status-context';
import { AlertMessageContext } from '../../../../../utils/alert-message-context'; import { AlertMessageContext } from '../../../../utils/alert-message-context';
import { import {
postConfigUpdateToAPI, postConfigUpdateToAPI,
API_S3_INFO, API_S3_INFO,
RESET_TIMEOUT, RESET_TIMEOUT,
S3_TEXT_FIELDS_INFO, S3_TEXT_FIELDS_INFO,
} from '../../../../../utils/config-constants'; } from '../../../../utils/config-constants';
import { import {
createInputStatus, createInputStatus,
StatusState, StatusState,
STATUS_ERROR, STATUS_ERROR,
STATUS_PROCESSING, STATUS_PROCESSING,
STATUS_SUCCESS, STATUS_SUCCESS,
} from '../../../../../utils/input-statuses'; } from '../../../../utils/input-statuses';
import { TextField } from '../../../../../components/config/TextField'; import { TextField } from '../../TextField';
import { FormStatusIndicator } from '../../../../../components/config/FormStatusIndicator'; import { FormStatusIndicator } from '../../FormStatusIndicator';
import { isValidUrl } from '../../../../../utils/urls'; import { isValidUrl } from '../../../../utils/urls';
import { ToggleSwitch } from '../../../../../components/config/ToggleSwitch'; import { ToggleSwitch } from '../../ToggleSwitch';
const { Panel } = Collapse; const { Panel } = Collapse;
@ -64,6 +64,7 @@ function checkSaveable(formValues: any, currentValues: any) {
return false; return false;
} }
// eslint-disable-next-line react/function-component-definition
export default function EditStorage() { export default function EditStorage() {
const [formDataValues, setFormDataValues] = useState(null); const [formDataValues, setFormDataValues] = useState(null);
const [submitStatus, setSubmitStatus] = useState<StatusState>(null); const [submitStatus, setSubmitStatus] = useState<StatusState>(null);

View file

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import { EditInstanceDetails } from '../../../../../components/config/EditInstanceDetails2'; import EditInstanceDetails from '../../EditInstanceDetails2';
// eslint-disable-next-line react/function-component-definition
export default function ConfigServerDetails() { export default function ConfigServerDetails() {
return ( return (
<div className="config-server-details-form"> <div className="config-server-details-form">

View file

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import EditStorage from './EditStorage'; import EditStorage from './EditStorage';
// eslint-disable-next-line react/function-component-definition
export default function ConfigStorageInfo() { export default function ConfigStorageInfo() {
return ( return (
<> <>

View file

@ -1,9 +1,9 @@
import React, { useContext, useState } from 'react'; import React, { useContext, useState } from 'react';
import { Table, Space, Button, Typography, Alert, Input, Form } from 'antd'; import { Table, Space, Button, Typography, Alert, Input, Form } from 'antd';
import { DeleteOutlined, EyeOutlined, PlusOutlined } from '@ant-design/icons'; import { DeleteOutlined, EyeOutlined, PlusOutlined } from '@ant-design/icons';
import { ServerStatusContext } from '../../../../../utils/server-status-context'; import { ServerStatusContext } from '../../../../utils/server-status-context';
import { fetchData, UPDATE_STREAM_KEYS } from '../../../../../utils/apis'; import { fetchData, UPDATE_STREAM_KEYS } from '../../../../utils/apis';
const { Paragraph } = Typography; const { Paragraph } = Typography;
const { Item } = Form; const { Item } = Form;

View file

@ -2,7 +2,7 @@ import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
import { Button, Checkbox, Form, Input, Modal, Space, Table, Typography } from 'antd'; import { Button, Checkbox, Form, Input, Modal, Space, Table, Typography } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import { FormStatusIndicator } from '../../components/config/FormStatusIndicator'; import { FormStatusIndicator } from '../../components/admin/FormStatusIndicator';
import { ExternalAction } from '../../interfaces/external-action'; import { ExternalAction } from '../../interfaces/external-action';
import { import {
API_EXTERNAL_ACTIONS, API_EXTERNAL_ACTIONS,

View file

@ -2,7 +2,7 @@ import { DeleteOutlined } from '@ant-design/icons';
import { Button, Space, Table, Typography, Upload } from 'antd'; import { Button, Space, Table, Typography, Upload } from 'antd';
import { RcFile } from 'antd/lib/upload'; import { RcFile } from 'antd/lib/upload';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import FormStatusIndicator from '../../../components/config/FormStatusIndicator'; import FormStatusIndicator from '../../../components/admin/FormStatusIndicator';
import { DELETE_EMOJI, fetchData, UPLOAD_EMOJI } from '../../../utils/apis'; import { DELETE_EMOJI, fetchData, UPLOAD_EMOJI } from '../../../utils/apis';

View file

@ -13,8 +13,8 @@ import {
UPDATE_CHAT_MESSGAE_VIZ, UPDATE_CHAT_MESSGAE_VIZ,
} from '../../../utils/apis'; } from '../../../utils/apis';
import { isEmptyObject } from '../../../utils/format'; import { isEmptyObject } from '../../../utils/format';
import { MessageVisiblityToggle } from '../../../components/MessageVisiblityToggle'; import { MessageVisiblityToggle } from '../../../components/admin/MessageVisiblityToggle';
import { UserPopover } from '../../../components/UserPopover'; import { UserPopover } from '../../../components/admin/UserPopover';
const { Title } = Typography; const { Title } = Typography;

View file

@ -8,9 +8,9 @@ import {
MODERATORS, MODERATORS,
BANNED_IPS, BANNED_IPS,
} from '../../../utils/apis'; } from '../../../utils/apis';
import { UserTable } from '../../../components/UserTable'; import { UserTable } from '../../../components/admin/UserTable';
import { ClientTable } from '../../../components/ClientTable'; import { ClientTable } from '../../../components/admin/ClientTable';
import { BannedIPsTable } from '../../../components/BannedIPsTable'; import { BannedIPsTable } from '../../../components/admin/BannedIPsTable';
export const FETCH_INTERVAL = 10 * 1000; // 10 sec export const FETCH_INTERVAL = 10 * 1000; // 10 sec

View file

@ -1,9 +1,9 @@
import { Typography } from 'antd'; import { Typography } from 'antd';
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import { TEXTFIELD_TYPE_TEXTAREA } from '../../components/config/TextField'; import { TEXTFIELD_TYPE_TEXTAREA } from '../../components/admin/TextField';
import { TextFieldWithSubmit } from '../../components/config/TextFieldWithSubmit'; import { TextFieldWithSubmit } from '../../components/admin/TextFieldWithSubmit';
import { ToggleSwitch } from '../../components/config/ToggleSwitch'; import { ToggleSwitch } from '../../components/admin/ToggleSwitch';
import { EditValueArray } from '../../components/config/EditValueArray'; import { EditValueArray } from '../../components/admin/EditValueArray';
import { import {
createInputStatus, createInputStatus,
StatusState, StatusState,

View file

@ -6,10 +6,10 @@ import {
TEXTFIELD_TYPE_TEXT, TEXTFIELD_TYPE_TEXT,
TEXTFIELD_TYPE_TEXTAREA, TEXTFIELD_TYPE_TEXTAREA,
TEXTFIELD_TYPE_URL, TEXTFIELD_TYPE_URL,
} from '../../components/config/TextField'; } from '../../components/admin/TextField';
import { TextFieldWithSubmit } from '../../components/config/TextFieldWithSubmit'; import { TextFieldWithSubmit } from '../../components/admin/TextFieldWithSubmit';
import { ToggleSwitch } from '../../components/config/ToggleSwitch'; import { ToggleSwitch } from '../../components/admin/ToggleSwitch';
import { EditValueArray } from '../../components/config/EditValueArray'; import { EditValueArray } from '../../components/admin/EditValueArray';
import { UpdateArgs } from '../../types/config-section'; import { UpdateArgs } from '../../types/config-section';
import { import {
FIELD_PROPS_ENABLE_FEDERATION, FIELD_PROPS_ENABLE_FEDERATION,

View file

@ -2,14 +2,14 @@ import { Alert, Button, Col, Row, Typography } from 'antd';
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import Link from 'next/link'; import Link from 'next/link';
import Discord from '../../components/config/notification/discord'; import Discord from '../../components/admin/notification/discord';
import Browser from '../../components/config/notification/browser'; import Browser from '../../components/admin/notification/browser';
import Twitter from '../../components/config/notification/twitter'; import Twitter from '../../components/admin/notification/twitter';
import Federation from '../../components/config/notification/federation'; import Federation from '../../components/admin/notification/federation';
import { import {
TextFieldWithSubmit, TextFieldWithSubmit,
TEXTFIELD_TYPE_URL, TEXTFIELD_TYPE_URL,
} from '../../components/config/TextFieldWithSubmit'; } from '../../components/admin/TextFieldWithSubmit';
import { TEXTFIELD_PROPS_FEDERATION_INSTANCE_URL } from '../../utils/config-constants'; import { TEXTFIELD_PROPS_FEDERATION_INSTANCE_URL } from '../../utils/config-constants';
import { ServerStatusContext } from '../../utils/server-status-context'; import { ServerStatusContext } from '../../utils/server-status-context';
import { UpdateArgs } from '../../types/config-section'; import { UpdateArgs } from '../../types/config-section';

View file

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { Typography } from 'antd'; import { Typography } from 'antd';
import EditSocialLinks from './config/general/components/EditSocialLinks'; import EditSocialLinks from '../../components/admin/config/general/EditSocialLinks';
const { Title } = Typography; const { Title } = Typography;

View file

@ -1,8 +1,8 @@
import { Col, Collapse, Row, Typography } from 'antd'; import { Col, Collapse, Row, Typography } from 'antd';
import React from 'react'; import React from 'react';
import { CodecSelector as VideoCodecSelector } from '../../components/config/CodecSelector'; import { CodecSelector as VideoCodecSelector } from '../../components/admin/CodecSelector';
import { VideoLatency } from '../../components/config/VideoLatency'; import { VideoLatency } from '../../components/admin/VideoLatency';
import { CurrentVariantsTable } from '../../components/config/CurrentVariantsTable'; import { CurrentVariantsTable } from '../../components/admin/CurrentVariantsTable';
const { Panel } = Collapse; const { Panel } = Collapse;
const { Title } = Typography; const { Title } = Typography;

View file

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import { Tabs } from 'antd'; import { Tabs } from 'antd';
import GeneralConfig from './components/GeneralConfig'; import GeneralConfig from '../../../../components/admin/config/general/GeneralConfig';
import AppearanceConfig from './components/AppearanceConfig'; import AppearanceConfig from '../../../../components/admin/config/general/AppearanceConfig';
export default function PublicFacingDetails() { export default function PublicFacingDetails() {
return ( return (

View file

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import { Tabs } from 'antd'; import { Tabs } from 'antd';
import StreamKeys from './components/StreamKeys'; import StreamKeys from '../../../../components/admin/config/server/StreamKeys';
import ServerConfig from './components/ServerConfig'; import ServerConfig from '../../../../components/admin/config/server/ServerConfig';
import StorageConfig from './components/StorageConfig'; import StorageConfig from '../../../../components/admin/config/server/StorageConfig';
export default function PublicFacingDetails() { export default function PublicFacingDetails() {
return ( return (

View file

@ -2,8 +2,8 @@ import { BulbOutlined, LaptopOutlined, SaveOutlined } from '@ant-design/icons';
import { Row, Col, Typography } from 'antd'; import { Row, Col, Typography } from 'antd';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { fetchData, FETCH_INTERVAL, HARDWARE_STATS } from '../../utils/apis'; import { fetchData, FETCH_INTERVAL, HARDWARE_STATS } from '../../utils/apis';
import { Chart } from '../../components/Chart'; import { Chart } from '../../components/admin/Chart';
import { StatisticItem } from '../../components/StatisticItem'; import { StatisticItem } from '../../components/admin/StatisticItem';
// TODO: FIX TS WARNING FROM THIS. // TODO: FIX TS WARNING FROM THIS.
// interface TimedValue { // interface TimedValue {

View file

@ -4,16 +4,16 @@ import { Skeleton, Card, Statistic, Row, Col } 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 ServerStatusProvider, { ServerStatusContext } from '../../utils/server-status-context'; import ServerStatusProvider, { ServerStatusContext } from '../../utils/server-status-context';
import { LogTable } from '../../components/LogTable'; import { LogTable } from '../../components/admin/LogTable';
import { Offline } from '../../components/Offline'; import { Offline } from '../../components/admin/Offline';
import { StreamHealthOverview } from '../../components/StreamHealthOverview'; import { StreamHealthOverview } from '../../components/admin/StreamHealthOverview';
import { LOGS_WARN, fetchData, FETCH_INTERVAL } from '../../utils/apis'; import { LOGS_WARN, fetchData, FETCH_INTERVAL } from '../../utils/apis';
import { formatIPAddress, isEmptyObject } from '../../utils/format'; import { formatIPAddress, isEmptyObject } from '../../utils/format';
import { NewsFeed } from '../../components/NewsFeed'; import { NewsFeed } from '../../components/admin/NewsFeed';
import AlertMessageProvider from '../../utils/alert-message-context'; import AlertMessageProvider from '../../utils/alert-message-context';
import { MainLayout } from '../../components/MainLayout'; import { MainLayout } from '../../components/admin/MainLayout';
function streamDetailsFormatter(streamDetails) { function streamDetailsFormatter(streamDetails) {
return ( return (

View file

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { LogTable } from '../../components/LogTable'; import { LogTable } from '../../components/admin/LogTable';
import { LOGS_ALL, fetchData } from '../../utils/apis'; import { LOGS_ALL, fetchData } from '../../utils/apis';

View file

@ -4,8 +4,8 @@ import { Row, Col, Typography, Space, Statistic, Card, Alert, Spin } from 'antd'
import React, { ReactNode, useEffect, useState } from 'react'; import React, { ReactNode, useEffect, useState } from 'react';
import { ClockCircleOutlined, WarningOutlined, WifiOutlined } from '@ant-design/icons'; import { ClockCircleOutlined, WarningOutlined, WifiOutlined } from '@ant-design/icons';
import { fetchData, FETCH_INTERVAL, API_STREAM_HEALTH_METRICS } from '../../utils/apis'; import { fetchData, FETCH_INTERVAL, API_STREAM_HEALTH_METRICS } from '../../utils/apis';
import { Chart } from '../../components/Chart'; import { Chart } from '../../components/admin/Chart';
import { StreamHealthOverview } from '../../components/StreamHealthOverview'; import { StreamHealthOverview } from '../../components/admin/StreamHealthOverview';
interface TimedValue { interface TimedValue {
time: Date; time: Date;

View file

@ -2,9 +2,9 @@ import React, { useState, useEffect, useContext } from 'react';
import { Row, Col, Typography, Menu, Dropdown, Spin, Alert } from 'antd'; import { Row, Col, Typography, Menu, Dropdown, Spin, Alert } from 'antd';
import { DownOutlined, UserOutlined } from '@ant-design/icons'; import { DownOutlined, UserOutlined } from '@ant-design/icons';
import { getUnixTime, sub } from 'date-fns'; import { getUnixTime, sub } from 'date-fns';
import { Chart } from '../../components/Chart'; import { Chart } from '../../components/admin/Chart';
import { StatisticItem } from '../../components/StatisticItem'; import { StatisticItem } from '../../components/admin/StatisticItem';
import { ViewerTable } from '../../components/ViewerTable'; import { ViewerTable } from '../../components/admin/ViewerTable';
import { ServerStatusContext } from '../../utils/server-status-context'; import { ServerStatusContext } from '../../utils/server-status-context';

View file

@ -1,7 +1,7 @@
// DEFAULT VALUES // DEFAULT VALUES
import { fetchData, SERVER_CONFIG_UPDATE_URL } from './apis'; import { fetchData, SERVER_CONFIG_UPDATE_URL } from './apis';
import { ApiPostArgs, VideoVariant, SocialHandle } from '../types/config-section'; import { ApiPostArgs, VideoVariant, SocialHandle } from '../types/config-section';
import { TEXTFIELD_TYPE_URL } from '../components/config/TextField'; import { TEXTFIELD_TYPE_URL } from '../components/admin/TextField';
import { DEFAULT_TEXTFIELD_URL_PATTERN } from './urls'; import { DEFAULT_TEXTFIELD_URL_PATTERN } from './urls';
export const TEXT_MAXLENGTH = 255; export const TEXT_MAXLENGTH = 255;