Show streamTitle in header if set. Closes #2720
This commit is contained in:
@@ -8,21 +8,13 @@ import styles from './ContentHeader.module.scss';
|
|||||||
|
|
||||||
export type ContentHeaderProps = {
|
export type ContentHeaderProps = {
|
||||||
name: string;
|
name: string;
|
||||||
title: string;
|
|
||||||
summary: string;
|
summary: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
links: SocialLink[];
|
links: SocialLink[];
|
||||||
logo: string;
|
logo: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ContentHeader: FC<ContentHeaderProps> = ({
|
export const ContentHeader: FC<ContentHeaderProps> = ({ name, summary, logo, tags, links }) => (
|
||||||
name,
|
|
||||||
title,
|
|
||||||
summary,
|
|
||||||
logo,
|
|
||||||
tags,
|
|
||||||
links,
|
|
||||||
}) => (
|
|
||||||
<div className={styles.root}>
|
<div className={styles.root}>
|
||||||
<div className={styles.logoTitleSection}>
|
<div className={styles.logoTitleSection}>
|
||||||
<div className={styles.logo}>
|
<div className={styles.logo}>
|
||||||
@@ -31,7 +23,7 @@ export const ContentHeader: FC<ContentHeaderProps> = ({
|
|||||||
<div className={styles.titleSection}>
|
<div className={styles.titleSection}>
|
||||||
<h2 className={cn(styles.title, styles.row, 'header-title')}>{name}</h2>
|
<h2 className={cn(styles.title, styles.row, 'header-title')}>{name}</h2>
|
||||||
<h3 className={cn(styles.subtitle, styles.row, 'header-subtitle')}>
|
<h3 className={cn(styles.subtitle, styles.row, 'header-subtitle')}>
|
||||||
<Linkify>{title || summary}</Linkify>
|
<Linkify>{summary}</Linkify>
|
||||||
</h3>
|
</h3>
|
||||||
<div className={cn(styles.tagList, styles.row)}>
|
<div className={cn(styles.tagList, styles.row)}>
|
||||||
{tags.length > 0 && tags.map(tag => <span key={tag}>#{tag} </span>)}
|
{tags.length > 0 && tags.map(tag => <span key={tag}>#{tag} </span>)}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
clientConfigStateAtom,
|
clientConfigStateAtom,
|
||||||
fatalErrorStateAtom,
|
fatalErrorStateAtom,
|
||||||
appStateAtom,
|
appStateAtom,
|
||||||
|
serverStatusState,
|
||||||
} from '../../stores/ClientConfigStore';
|
} from '../../stores/ClientConfigStore';
|
||||||
import { Content } from '../../ui/Content/Content';
|
import { Content } from '../../ui/Content/Content';
|
||||||
import { Header } from '../../ui/Header/Header';
|
import { Header } from '../../ui/Header/Header';
|
||||||
@@ -25,6 +26,7 @@ import styles from './Main.module.scss';
|
|||||||
import { PushNotificationServiceWorker } from '../../workers/PushNotificationServiceWorker/PushNotificationServiceWorker';
|
import { PushNotificationServiceWorker } from '../../workers/PushNotificationServiceWorker/PushNotificationServiceWorker';
|
||||||
import { AppStateOptions } from '../../stores/application-state';
|
import { AppStateOptions } from '../../stores/application-state';
|
||||||
import { Noscript } from '../../ui/Noscript/Noscript';
|
import { Noscript } from '../../ui/Noscript/Noscript';
|
||||||
|
import { ServerStatus } from '../../../interfaces/server-status.model';
|
||||||
|
|
||||||
const lockBodyStyle = `
|
const lockBodyStyle = `
|
||||||
body {
|
body {
|
||||||
@@ -46,7 +48,8 @@ const FatalErrorStateModal = dynamic(
|
|||||||
|
|
||||||
export const Main: FC = () => {
|
export const Main: FC = () => {
|
||||||
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
||||||
const { name, title, customStyles } = clientConfig;
|
const clientStatus = useRecoilValue<ServerStatus>(serverStatusState);
|
||||||
|
const { name, customStyles } = clientConfig;
|
||||||
const isChatAvailable = useRecoilValue<boolean>(isChatAvailableSelector);
|
const isChatAvailable = useRecoilValue<boolean>(isChatAvailableSelector);
|
||||||
const fatalError = useRecoilValue<DisplayableError>(fatalErrorStateAtom);
|
const fatalError = useRecoilValue<DisplayableError>(fatalErrorStateAtom);
|
||||||
const appState = useRecoilValue<AppStateOptions>(appStateAtom);
|
const appState = useRecoilValue<AppStateOptions>(appStateAtom);
|
||||||
@@ -54,12 +57,14 @@ export const Main: FC = () => {
|
|||||||
const layoutRef = useRef<HTMLDivElement>(null);
|
const layoutRef = useRef<HTMLDivElement>(null);
|
||||||
const { chatDisabled } = clientConfig;
|
const { chatDisabled } = clientConfig;
|
||||||
const { videoAvailable } = appState;
|
const { videoAvailable } = appState;
|
||||||
|
const { online, streamTitle } = clientStatus;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setupNoLinkReferrer(layoutRef.current);
|
setupNoLinkReferrer(layoutRef.current);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
|
const headerText = online ? streamTitle || name : name;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -143,7 +148,7 @@ export const Main: FC = () => {
|
|||||||
|
|
||||||
<Layout ref={layoutRef} className={styles.layout}>
|
<Layout ref={layoutRef} className={styles.layout}>
|
||||||
<Header
|
<Header
|
||||||
name={title || name}
|
name={headerText}
|
||||||
chatAvailable={isChatAvailable}
|
chatAvailable={isChatAvailable}
|
||||||
chatDisabled={chatDisabled}
|
chatDisabled={chatDisabled}
|
||||||
online={videoAvailable}
|
online={videoAvailable}
|
||||||
|
|||||||
@@ -277,7 +277,6 @@ export const Content: FC = () => {
|
|||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<MobileContent
|
<MobileContent
|
||||||
name={name}
|
name={name}
|
||||||
streamTitle={streamTitle}
|
|
||||||
summary={summary}
|
summary={summary}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
socialHandles={socialHandles}
|
socialHandles={socialHandles}
|
||||||
@@ -298,7 +297,6 @@ export const Content: FC = () => {
|
|||||||
) : (
|
) : (
|
||||||
<DesktopContent
|
<DesktopContent
|
||||||
name={name}
|
name={name}
|
||||||
streamTitle={streamTitle}
|
|
||||||
summary={summary}
|
summary={summary}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
socialHandles={socialHandles}
|
socialHandles={socialHandles}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { ContentHeader } from '../../common/ContentHeader/ContentHeader';
|
|||||||
|
|
||||||
export type DesktopContentProps = {
|
export type DesktopContentProps = {
|
||||||
name: string;
|
name: string;
|
||||||
streamTitle: string;
|
|
||||||
summary: string;
|
summary: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
socialHandles: SocialLink[];
|
socialHandles: SocialLink[];
|
||||||
@@ -35,7 +34,6 @@ const FollowerCollection = dynamic(
|
|||||||
|
|
||||||
export const DesktopContent: FC<DesktopContentProps> = ({
|
export const DesktopContent: FC<DesktopContentProps> = ({
|
||||||
name,
|
name,
|
||||||
streamTitle,
|
|
||||||
summary,
|
summary,
|
||||||
tags,
|
tags,
|
||||||
socialHandles,
|
socialHandles,
|
||||||
@@ -65,7 +63,6 @@ export const DesktopContent: FC<DesktopContentProps> = ({
|
|||||||
<div className={styles.lowerHalf} id="skip-to-content">
|
<div className={styles.lowerHalf} id="skip-to-content">
|
||||||
<ContentHeader
|
<ContentHeader
|
||||||
name={name}
|
name={name}
|
||||||
title={streamTitle}
|
|
||||||
summary={summary}
|
summary={summary}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
links={socialHandles}
|
links={socialHandles}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { ExternalAction } from '../../../interfaces/external-action';
|
|||||||
|
|
||||||
export type MobileContentProps = {
|
export type MobileContentProps = {
|
||||||
name: string;
|
name: string;
|
||||||
streamTitle: string;
|
|
||||||
summary: string;
|
summary: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
socialHandles: SocialLink[];
|
socialHandles: SocialLink[];
|
||||||
@@ -56,7 +55,6 @@ const ChatContainer = dynamic(
|
|||||||
|
|
||||||
export const MobileContent: FC<MobileContentProps> = ({
|
export const MobileContent: FC<MobileContentProps> = ({
|
||||||
name,
|
name,
|
||||||
streamTitle,
|
|
||||||
summary,
|
summary,
|
||||||
tags,
|
tags,
|
||||||
socialHandles,
|
socialHandles,
|
||||||
@@ -87,14 +85,7 @@ export const MobileContent: FC<MobileContentProps> = ({
|
|||||||
|
|
||||||
const aboutTabContent = (
|
const aboutTabContent = (
|
||||||
<>
|
<>
|
||||||
<ContentHeader
|
<ContentHeader name={name} summary={summary} tags={tags} links={socialHandles} logo="/logo" />
|
||||||
name={name}
|
|
||||||
title={streamTitle}
|
|
||||||
summary={summary}
|
|
||||||
tags={tags}
|
|
||||||
links={socialHandles}
|
|
||||||
logo="/logo"
|
|
||||||
/>
|
|
||||||
<div className={styles.bottomPageContentContainer}>
|
<div className={styles.bottomPageContentContainer}>
|
||||||
<CustomPageContent content={extraPageContent} />
|
<CustomPageContent content={extraPageContent} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,12 +22,7 @@ export type HeaderComponentProps = {
|
|||||||
online: boolean;
|
online: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Header: FC<HeaderComponentProps> = ({
|
export const Header: FC<HeaderComponentProps> = ({ name, chatAvailable, chatDisabled, online }) => (
|
||||||
name = 'Your stream title',
|
|
||||||
chatAvailable,
|
|
||||||
chatDisabled,
|
|
||||||
online,
|
|
||||||
}) => (
|
|
||||||
<header className={cn([`${styles.header}`], 'global-header')}>
|
<header className={cn([`${styles.header}`], 'global-header')}>
|
||||||
{online ? (
|
{online ? (
|
||||||
<Link href="#player" className={styles.skipLink}>
|
<Link href="#player" className={styles.skipLink}>
|
||||||
|
|||||||
@@ -7,30 +7,36 @@ import {
|
|||||||
visibleChatMessagesSelector,
|
visibleChatMessagesSelector,
|
||||||
clientConfigStateAtom,
|
clientConfigStateAtom,
|
||||||
appStateAtom,
|
appStateAtom,
|
||||||
|
serverStatusState,
|
||||||
} from '../../../../components/stores/ClientConfigStore';
|
} from '../../../../components/stores/ClientConfigStore';
|
||||||
import Header from '../../../../components/ui/Header/Header';
|
import Header from '../../../../components/ui/Header/Header';
|
||||||
import { ClientConfig } from '../../../../interfaces/client-config.model';
|
import { ClientConfig } from '../../../../interfaces/client-config.model';
|
||||||
import { AppStateOptions } from '../../../../components/stores/application-state';
|
import { AppStateOptions } from '../../../../components/stores/application-state';
|
||||||
|
import { ServerStatus } from '../../../../interfaces/server-status.model';
|
||||||
|
|
||||||
export default function ReadWriteChatEmbed() {
|
export default function ReadWriteChatEmbed() {
|
||||||
const currentUser = useRecoilValue(currentUserAtom);
|
const currentUser = useRecoilValue(currentUserAtom);
|
||||||
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
|
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
|
||||||
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
||||||
|
const clientStatus = useRecoilValue<ServerStatus>(serverStatusState);
|
||||||
|
|
||||||
const appState = useRecoilValue<AppStateOptions>(appStateAtom);
|
const appState = useRecoilValue<AppStateOptions>(appStateAtom);
|
||||||
|
|
||||||
const { name, chatDisabled } = clientConfig;
|
const { name, chatDisabled } = clientConfig;
|
||||||
const { videoAvailable } = appState;
|
const { videoAvailable } = appState;
|
||||||
|
const { streamTitle, online } = clientStatus;
|
||||||
|
|
||||||
if (!currentUser) {
|
if (!currentUser) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { id, displayName, isModerator } = currentUser;
|
const headerText = online ? streamTitle || name : name;
|
||||||
|
|
||||||
|
const { id, displayName, isModerator } = currentUser;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<ClientConfigStore />
|
<ClientConfigStore />
|
||||||
<Header name={name} chatAvailable chatDisabled={chatDisabled} online={videoAvailable} />
|
<Header name={headerText} chatAvailable chatDisabled={chatDisabled} online={videoAvailable} />
|
||||||
<ChatContainer
|
<ChatContainer
|
||||||
messages={messages}
|
messages={messages}
|
||||||
usernameToHighlight={displayName}
|
usernameToHighlight={displayName}
|
||||||
|
|||||||
Reference in New Issue
Block a user