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>
This commit is contained in:
@@ -37,6 +37,10 @@ struct PostView: View {
|
|||||||
NotificationCenter.default.post(name: .post, object: NostrPostResult.post(new_post))
|
NotificationCenter.default.post(name: .post, object: NostrPostResult.post(new_post))
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var is_post_empty: Bool {
|
||||||
|
return post.allSatisfy { $0.isWhitespace }
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
@@ -48,8 +52,10 @@ struct PostView: View {
|
|||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button("Post") {
|
if !is_post_empty {
|
||||||
self.send_post()
|
Button("Post") {
|
||||||
|
self.send_post()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding([.top, .bottom], 4)
|
.padding([.top, .bottom], 4)
|
||||||
|
|||||||
Reference in New Issue
Block a user