Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
fix(web): set page title on chat embed pages (#4820)
John Costa263d0cff0bcc
diff --git a/web/i18n/en/translation.json b/web/i18n/en/translation.jsonindex 6cf5135631..189fa582a2 100644--- a/web/i18n/en/translation.json+++ b/web/i18n/en/translation.json@@ -221,7 +221,8 @@"offlineBasic": "This stream is offline. Check back soon!","offlineFediverseOnly": "This stream is offline. <span class='follow-link'>Follow</span> {{fediverseAccount}} on the Fediverse to see the next time {{streamer}} goes live.","offlineNotifyAndFediverse": "This stream is offline. You can <span class='notify-link'>be notified</span> the next time {{streamer}} goes live or <span class='follow-link'>follow</span> {{fediverseAccount}} on the Fediverse.",- "offlineNotifyOnly": "This stream is offline. <span class='notify-link'>Be notified</span> the next time {{streamer}} goes live."+ "offlineNotifyOnly": "This stream is offline. <span class='notify-link'>Be notified</span> the next time {{streamer}} goes live.",+ "chatEmbedTitle": "{{name}} Chat"},"Testing": {"itemCount": "You have {{count}} items",@@ -229,4 +230,4 @@"noPluralKey": "This key has no plural variants - {{count}} things","simpleKey": "Simple translation text"}-}\ No newline at end of file+}diff --git a/web/pages/embed/chat/readonly/index.tsx b/web/pages/embed/chat/readonly/index.tsxindex 3248b86b89..6bd6727721 100644--- a/web/pages/embed/chat/readonly/index.tsx+++ b/web/pages/embed/chat/readonly/index.tsx@@ -1,4 +1,6 @@import { useRecoilValue } from 'recoil';+import Head from 'next/head';+import { useTranslation } from 'next-export-i18n';import { ErrorBoundary } from 'react-error-boundary';import { ChatMessage } from '../../../../interfaces/chat-message.model';import { ChatContainer } from '../../../../components/chat/ChatContainer/ChatContainer';@@ -6,22 +8,34 @@ import {ClientConfigStore,currentUserAtom,visibleChatMessagesSelector,+ clientConfigStateAtom,isChatAvailableSelector,} from '../../../../components/stores/ClientConfigStore';+import { ClientConfig } from '../../../../interfaces/client-config.model';import { Theme } from '../../../../components/theme/Theme';import { ComponentError } from '../../../../components/ui/ComponentError/ComponentError';+import { Localization } from '../../../../types/localization';export default function ReadOnlyChatEmbed() {const currentUser = useRecoilValue(currentUserAtom);const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);+ const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);const isChatAvailable = useRecoilValue(isChatAvailableSelector);+ const { name } = clientConfig;+ const { t } = useTranslation();++ const pageTitle = name ? t(Localization.Frontend.chatEmbedTitle, { name }) : 'Chat';+return (<div>+ <Head>+ <title>{pageTitle}</title>+ </Head><ErrorBoundary// eslint-disable-next-line react/no-unstable-nested-componentsfallbackRender={({ error }) => (- <ComponentError componentName="ReadWriteChatEmbed" message={error.message} />+ <ComponentError componentName="ReadOnlyChatEmbed" message={error.message} />)}><ClientConfigStore />diff --git a/web/pages/embed/chat/readwrite/index.tsx b/web/pages/embed/chat/readwrite/index.tsxindex e75a1b428c..965e0f9e5f 100644--- a/web/pages/embed/chat/readwrite/index.tsx+++ b/web/pages/embed/chat/readwrite/index.tsx@@ -1,8 +1,9 @@/* eslint-disable react/no-unknown-property */import { useRecoilValue } from 'recoil';import { useEffect } from 'react';-import { ErrorBoundary } from 'react-error-boundary';+import Head from 'next/head';import { useTranslation } from 'next-export-i18n';+import { ErrorBoundary } from 'react-error-boundary';import { ChatMessage } from '../../../../interfaces/chat-message.model';import { ChatContainer } from '../../../../components/chat/ChatContainer/ChatContainer';import {@@ -50,6 +51,8 @@ export default function ReadWriteChatEmbed() {const headerText = online ? streamTitle || name : name;+ const pageTitle = name ? t(Localization.Frontend.chatEmbedTitle, { name }) : 'Chat';+// This is a hack to force a specific body background color for just this page.useEffect(() => {document.body.classList.add('body-background');@@ -57,6 +60,9 @@ export default function ReadWriteChatEmbed() {return (<div>+ <Head>+ <title>{pageTitle}</title>+ </Head><style jsx global>{`.body-background {diff --git a/web/types/localization.ts b/web/types/localization.tsindex 9b1186b3a3..3ba45ca53a 100644--- a/web/types/localization.ts+++ b/web/types/localization.ts@@ -9,6 +9,7 @@ export const Localization = {*/Frontend: {// Chat interface+ chatEmbedTitle: 'Frontend.chatEmbedTitle',chatOffline: 'Chat is offline',chatDisabled: 'Chat is disabled',chatWillBeAvailable: 'Chat will be available when the stream is live',