mirror of
				https://github.com/owncast/owncast.git
				synced 2025-11-04 05:17:27 +08:00 
			
		
		
		
	Add read-write chat embed. Closes #1906
This commit is contained in:
		@ -1,7 +1,7 @@
 | 
				
			|||||||
import { Meta } from '@storybook/addon-docs';
 | 
					import { Meta } from '@storybook/addon-docs';
 | 
				
			||||||
import { Typography } from 'antd';
 | 
					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>
 | 
					<Typography.Title style={{ color: 'var(--primary-color)' }}>Owncast Web UI v2</Typography.Title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -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
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								web/pages/embed/chat/readwrite/index.tsx
									
									
									
									
									
										Normal file
									
								
							@ -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
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								web/stories/ReadwriteChat.stories.tsx
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user