0

Fix chat embeds not loading. Fixes #2744

This commit is contained in:
Gabe Kangas 2023-02-26 18:48:41 -08:00
parent 5824113112
commit 1f99b0bf22
No known key found for this signature in database
GPG Key ID: 4345B2060657F330
2 changed files with 21 additions and 25 deletions

View File

@ -10,21 +10,20 @@ import {
export default function ReadOnlyChatEmbed() {
const currentUser = useRecoilValue(currentUserAtom);
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
if (!currentUser) {
return null;
}
const { id, displayName } = currentUser;
return (
<div>
<ClientConfigStore />
<ChatContainer
messages={messages}
usernameToHighlight={displayName}
chatUserId={id}
isModerator={false}
showInput={false}
height="100vh"
/>
{currentUser && (
<ChatContainer
messages={messages}
usernameToHighlight={currentUser.displayName}
chatUserId={currentUser.id}
isModerator={false}
showInput={false}
height="100vh"
/>
)}
</div>
);
}

View File

@ -26,25 +26,22 @@ export default function ReadWriteChatEmbed() {
const { videoAvailable } = appState;
const { streamTitle, online } = clientStatus;
if (!currentUser) {
return null;
}
const headerText = online ? streamTitle || name : name;
const { id, displayName, isModerator } = currentUser;
return (
<div>
<ClientConfigStore />
<Header name={headerText} chatAvailable chatDisabled={chatDisabled} online={videoAvailable} />
<ChatContainer
messages={messages}
usernameToHighlight={displayName}
chatUserId={id}
isModerator={isModerator}
showInput
height="80vh"
/>
{currentUser && (
<ChatContainer
messages={messages}
usernameToHighlight={currentUser.displayName}
chatUserId={currentUser.id}
isModerator={currentUser.isModerator}
showInput
height="80vh"
/>
)}
</div>
);
}