mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Improve loading of labels view
This commit is contained in:
parent
d33c975ffb
commit
d270bd685f
2 changed files with 15 additions and 25 deletions
|
|
@ -104,24 +104,6 @@ struct ApplyLabelsView: View {
|
|||
}
|
||||
.navigationTitle(mode.navTitle)
|
||||
.background(Color.extensionBackground)
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
cancelButton
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
saveItemChangesButton
|
||||
}
|
||||
}
|
||||
#else
|
||||
.toolbar {
|
||||
ToolbarItemGroup {
|
||||
cancelButton
|
||||
saveItemChangesButton
|
||||
}
|
||||
}
|
||||
#endif
|
||||
.sheet(isPresented: $viewModel.showCreateLabelModal) {
|
||||
CreateLabelView(viewModel: viewModel, newLabelName: viewModel.labelSearchFilter)
|
||||
}
|
||||
|
|
@ -181,14 +163,25 @@ struct ApplyLabelsView: View {
|
|||
Group {
|
||||
#if os(iOS)
|
||||
NavigationView {
|
||||
if viewModel.labels.isEmpty, viewModel.isLoading {
|
||||
EmptyView()
|
||||
} else {
|
||||
innerBody
|
||||
}
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
cancelButton
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
saveItemChangesButton
|
||||
}
|
||||
}
|
||||
}
|
||||
#elseif os(macOS)
|
||||
innerBody
|
||||
.toolbar {
|
||||
ToolbarItemGroup {
|
||||
cancelButton
|
||||
saveItemChangesButton
|
||||
}
|
||||
}
|
||||
.frame(minWidth: 400, minHeight: 600)
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import SwiftUI
|
|||
highlight: Highlight? = nil,
|
||||
initiallySelectedLabels: [LinkedItemLabel]? = nil
|
||||
) async {
|
||||
isLoading = true
|
||||
let selLabels = initiallySelectedLabels ?? item?.sortedLabels ?? highlight?.sortedLabels ?? []
|
||||
|
||||
await loadLabelsFromStore(dataService: dataService)
|
||||
|
|
@ -42,7 +41,6 @@ import SwiftUI
|
|||
unselectedLabels.insert(label)
|
||||
}
|
||||
}
|
||||
isLoading = false
|
||||
|
||||
Task.detached(priority: .userInitiated) {
|
||||
if let labelIDs = try? await dataService.labels() {
|
||||
|
|
@ -59,7 +57,6 @@ import SwiftUI
|
|||
self.unselectedLabels.insert(label)
|
||||
}
|
||||
}
|
||||
self.isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue