Show streamTitle in header if set. Closes #2720
This commit is contained in:
@@ -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<ChatMessage[]>(visibleChatMessagesSelector);
|
||||
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
||||
const clientStatus = useRecoilValue<ServerStatus>(serverStatusState);
|
||||
|
||||
const appState = useRecoilValue<AppStateOptions>(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 (
|
||||
<div>
|
||||
<ClientConfigStore />
|
||||
<Header name={name} chatAvailable chatDisabled={chatDisabled} online={videoAvailable} />
|
||||
<Header name={headerText} chatAvailable chatDisabled={chatDisabled} online={videoAvailable} />
|
||||
<ChatContainer
|
||||
messages={messages}
|
||||
usernameToHighlight={displayName}
|
||||
|
||||
Reference in New Issue
Block a user