Bluesky app fork with some witchin' additions 💫

Merge pull request #8708 from internet-development/@APiligrim/chat-request-ui

[APP-1317] update: chat request ui to hide chat requests when there are no messages

authored by

jim and committed by
GitHub
0610c822 3775aeb1

+25 -11
+25 -11
src/screens/Messages/ChatList.tsx
··· 164 164 // filter out convos that are actively being left 165 165 .filter(convo => !leftConvos.includes(convo.id)) 166 166 167 + const hasInboxRequests = inboxPreviewConvos?.length > 0 168 + 167 169 return [ 168 - { 169 - type: 'INBOX', 170 - count: inboxPreviewConvos.length, 171 - profiles: inboxPreviewConvos.slice(0, 3), 172 - }, 170 + ...(hasInboxRequests 171 + ? [ 172 + { 173 + type: 'INBOX' as const, 174 + count: inboxPreviewConvos.length, 175 + profiles: inboxPreviewConvos.slice(0, 3), 176 + }, 177 + ] 178 + : []), 173 179 ...conversations.map( 174 180 convo => ({type: 'CONVERSATION', conversation: convo}) as const, 175 181 ), ··· 223 229 return listenSoftReset(onSoftReset) 224 230 }, [onSoftReset, isScreenFocused]) 225 231 226 - // Will always have 1 item - the inbox button 227 - if (conversations.length < 2) { 232 + // NOTE(APiligrim) 233 + // Show empty state only if there are no conversations at all 234 + const actualConversations = conversations.filter( 235 + item => item.type === 'CONVERSATION', 236 + ) 237 + const hasInboxRequests = inboxPreviewConvos?.length > 0 238 + 239 + if (actualConversations.length === 0) { 228 240 return ( 229 241 <Layout.Screen> 230 242 <Header newChatControl={newChatControl} /> 231 243 <Layout.Center> 232 - <InboxPreview 233 - count={inboxPreviewConvos.length} 234 - profiles={inboxPreviewConvos} 235 - /> 244 + {hasInboxRequests && ( 245 + <InboxPreview 246 + count={inboxPreviewConvos.length} 247 + profiles={inboxPreviewConvos} 248 + /> 249 + )} 236 250 {isLoading ? ( 237 251 <ChatListLoadingPlaceholder /> 238 252 ) : (