Browse Source

Add read-write chat embed. Closes #1906

pull/2101/head
Gabe Kangas 3 years ago
parent
commit
88919efde9
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
  1. 2
      web/.storybook/stories-category-doc-pages/Introduction.stories.mdx
  2. 3
      web/pages/embed/chat/readwrite.tsx
  3. 38
      web/pages/embed/chat/readwrite/index.tsx
  4. 62
      web/stories/ReadwriteChat.stories.tsx

2
web/.storybook/stories-category-doc-pages/Introduction.stories.mdx

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import { Meta } from '@storybook/addon-docs';
import { Typography } from 'antd';
<Meta title="Owncast/Readme" />
<Meta title="Owncast/Documentation/Readme" />
<Typography.Title style={{ color: 'var(--primary-color)' }}>Owncast Web UI v2</Typography.Title>

3
web/pages/embed/chat/readwrite.tsx

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
export default function ReadWriteChatEmbed() {
return <div className="standalone-chat-embed">fully featured chat embed goes here</div>;
}

38
web/pages/embed/chat/readwrite/index.tsx

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
import { useRecoilValue } from 'recoil';
import { ChatMessage } from '../../../../interfaces/chat-message.model';
import { ChatContainer } from '../../../../components/chat/ChatContainer/ChatContainer';
import {
ClientConfigStore,
chatDisplayNameAtom,
chatUserIdAtom,
visibleChatMessagesSelector,
clientConfigStateAtom,
isChatModeratorAtom,
} from '../../../../components/stores/ClientConfigStore';
import Header from '../../../../components/ui/Header/Header';
import { ClientConfig } from '../../../../interfaces/client-config.model';
export default function ReadWriteChatEmbed() {
const chatDisplayName = useRecoilValue<string>(chatDisplayNameAtom);
const chatUserId = useRecoilValue<string>(chatUserIdAtom);
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
const isModerator = useRecoilValue<boolean>(isChatModeratorAtom);
const { name, chatDisabled } = clientConfig;
return (
<div>
<ClientConfigStore />
<Header name={name} chatAvailable chatDisabled={chatDisabled} />
<ChatContainer
messages={messages}
usernameToHighlight={chatDisplayName}
chatUserId={chatUserId}
isModerator={isModerator}
showInput
height="80vh"
/>
</div>
);
}

62
web/stories/ReadwriteChat.stories.tsx

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save