Fix explore view loading state Fix #1395

This commit is contained in:
Thomas Ricouard 2023-07-18 08:04:18 +02:00
parent 67d1dede04
commit 58debff490

View file

@ -21,16 +21,7 @@ public struct ExploreView: View {
if !viewModel.isLoaded { if !viewModel.isLoaded {
loadingView loadingView
} else if !viewModel.searchQuery.isEmpty { } else if !viewModel.searchQuery.isEmpty {
if viewModel.isSearching { if let results = viewModel.results[viewModel.searchQuery] {
HStack {
Spacer()
ProgressView()
Spacer()
}
.listRowBackground(theme.secondaryBackgroundColor)
.listRowSeparator(.hidden)
.id(UUID())
} else if let results = viewModel.results[viewModel.searchQuery] {
if results.isEmpty, !viewModel.isSearching { if results.isEmpty, !viewModel.isSearching {
EmptyView(iconName: "magnifyingglass", EmptyView(iconName: "magnifyingglass",
title: "explore.search.empty.title", title: "explore.search.empty.title",
@ -40,6 +31,15 @@ public struct ExploreView: View {
} else { } else {
makeSearchResultsView(results: results) makeSearchResultsView(results: results)
} }
} else {
HStack {
Spacer()
ProgressView()
Spacer()
}
.listRowBackground(theme.secondaryBackgroundColor)
.listRowSeparator(.hidden)
.id(UUID())
} }
} else if viewModel.allSectionsEmpty { } else if viewModel.allSectionsEmpty {
EmptyView(iconName: "magnifyingglass", EmptyView(iconName: "magnifyingglass",