Skip to content

Commit 058b7ea

Browse files
V-Giraprzemvs
andauthored
fix: improve visibility of connection requests [WPB-14764] (#18854)
* fix: improve visibility of connection requests [WPB-14764] * Update src/script/page/LeftSidebar/panels/Conversations/Conversations.tsx Co-authored-by: Przemysław Jóźwik <[email protected]> * apply CR recommendations --------- Co-authored-by: Przemysław Jóźwik <[email protected]>
1 parent ab91fc2 commit 058b7ea

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/script/page/LeftSidebar/panels/Conversations/Conversations.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,15 @@ export const Conversations: React.FC<ConversationsProps> = ({
200200
![SidebarTabs.DIRECTS, SidebarTabs.GROUPS, SidebarTabs.FAVORITES].includes(currentTab) &&
201201
groupParticipantsConversations.length > 0;
202202

203-
const hasNoConversations = conversations.length + connectRequests.length === 0;
203+
const showConnectionRequests = [SidebarTabs.RECENT, SidebarTabs.DIRECTS].includes(currentTab);
204+
const hasVisibleConnectionRequests = connectRequests.length > 0 && showConnectionRequests;
205+
const hasVisibleConversations = currentTabConversations.length > 0;
206+
const hasNoVisbleConversations = !hasVisibleConversations && !hasVisibleConnectionRequests;
207+
204208
const hasEmptyConversationsList =
205209
!isGroupParticipantsVisible &&
206-
((showSearchInput && currentTabConversations.length === 0) ||
207-
(hasNoConversations && currentTab !== SidebarTabs.ARCHIVES));
210+
((showSearchInput && hasNoVisbleConversations) ||
211+
(hasNoVisbleConversations && currentTab !== SidebarTabs.ARCHIVES));
208212

209213
const toggleSidebar = useCallback(() => {
210214
if (isFoldersTabOpen) {
@@ -339,7 +343,7 @@ export const Conversations: React.FC<ConversationsProps> = ({
339343
currentFolder={currentFolder}
340344
currentTab={currentTab}
341345
selfUser={selfUser}
342-
showSearchInput={(showSearchInput && currentTabConversations.length !== 0) || !!conversationsFilter}
346+
showSearchInput={(showSearchInput && hasVisibleConversations) || !!conversationsFilter}
343347
searchValue={conversationsFilter}
344348
setSearchValue={onSearch}
345349
searchInputPlaceholder={searchInputPlaceholder}
@@ -424,7 +428,7 @@ export const Conversations: React.FC<ConversationsProps> = ({
424428
callState={callState}
425429
currentFocus={currentFocus}
426430
listViewModel={listViewModel}
427-
connectRequests={connectRequests}
431+
connectRequests={showConnectionRequests ? connectRequests : []}
428432
handleArrowKeyDown={handleKeyDown}
429433
conversationState={conversationState}
430434
conversations={currentTabConversations}

0 commit comments

Comments
 (0)