mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix apply labels view for macos app
This commit is contained in:
parent
39df22f4bf
commit
1ea4b63f54
1 changed files with 51 additions and 30 deletions
|
|
@ -73,6 +73,9 @@ struct ApplyLabelsView: View {
|
|||
}
|
||||
}
|
||||
)
|
||||
#if os(macOS)
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,24 +84,17 @@ struct ApplyLabelsView: View {
|
|||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button(
|
||||
action: { presentationMode.wrappedValue.dismiss() },
|
||||
label: { Text("Cancel").foregroundColor(.appGrayTextContrast) }
|
||||
)
|
||||
cancelButton
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
switch mode {
|
||||
case let .item(feedItem):
|
||||
viewModel.saveItemLabelChanges(itemID: feedItem.unwrappedID, dataService: dataService)
|
||||
case .list:
|
||||
onSave?(viewModel.selectedLabels)
|
||||
}
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
},
|
||||
label: { Text(mode.confirmButtonText).foregroundColor(.appGrayTextContrast) }
|
||||
)
|
||||
saveItemChangesButton
|
||||
}
|
||||
}
|
||||
#else
|
||||
.toolbar {
|
||||
ToolbarItemGroup {
|
||||
cancelButton
|
||||
saveItemChangesButton
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -107,21 +103,46 @@ struct ApplyLabelsView: View {
|
|||
}
|
||||
}
|
||||
|
||||
var saveItemChangesButton: some View {
|
||||
Button(
|
||||
action: {
|
||||
switch mode {
|
||||
case let .item(feedItem):
|
||||
viewModel.saveItemLabelChanges(itemID: feedItem.unwrappedID, dataService: dataService)
|
||||
case .list:
|
||||
onSave?(viewModel.selectedLabels)
|
||||
}
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
},
|
||||
label: { Text(mode.confirmButtonText).foregroundColor(.appGrayTextContrast) }
|
||||
)
|
||||
}
|
||||
|
||||
var cancelButton: some View {
|
||||
Button(
|
||||
action: { presentationMode.wrappedValue.dismiss() },
|
||||
label: { Text("Cancel").foregroundColor(.appGrayTextContrast) }
|
||||
)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if viewModel.isLoading {
|
||||
EmptyView()
|
||||
} else {
|
||||
#if os(iOS)
|
||||
innerBody
|
||||
.searchable(
|
||||
text: $viewModel.labelSearchFilter,
|
||||
placement: .navigationBarDrawer(displayMode: .always)
|
||||
)
|
||||
#else
|
||||
innerBody
|
||||
#endif
|
||||
}
|
||||
Group {
|
||||
#if os(iOS)
|
||||
NavigationView {
|
||||
if viewModel.isLoading {
|
||||
EmptyView()
|
||||
} else {
|
||||
innerBody
|
||||
.searchable(
|
||||
text: $viewModel.labelSearchFilter,
|
||||
placement: .navigationBarDrawer(displayMode: .always)
|
||||
)
|
||||
}
|
||||
}
|
||||
#elseif os(macOS)
|
||||
innerBody
|
||||
.frame(minWidth: 400, minHeight: 400)
|
||||
#endif
|
||||
}
|
||||
.task {
|
||||
switch mode {
|
||||
|
|
|
|||
Loading…
Reference in a new issue