bigbuffet-rw/app/soapbox/features/chats/components/chat-widget/chat-widget.tsx
2022-10-17 08:34:19 -04:00

27 lines
613 B
TypeScript

import React from 'react';
import { useHistory } from 'react-router-dom';
import { ChatProvider } from 'soapbox/contexts/chat-context';
import { useOwnAccount } from 'soapbox/hooks';
import ChatPane from '../chat-pane/chat-pane';
const ChatWidget = () => {
const account = useOwnAccount();
const history = useHistory();
const path = history.location.pathname;
const shouldHideWidget = Boolean(path.match(/^\/chats/));
if (!account?.chats_onboarded || shouldHideWidget) {
return null;
}
return (
<ChatProvider>
<ChatPane />
</ChatProvider>
);
};
export default ChatWidget;