fix: show default category when no other categories exist

* Fixed bug where default category wasn't shown if no categories and books exist
This commit is contained in:
Acclorite 2025-09-25 20:42:54 +03:00
parent c46ecb7ff0
commit 14cf04a8ce
No known key found for this signature in database
GPG key ID: 6E54C611F6EE8593

View file

@ -66,10 +66,12 @@ object LibraryScreen : Screen, Parcelable {
settings.libraryShowDefaultTab.value
) {
derivedStateOf {
val categoryIds = settingsState.value.categories.map { it.id }.toSet()
val categories = settingsState.value.categories.filterNot { it.id == -1 }
val categoryIds = categories.map { it.id }.toSet()
state.value.books.any { book ->
book.data.categories.none { category -> category in categoryIds }
} || settingsState.value.categories.isEmpty() || settings.libraryShowDefaultTab.lastValue
} || categories.isEmpty() || settings.libraryShowDefaultTab.lastValue
}
}