From 40accbc8b44c1b6fb11043a8d8afa61e14c1cb8f Mon Sep 17 00:00:00 2001
From: Shinokuni <shinokuni@openserver.fr>
Date: Mon, 19 Feb 2024 22:59:19 +0100
Subject: [PATCH] Fix no feed placeholder not appearing in FeedTab

---
 .../repositories/GetFoldersWithFeeds.kt       | 22 ++++++++++++++-----
 .../compose/util/components/Placeholder.kt    |  5 ++++-
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/appcompose/src/main/java/com/readrops/app/compose/repositories/GetFoldersWithFeeds.kt b/appcompose/src/main/java/com/readrops/app/compose/repositories/GetFoldersWithFeeds.kt
index e140879d..73f76e8a 100644
--- a/appcompose/src/main/java/com/readrops/app/compose/repositories/GetFoldersWithFeeds.kt
+++ b/appcompose/src/main/java/com/readrops/app/compose/repositories/GetFoldersWithFeeds.kt
@@ -18,7 +18,13 @@ class GetFoldersWithFeeds(
                 .selectFeedsWithoutFolder(accountId)
         ) { folders, feedsWithoutFolder ->
             val foldersWithFeeds = folders.groupBy(
-                keySelector = { Folder(id = it.folderId, name = it.folderName, accountId = it.accountId) },
+                keySelector = {
+                    Folder(
+                        id = it.folderId,
+                        name = it.folderName,
+                        accountId = it.accountId
+                    ) as Folder?
+                },
                 valueTransform = {
                     Feed(
                         id = it.feedId,
@@ -37,11 +43,15 @@ class GetFoldersWithFeeds(
                 }
             }
 
-            foldersWithFeeds + mapOf(
-                Pair(
-                    null,
-                    feedsWithoutFolder.map { it.feed.apply { unreadCount = it.unreadCount } })
-            )
+            if (feedsWithoutFolder.isNotEmpty()) {
+                foldersWithFeeds + mapOf(
+                    Pair(
+                        null,
+                        feedsWithoutFolder.map { it.feed.apply { unreadCount = it.unreadCount } })
+                )
+            }
+
+            foldersWithFeeds
         }
     }
 }
\ No newline at end of file
diff --git a/appcompose/src/main/java/com/readrops/app/compose/util/components/Placeholder.kt b/appcompose/src/main/java/com/readrops/app/compose/util/components/Placeholder.kt
index 38b6d933..216bd217 100644
--- a/appcompose/src/main/java/com/readrops/app/compose/util/components/Placeholder.kt
+++ b/appcompose/src/main/java/com/readrops/app/compose/util/components/Placeholder.kt
@@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.painter.Painter
+import com.readrops.app.compose.util.theme.ShortSpacer
 import com.readrops.app.compose.util.toDp
 
 
@@ -39,9 +40,11 @@ fun Placeholder(
             modifier = Modifier.size(MaterialTheme.typography.displayMedium.toDp() * 1.5f)
         )
 
+        ShortSpacer()
+
         Text(
             text = text,
-            style = MaterialTheme.typography.displayMedium
+            style = MaterialTheme.typography.displaySmall
         )
     }
 }
\ No newline at end of file