bigbuffet-rw/app/soapbox/features/chats/components/chat-widget.tsx

28 lines
572 B
TypeScript
Raw Normal View History

2022-08-25 12:56:53 -07:00
import React, { useEffect } from 'react';
2022-08-16 10:38:17 -07:00
2022-08-25 12:56:53 -07:00
import { connectDirectStream } from 'soapbox/actions/streaming';
2022-08-16 10:38:17 -07:00
import { ChatProvider } from 'soapbox/contexts/chat-context';
2022-08-25 12:56:53 -07:00
import { useAppDispatch } from 'soapbox/hooks';
2022-08-16 10:38:17 -07:00
2022-08-18 09:52:04 -07:00
import ChatPane from './chat-pane/chat-pane';
2022-08-16 10:38:17 -07:00
const ChatWidget = () => {
2022-08-25 12:56:53 -07:00
const dispatch = useAppDispatch();
useEffect(() => {
const disconnect = dispatch(connectDirectStream());
return (() => {
disconnect();
});
}, []);
2022-08-16 10:38:17 -07:00
return (
<ChatProvider>
<ChatPane />
</ChatProvider>
);
};
export default ChatWidget;