Add current user object that holds user session values instead of standalone getters. Closes #2050

This commit is contained in:
Gabe Kangas
2022-10-10 16:26:09 -07:00
parent d94723bd3a
commit 80a012a3c7
12 changed files with 103 additions and 98 deletions

View File

@@ -3,23 +3,24 @@ import { ChatMessage } from '../../../../interfaces/chat-message.model';
import { ChatContainer } from '../../../../components/chat/ChatContainer/ChatContainer';
import {
ClientConfigStore,
chatDisplayNameAtom,
chatUserIdAtom,
currentUserAtom,
visibleChatMessagesSelector,
} from '../../../../components/stores/ClientConfigStore';
export default function ReadOnlyChatEmbed() {
const chatDisplayName = useRecoilValue<string>(chatDisplayNameAtom);
const chatUserId = useRecoilValue<string>(chatUserIdAtom);
const currentUser = useRecoilValue(currentUserAtom);
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
if (!currentUser) {
return null;
}
const { id, displayName } = currentUser;
return (
<div>
<ClientConfigStore />
<ChatContainer
messages={messages}
usernameToHighlight={chatDisplayName}
chatUserId={chatUserId}
usernameToHighlight={displayName}
chatUserId={id}
isModerator={false}
showInput={false}
height="100vh"