Remove PostEditorView toolbar (post status badge and publish button)

This commit is contained in:
Angelo Stavrow 2020-11-24 15:15:28 -05:00
parent 3c501cf67d
commit 1a8ae1d4d3
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -15,26 +15,6 @@ struct PostEditorView: View {
)
.padding()
.background(Color(NSColor.controlBackgroundColor))
.toolbar {
ToolbarItem(placement: .status) {
PostEditorStatusToolbarView(post: post)
}
ToolbarItem(placement: .primaryAction) {
Button(action: {
if model.account.isLoggedIn {
publishPost()
} else {
let mainMenu = NSApplication.shared.mainMenu
let appMenuItem = mainMenu?.item(withTitle: "WriteFreely")
let prefsItem = appMenuItem?.submenu?.item(withTitle: "Preferences…")
NSApplication.shared.sendAction(prefsItem!.action!, to: prefsItem?.target, from: nil)
}
}, label: {
Image(systemName: "paperplane")
})
.disabled(post.status == PostStatus.published.rawValue || post.body.count == 0)
}
}
.onChange(of: post.hasNewerRemoteCopy, perform: { _ in
if !post.hasNewerRemoteCopy {
self.updatingFromServer = true
@ -56,13 +36,6 @@ struct PostEditorView: View {
}
})
}
private func publishPost() {
DispatchQueue.main.async {
LocalStorageManager().saveContext()
model.publish(post: post)
}
}
}
struct PostEditorView_EmptyPostPreviews: PreviewProvider {