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

26 lines
525 B
TypeScript
Raw Normal View History

import React from 'react';
2022-08-16 10:38:17 -07:00
import { ChatProvider } from 'soapbox/contexts/chat-context';
import { useOwnAccount } 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-09-22 09:55:29 -07:00
const account = useOwnAccount();
2022-08-25 12:56:53 -07:00
const path = location.pathname;
const shouldHideWidget = Boolean(path.match(/^\/chats/));
if (!account?.chats_onboarded || shouldHideWidget) {
2022-09-22 09:55:29 -07:00
return null;
}
2022-08-16 10:38:17 -07:00
return (
<ChatProvider>
<ChatPane />
</ChatProvider>
);
};
export default ChatWidget;