From 8b8f221eb49a58dd621ebdac7872b53d2d0f38db Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 22 Feb 2023 18:39:37 -0800 Subject: [PATCH] Show streamTitle in header if set. Closes #2720 --- .../common/ContentHeader/ContentHeader.tsx | 12 ++---------- web/components/layouts/Main/Main.tsx | 9 +++++++-- web/components/ui/Content/Content.tsx | 2 -- web/components/ui/Content/DesktopContent.tsx | 3 --- web/components/ui/Content/MobileContent.tsx | 11 +---------- web/components/ui/Header/Header.tsx | 7 +------ web/pages/embed/chat/readwrite/index.tsx | 10 ++++++++-- 7 files changed, 19 insertions(+), 35 deletions(-) diff --git a/web/components/common/ContentHeader/ContentHeader.tsx b/web/components/common/ContentHeader/ContentHeader.tsx index 285235395..0a40c8a31 100644 --- a/web/components/common/ContentHeader/ContentHeader.tsx +++ b/web/components/common/ContentHeader/ContentHeader.tsx @@ -8,21 +8,13 @@ import styles from './ContentHeader.module.scss'; export type ContentHeaderProps = { name: string; - title: string; summary: string; tags: string[]; links: SocialLink[]; logo: string; }; -export const ContentHeader: FC = ({ - name, - title, - summary, - logo, - tags, - links, -}) => ( +export const ContentHeader: FC = ({ name, summary, logo, tags, links }) => (
@@ -31,7 +23,7 @@ export const ContentHeader: FC = ({

{name}

- {title || summary} + {summary}

{tags.length > 0 && tags.map(tag => #{tag} )} diff --git a/web/components/layouts/Main/Main.tsx b/web/components/layouts/Main/Main.tsx index aabdae415..09a1a646d 100644 --- a/web/components/layouts/Main/Main.tsx +++ b/web/components/layouts/Main/Main.tsx @@ -12,6 +12,7 @@ import { clientConfigStateAtom, fatalErrorStateAtom, appStateAtom, + serverStatusState, } from '../../stores/ClientConfigStore'; import { Content } from '../../ui/Content/Content'; import { Header } from '../../ui/Header/Header'; @@ -25,6 +26,7 @@ import styles from './Main.module.scss'; import { PushNotificationServiceWorker } from '../../workers/PushNotificationServiceWorker/PushNotificationServiceWorker'; import { AppStateOptions } from '../../stores/application-state'; import { Noscript } from '../../ui/Noscript/Noscript'; +import { ServerStatus } from '../../../interfaces/server-status.model'; const lockBodyStyle = ` body { @@ -46,7 +48,8 @@ const FatalErrorStateModal = dynamic( export const Main: FC = () => { const clientConfig = useRecoilValue(clientConfigStateAtom); - const { name, title, customStyles } = clientConfig; + const clientStatus = useRecoilValue(serverStatusState); + const { name, customStyles } = clientConfig; const isChatAvailable = useRecoilValue(isChatAvailableSelector); const fatalError = useRecoilValue(fatalErrorStateAtom); const appState = useRecoilValue(appStateAtom); @@ -54,12 +57,14 @@ export const Main: FC = () => { const layoutRef = useRef(null); const { chatDisabled } = clientConfig; const { videoAvailable } = appState; + const { online, streamTitle } = clientStatus; useEffect(() => { setupNoLinkReferrer(layoutRef.current); }, []); const isProduction = process.env.NODE_ENV === 'production'; + const headerText = online ? streamTitle || name : name; return ( <> @@ -143,7 +148,7 @@ export const Main: FC = () => {
{ {isMobile ? ( { ) : ( = ({ name, - streamTitle, summary, tags, socialHandles, @@ -65,7 +63,6 @@ export const DesktopContent: FC = ({
= ({ name, - streamTitle, summary, tags, socialHandles, @@ -87,14 +85,7 @@ export const MobileContent: FC = ({ const aboutTabContent = ( <> - +
diff --git a/web/components/ui/Header/Header.tsx b/web/components/ui/Header/Header.tsx index 3d3d3faa4..f9ae6ab77 100644 --- a/web/components/ui/Header/Header.tsx +++ b/web/components/ui/Header/Header.tsx @@ -22,12 +22,7 @@ export type HeaderComponentProps = { online: boolean; }; -export const Header: FC = ({ - name = 'Your stream title', - chatAvailable, - chatDisabled, - online, -}) => ( +export const Header: FC = ({ name, chatAvailable, chatDisabled, online }) => (
{online ? ( diff --git a/web/pages/embed/chat/readwrite/index.tsx b/web/pages/embed/chat/readwrite/index.tsx index 6d9c8c62c..0a6d2a73e 100644 --- a/web/pages/embed/chat/readwrite/index.tsx +++ b/web/pages/embed/chat/readwrite/index.tsx @@ -7,30 +7,36 @@ import { visibleChatMessagesSelector, clientConfigStateAtom, appStateAtom, + serverStatusState, } from '../../../../components/stores/ClientConfigStore'; import Header from '../../../../components/ui/Header/Header'; import { ClientConfig } from '../../../../interfaces/client-config.model'; import { AppStateOptions } from '../../../../components/stores/application-state'; +import { ServerStatus } from '../../../../interfaces/server-status.model'; export default function ReadWriteChatEmbed() { const currentUser = useRecoilValue(currentUserAtom); const messages = useRecoilValue(visibleChatMessagesSelector); const clientConfig = useRecoilValue(clientConfigStateAtom); + const clientStatus = useRecoilValue(serverStatusState); + const appState = useRecoilValue(appStateAtom); const { name, chatDisabled } = clientConfig; const { videoAvailable } = appState; + const { streamTitle, online } = clientStatus; if (!currentUser) { return null; } - const { id, displayName, isModerator } = currentUser; + const headerText = online ? streamTitle || name : name; + const { id, displayName, isModerator } = currentUser; return (
-
+