Fix a few issues with search

This commit is contained in:
Thomas Ricouard 2023-01-28 08:29:49 +01:00
parent a52f0f9fbe
commit 0fb9e60c3f
1 changed files with 18 additions and 11 deletions

View File

@ -22,17 +22,24 @@ public struct ExploreView: View {
loadingView
} else if !viewModel.searchQuery.isEmpty {
if viewModel.isSearching {
HStack {}
HStack {
Spacer()
ProgressView()
Spacer()
}
.listRowBackground(theme.secondaryBackgroundColor)
.listRowSeparator(.hidden)
} else if let results = viewModel.results[viewModel.searchQuery], !results.isEmpty {
makeSearchResultsView(results: results)
} else {
.id(UUID())
} else if let results = viewModel.results[viewModel.searchQuery] {
if results.isEmpty, !viewModel.isSearching {
EmptyView(iconName: "magnifyingglass",
title: "explore.search.empty.title",
message: "explore.search.empty.message")
.listRowBackground(theme.secondaryBackgroundColor)
.listRowSeparator(.hidden)
} else {
makeSearchResultsView(results: results)
}
}
} else if viewModel.allSectionsEmpty {
EmptyView(iconName: "magnifyingglass",