Hide widget if not onboarded

This commit is contained in:
Justin 2022-09-22 12:55:29 -04:00
parent 93b11ec99c
commit 89c1225976
2 changed files with 7 additions and 1 deletions

View file

@ -2,11 +2,12 @@ import React, { useEffect } from 'react';
import { connectDirectStream } from 'soapbox/actions/streaming';
import { ChatProvider } from 'soapbox/contexts/chat-context';
import { useAppDispatch } from 'soapbox/hooks';
import { useAppDispatch, useOwnAccount } from 'soapbox/hooks';
import ChatPane from './chat-pane/chat-pane';
const ChatWidget = () => {
const account = useOwnAccount();
const dispatch = useAppDispatch();
useEffect(() => {
@ -17,6 +18,10 @@ const ChatWidget = () => {
});
}, []);
if (!account?.chats_onboarded) {
return null;
}
return (
<ChatProvider>
<ChatPane />

View file

@ -679,6 +679,7 @@ const UI: React.FC = ({ children }) => {
{Component => <Component />}
</BundleContainer>
)}
{me && features.chats && !mobile && (
<BundleContainer fetchComponent={ChatWidget}>
{Component => <Component />}