commit c9d1b487064f00bfcda9d3f6ce4115f31d365fec
parent e2a2db8ac2e093e6b6c0b630267dca19808fc370
Author: William Casarin <jb55@jb55.com>
Date: Fri, 22 Nov 2024 12:50:07 -0800
Merge disable post button if draft buffer empty #469
William Casarin (2):
ui: simply hide post button if buffer is empty
kernelkind (1):
disable post button if draft buffer empty
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/ui/note/post.rs b/src/ui/note/post.rs
@@ -208,8 +208,16 @@ impl<'a> PostView<'a> {
}
ui.with_layout(egui::Layout::right_to_left(egui::Align::BOTTOM), |ui| {
+ if self.draft.buffer.is_empty() {
+ // Don't render button if our buffer is empty
+ return None;
+ }
+
if ui
- .add_sized([91.0, 32.0], egui::Button::new("Post now"))
+ .add_sized(
+ [91.0, 32.0],
+ egui::Button::new("Post now")
+ )
.clicked()
{
let new_post = NewPost::new(