2022-04-28 19:54:33 +03:00
|
|
|
import Sider from 'antd/lib/layout/Sider';
|
|
|
|
import { useRecoilValue } from 'recoil';
|
2022-04-29 00:36:05 +03:00
|
|
|
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
|
|
|
import ChatContainer from '../../chat/ChatContainer';
|
2022-05-04 10:55:44 +03:00
|
|
|
import s from './Sidebar.module.scss';
|
2022-05-03 03:45:22 +03:00
|
|
|
import {
|
|
|
|
chatMessagesAtom,
|
|
|
|
chatVisibilityAtom,
|
|
|
|
chatStateAtom,
|
|
|
|
} from '../../stores/ClientConfigStore';
|
|
|
|
import { ChatState, ChatVisibilityState } from '../../../interfaces/application-state';
|
2022-05-04 00:55:13 +03:00
|
|
|
import ChatTextField from '../../chat/ChatTextField/ChatTextField';
|
2022-04-28 19:54:33 +03:00
|
|
|
|
|
|
|
export default function Sidebar() {
|
2022-05-03 03:45:22 +03:00
|
|
|
const messages = useRecoilValue<ChatMessage[]>(chatMessagesAtom);
|
2022-04-30 01:09:53 +03:00
|
|
|
const chatVisibility = useRecoilValue<ChatVisibilityState>(chatVisibilityAtom);
|
2022-05-03 03:45:22 +03:00
|
|
|
const chatState = useRecoilValue<ChatState>(chatStateAtom);
|
2022-04-29 00:36:05 +03:00
|
|
|
|
2022-04-28 19:54:33 +03:00
|
|
|
return (
|
|
|
|
<Sider
|
2022-05-04 10:55:44 +03:00
|
|
|
className={`${s.root}`}
|
2022-04-30 01:09:53 +03:00
|
|
|
collapsed={chatVisibility === ChatVisibilityState.Hidden}
|
2022-05-03 03:45:22 +03:00
|
|
|
collapsedWidth={0}
|
2022-05-04 00:55:13 +03:00
|
|
|
width="100%"
|
2022-04-29 00:36:05 +03:00
|
|
|
>
|
2022-05-03 03:45:22 +03:00
|
|
|
<ChatContainer messages={messages} state={chatState} />
|
2022-05-02 06:56:11 +03:00
|
|
|
<ChatTextField />
|
2022-04-29 00:36:05 +03:00
|
|
|
</Sider>
|
2022-04-28 19:54:33 +03:00
|
|
|
);
|
|
|
|
}
|