Hide widget if not onboarded

chats-router
Justin 2 years ago
parent 93b11ec99c
commit 89c1225976

@ -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 />

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

Loading…
Cancel
Save