Add admin field for setting offline message. Closes #1901

This commit is contained in:
Gabe Kangas
2022-08-16 21:44:37 -07:00
parent 9749cc96c3
commit a521ba21d8
5 changed files with 22 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ import {
TEXTFIELD_PROPS_INSTANCE_URL, TEXTFIELD_PROPS_INSTANCE_URL,
TEXTFIELD_PROPS_SERVER_NAME, TEXTFIELD_PROPS_SERVER_NAME,
TEXTFIELD_PROPS_SERVER_SUMMARY, TEXTFIELD_PROPS_SERVER_SUMMARY,
TEXTFIELD_PROPS_SERVER_OFFLINE_MESSAGE,
API_YP_SWITCH, API_YP_SWITCH,
FIELD_PROPS_YP, FIELD_PROPS_YP,
FIELD_PROPS_NSFW, FIELD_PROPS_NSFW,
@@ -102,6 +103,15 @@ export default function EditInstanceDetails() {
onChange={handleFieldChange} onChange={handleFieldChange}
/> />
<TextFieldWithSubmit
fieldName="offlineMessage"
{...TEXTFIELD_PROPS_SERVER_OFFLINE_MESSAGE}
type={TEXTFIELD_TYPE_TEXTAREA}
value={formDataValues.offlineMessage}
initialValue={instanceDetails.offlineMessage}
onChange={handleFieldChange}
/>
{/* Logo section */} {/* Logo section */}
<EditLogo /> <EditLogo />

View File

@@ -119,8 +119,7 @@ export default function ContentComponent() {
<OfflineBanner <OfflineBanner
name={name} name={name}
text={ text={
offlineMessage || offlineMessage || 'Please follow and ask to get notified when the stream is live.'
'Stream is offline text goes here. Will create a new form to set it in the Admin.'
} }
/> />
)} )}

View File

@@ -36,6 +36,7 @@ export interface ConfigInstanceDetailsFields {
socialHandles: SocialHandle[]; socialHandles: SocialHandle[];
streamTitle: string; streamTitle: string;
summary: string; summary: string;
offlineMessage: string;
tags: string[]; tags: string[];
title: string; title: string;
welcomeMessage: string; welcomeMessage: string;

View File

@@ -19,6 +19,7 @@ export const API_RTMP_PORT = '/rtmpserverport';
export const API_S3_INFO = '/s3'; export const API_S3_INFO = '/s3';
export const API_SERVER_SUMMARY = '/serversummary'; export const API_SERVER_SUMMARY = '/serversummary';
export const API_SERVER_WELCOME_MESSAGE = '/welcomemessage'; export const API_SERVER_WELCOME_MESSAGE = '/welcomemessage';
export const API_SERVER_OFFLINE_MESSAGE = '/offlinemessage';
export const API_SERVER_NAME = '/name'; export const API_SERVER_NAME = '/name';
export const API_SOCIAL_HANDLES = '/socialhandles'; export const API_SOCIAL_HANDLES = '/socialhandles';
export const API_STREAM_KEY = '/key'; export const API_STREAM_KEY = '/key';
@@ -88,6 +89,14 @@ export const TEXTFIELD_PROPS_SERVER_SUMMARY = {
label: 'About', label: 'About',
tip: 'A brief blurb about you, your server, or what your stream is about.', tip: 'A brief blurb about you, your server, or what your stream is about.',
}; };
export const TEXTFIELD_PROPS_SERVER_OFFLINE_MESSAGE = {
apiPath: API_SERVER_OFFLINE_MESSAGE,
configPath: 'instanceDetails',
maxLength: 2500,
placeholder: 'An optional message you can leave people when your stream is not live.',
label: 'Offline Message',
tip: 'An optional message you can leave people when your stream is not live.',
};
export const TEXTFIELD_PROPS_SERVER_WELCOME_MESSAGE = { export const TEXTFIELD_PROPS_SERVER_WELCOME_MESSAGE = {
apiPath: API_SERVER_WELCOME_MESSAGE, apiPath: API_SERVER_WELCOME_MESSAGE,
configPath: 'instanceDetails', configPath: 'instanceDetails',

View File

@@ -21,6 +21,7 @@ export const initialServerConfigState: ConfigDetails = {
tags: [], tags: [],
title: '', title: '',
welcomeMessage: '', welcomeMessage: '',
offlineMessage: '',
}, },
ffmpegPath: '', ffmpegPath: '',
rtmpServerPort: '', rtmpServerPort: '',