2022-09-05 07:46:54 +03:00
|
|
|
import { useRecoilValue } from 'recoil';
|
|
|
|
import { ChatMessage } from '../../../../interfaces/chat-message.model';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { ChatContainer } from '../../../../components/chat/ChatContainer/ChatContainer';
|
2022-09-05 07:46:54 +03:00
|
|
|
import {
|
|
|
|
ClientConfigStore,
|
2022-10-11 02:26:09 +03:00
|
|
|
currentUserAtom,
|
2022-09-05 07:46:54 +03:00
|
|
|
visibleChatMessagesSelector,
|
2023-03-02 03:19:02 +03:00
|
|
|
isChatAvailableSelector,
|
2022-09-05 07:46:54 +03:00
|
|
|
} from '../../../../components/stores/ClientConfigStore';
|
|
|
|
|
|
|
|
export default function ReadOnlyChatEmbed() {
|
2022-10-11 02:26:09 +03:00
|
|
|
const currentUser = useRecoilValue(currentUserAtom);
|
2022-09-05 07:46:54 +03:00
|
|
|
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
|
2023-03-02 03:19:02 +03:00
|
|
|
const isChatAvailable = useRecoilValue(isChatAvailableSelector);
|
2023-02-27 05:48:41 +03:00
|
|
|
|
2022-09-05 07:46:54 +03:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<ClientConfigStore />
|
2023-02-27 05:48:41 +03:00
|
|
|
{currentUser && (
|
|
|
|
<ChatContainer
|
|
|
|
messages={messages}
|
|
|
|
usernameToHighlight={currentUser.displayName}
|
|
|
|
chatUserId={currentUser.id}
|
|
|
|
isModerator={false}
|
|
|
|
showInput={false}
|
|
|
|
height="100vh"
|
2023-03-02 03:19:02 +03:00
|
|
|
chatAvailable={isChatAvailable}
|
2023-02-27 05:48:41 +03:00
|
|
|
/>
|
|
|
|
)}
|
2022-09-05 07:46:54 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|