commit 17f87d5438220d59da5209791ae5d1c56d647ec2
parent 82b7cab9b18a5c2ba8fba6d1ca0cb5829a734950
Author: William Casarin <jb55@jb55.com>
Date: Thu, 28 Jul 2022 13:20:06 -0700
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>
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift
@@ -37,6 +37,10 @@ struct PostView: View {
NotificationCenter.default.post(name: .post, object: NostrPostResult.post(new_post))
dismiss()
}
+
+ var is_post_empty: Bool {
+ return post.allSatisfy { $0.isWhitespace }
+ }
var body: some View {
VStack {
@@ -48,8 +52,10 @@ struct PostView: View {
Spacer()
- Button("Post") {
- self.send_post()
+ if !is_post_empty {
+ Button("Post") {
+ self.send_post()
+ }
}
}
.padding([.top, .bottom], 4)