owncast/web/components/ui/Sidebar/Sidebar.tsx

31 lines
1 KiB
TypeScript
Raw Normal View History

import Sider from 'antd/lib/layout/Sider';
import { useRecoilValue } from 'recoil';
import { ChatMessage } from '../../../interfaces/chat-message.model';
import ChatContainer from '/components/chat/ChatContainer';
import s from './Sidebar.module.scss';
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';
export default function Sidebar() {
const messages = useRecoilValue<ChatMessage[]>(chatMessagesAtom);
const chatVisibility = useRecoilValue<ChatVisibilityState>(chatVisibilityAtom);
const chatState = useRecoilValue<ChatState>(chatStateAtom);
return (
<Sider
2022-05-17 17:36:07 +03:00
className={s.root}
collapsed={chatVisibility === ChatVisibilityState.Hidden}
collapsedWidth={0}
2022-05-17 17:36:07 +03:00
width={320}
>
2022-05-18 03:58:51 +03:00
<ChatContainer messages={messages} state={chatState} />
<ChatTextField />
</Sider>
);
}