about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorjim <310223+jimmylee@users.noreply.github.com>2025-07-23 21:46:56 -0700
committerGitHub <noreply@github.com>2025-07-23 21:46:56 -0700
commit0610c822cf94995c75bbf3237c217b68dabfe5a0 (patch)
tree7b1c4e81c6abd254bf2eaa70bb5a351eceffd954 /src
parent3775aeb1463e76c8b4f8380146b2aafbdb03dba4 (diff)
parenta3b188baecc34872e1ccda446d2b7b2f2064f727 (diff)
downloadvoidsky-0610c822cf94995c75bbf3237c217b68dabfe5a0.tar.zst
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
Diffstat (limited to 'src')
-rw-r--r--src/screens/Messages/ChatList.tsx36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/screens/Messages/ChatList.tsx b/src/screens/Messages/ChatList.tsx
index e13f0617b..c37a025cc 100644
--- a/src/screens/Messages/ChatList.tsx
+++ b/src/screens/Messages/ChatList.tsx
@@ -164,12 +164,18 @@ export function MessagesScreenInner({navigation, route}: Props) {
         // filter out convos that are actively being left
         .filter(convo => !leftConvos.includes(convo.id))
 
+      const hasInboxRequests = inboxPreviewConvos?.length > 0
+
       return [
-        {
-          type: 'INBOX',
-          count: inboxPreviewConvos.length,
-          profiles: inboxPreviewConvos.slice(0, 3),
-        },
+        ...(hasInboxRequests
+          ? [
+              {
+                type: 'INBOX' as const,
+                count: inboxPreviewConvos.length,
+                profiles: inboxPreviewConvos.slice(0, 3),
+              },
+            ]
+          : []),
         ...conversations.map(
           convo => ({type: 'CONVERSATION', conversation: convo}) as const,
         ),
@@ -223,16 +229,24 @@ export function MessagesScreenInner({navigation, route}: Props) {
     return listenSoftReset(onSoftReset)
   }, [onSoftReset, isScreenFocused])
 
-  // Will always have 1 item - the inbox button
-  if (conversations.length < 2) {
+  // NOTE(APiligrim)
+  // Show empty state only if there are no conversations at all
+  const actualConversations = conversations.filter(
+    item => item.type === 'CONVERSATION',
+  )
+  const hasInboxRequests = inboxPreviewConvos?.length > 0
+
+  if (actualConversations.length === 0) {
     return (
       <Layout.Screen>
         <Header newChatControl={newChatControl} />
         <Layout.Center>
-          <InboxPreview
-            count={inboxPreviewConvos.length}
-            profiles={inboxPreviewConvos}
-          />
+          {hasInboxRequests && (
+            <InboxPreview
+              count={inboxPreviewConvos.length}
+              profiles={inboxPreviewConvos}
+            />
+          )}
           {isLoading ? (
             <ChatListLoadingPlaceholder />
           ) : (