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