Browse Source

Don't show post button if post is only whitespace

Changelog-Changed: Post button is not shown if the content is only whitespace
Signed-off-by: William Casarin <jb55@jb55.com>
profiles-everywhere
William Casarin 3 years ago
parent
commit
17f87d5438
  1. 6
      damus/Views/PostView.swift

6
damus/Views/PostView.swift

@ -38,6 +38,10 @@ struct PostView: View {
dismiss() dismiss()
} }
var is_post_empty: Bool {
return post.allSatisfy { $0.isWhitespace }
}
var body: some View { var body: some View {
VStack { VStack {
HStack { HStack {
@ -48,10 +52,12 @@ struct PostView: View {
Spacer() Spacer()
if !is_post_empty {
Button("Post") { Button("Post") {
self.send_post() self.send_post()
} }
} }
}
.padding([.top, .bottom], 4) .padding([.top, .bottom], 4)
TextEditor(text: $post) TextEditor(text: $post)

Loading…
Cancel
Save