mirror of
https://github.com/owncast/owncast.git
synced 2024-12-26 19:18:37 +03:00
32c3f6a9b6
* fix: #2668 Page Vertical Spacing Issues * Update test to reflect mobile work * chore: refactor action buttons --------- Co-authored-by: thisProjects <wibbet@wobbet.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import Sider from 'antd/lib/layout/Sider';
|
|
import { useRecoilValue } from 'recoil';
|
|
import { FC } from 'react';
|
|
import dynamic from 'next/dynamic';
|
|
import { Spin } from 'antd';
|
|
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
|
import styles from './Sidebar.module.scss';
|
|
|
|
import {
|
|
currentUserAtom,
|
|
visibleChatMessagesSelector,
|
|
isChatAvailableSelector,
|
|
} from '../../stores/ClientConfigStore';
|
|
|
|
// Lazy loaded components
|
|
const ChatContainer = dynamic(
|
|
() => import('../../chat/ChatContainer/ChatContainer').then(mod => mod.ChatContainer),
|
|
{
|
|
ssr: false,
|
|
},
|
|
);
|
|
|
|
export const Sidebar: FC = () => {
|
|
const currentUser = useRecoilValue(currentUserAtom);
|
|
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
|
|
const isChatAvailable = useRecoilValue(isChatAvailableSelector);
|
|
|
|
if (!currentUser) {
|
|
return (
|
|
<Sider className={styles.root} collapsedWidth={0} width={100}>
|
|
<Spin spinning size="large" />
|
|
</Sider>
|
|
);
|
|
}
|
|
|
|
const { id, isModerator, displayName } = currentUser;
|
|
return (
|
|
<Sider className={styles.root} collapsedWidth={0} width={320}>
|
|
<ChatContainer
|
|
messages={messages}
|
|
usernameToHighlight={displayName}
|
|
chatUserId={id}
|
|
isModerator={isModerator}
|
|
chatAvailable={isChatAvailable}
|
|
showInput={!!currentUser}
|
|
/>
|
|
</Sider>
|
|
);
|
|
};
|