2022-04-28 19:54:33 +03:00
|
|
|
import Sider from 'antd/lib/layout/Sider';
|
|
|
|
import { useRecoilValue } from 'recoil';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { FC } from 'react';
|
2022-04-29 00:36:05 +03:00
|
|
|
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { ChatContainer } from '../../chat/ChatContainer/ChatContainer';
|
|
|
|
import styles from './Sidebar.module.scss';
|
2022-05-26 06:38:40 +03:00
|
|
|
|
2022-06-25 07:30:54 +03:00
|
|
|
import {
|
|
|
|
chatDisplayNameAtom,
|
|
|
|
chatUserIdAtom,
|
2022-08-23 05:23:06 +03:00
|
|
|
isChatModeratorAtom,
|
2022-09-05 03:58:06 +03:00
|
|
|
visibleChatMessagesSelector,
|
2022-06-25 07:30:54 +03:00
|
|
|
} from '../../stores/ClientConfigStore';
|
2022-04-28 19:54:33 +03:00
|
|
|
|
2022-09-07 10:00:28 +03:00
|
|
|
export const Sidebar: FC = () => {
|
2022-06-25 07:30:54 +03:00
|
|
|
const chatDisplayName = useRecoilValue<string>(chatDisplayNameAtom);
|
|
|
|
const chatUserId = useRecoilValue<string>(chatUserIdAtom);
|
2022-08-23 05:23:06 +03:00
|
|
|
const isChatModerator = useRecoilValue<boolean>(isChatModeratorAtom);
|
2022-09-05 03:58:06 +03:00
|
|
|
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
|
2022-04-29 00:36:05 +03:00
|
|
|
|
2022-04-28 19:54:33 +03:00
|
|
|
return (
|
2022-09-07 10:00:28 +03:00
|
|
|
<Sider className={styles.root} collapsedWidth={0} width={320}>
|
2022-06-25 07:30:54 +03:00
|
|
|
<ChatContainer
|
|
|
|
messages={messages}
|
|
|
|
usernameToHighlight={chatDisplayName}
|
|
|
|
chatUserId={chatUserId}
|
2022-08-23 05:23:06 +03:00
|
|
|
isModerator={isChatModerator}
|
2022-06-25 07:30:54 +03:00
|
|
|
/>
|
2022-04-29 00:36:05 +03:00
|
|
|
</Sider>
|
2022-04-28 19:54:33 +03:00
|
|
|
);
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|