Hide widget if not onboarded
This commit is contained in:
parent
93b11ec99c
commit
89c1225976
2 changed files with 7 additions and 1 deletions
|
@ -2,11 +2,12 @@ import React, { useEffect } from 'react';
|
||||||
|
|
||||||
import { connectDirectStream } from 'soapbox/actions/streaming';
|
import { connectDirectStream } from 'soapbox/actions/streaming';
|
||||||
import { ChatProvider } from 'soapbox/contexts/chat-context';
|
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';
|
import ChatPane from './chat-pane/chat-pane';
|
||||||
|
|
||||||
const ChatWidget = () => {
|
const ChatWidget = () => {
|
||||||
|
const account = useOwnAccount();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -17,6 +18,10 @@ const ChatWidget = () => {
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if (!account?.chats_onboarded) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ChatProvider>
|
<ChatProvider>
|
||||||
<ChatPane />
|
<ChatPane />
|
||||||
|
|
|
@ -679,6 +679,7 @@ const UI: React.FC = ({ children }) => {
|
||||||
{Component => <Component />}
|
{Component => <Component />}
|
||||||
</BundleContainer>
|
</BundleContainer>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{me && features.chats && !mobile && (
|
{me && features.chats && !mobile && (
|
||||||
<BundleContainer fetchComponent={ChatWidget}>
|
<BundleContainer fetchComponent={ChatWidget}>
|
||||||
{Component => <Component />}
|
{Component => <Component />}
|
||||||
|
|
Loading…
Reference in a new issue