From 7967106fcc91d06c3e99c0039a5730a307b1787d Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 10 Oct 2022 18:33:15 -0700 Subject: [PATCH] Restore the loading state of the app. Closes #2195 --- web/components/ui/Content/Content.tsx | 20 +++++++++----------- web/components/ui/Sidebar/Sidebar.tsx | 4 ++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/web/components/ui/Content/Content.tsx b/web/components/ui/Content/Content.tsx index 0dccff395..9208d216e 100644 --- a/web/components/ui/Content/Content.tsx +++ b/web/components/ui/Content/Content.tsx @@ -95,15 +95,19 @@ const MobileContent = ({ socialHandles, extraPageContent, messages, - chatDisplayName, - chatUserId, + currentUser, showChat, }) => { + if (!currentUser) { + return null; + } + const { id, displayName } = currentUser; + const chatContent = showChat && ( @@ -208,11 +212,6 @@ export const Content: FC = () => { window.addEventListener('resize', checkIfMobile); }, []); - if (!currentUser) { - return null; - } - - const { id: currentUserId, displayName } = currentUser; const showChat = !chatDisabled && isChatAvailable && isChatVisible; return ( @@ -274,8 +273,7 @@ export const Content: FC = () => { socialHandles={socialHandles} extraPageContent={extraPageContent} messages={messages} - chatDisplayName={displayName} - chatUserId={currentUserId} + currentUser={currentUser} showChat={showChat} /> ) : ( diff --git a/web/components/ui/Sidebar/Sidebar.tsx b/web/components/ui/Sidebar/Sidebar.tsx index 2d2a011c1..b255b3fc2 100644 --- a/web/components/ui/Sidebar/Sidebar.tsx +++ b/web/components/ui/Sidebar/Sidebar.tsx @@ -11,6 +11,10 @@ export const Sidebar: FC = () => { const currentUser = useRecoilValue(currentUserAtom); const messages = useRecoilValue(visibleChatMessagesSelector); + if (!currentUser) { + return null; + } + const { id, isModerator, displayName } = currentUser; return (