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