[pdm-devel] [PATCH yew-comp 1/1] notes edit: hide toolbar when editing is not possible

Dominik Csapak d.csapak at proxmox.com
Fri Nov 28 11:18:21 CET 2025


instead of displaying a disbled button, simply hide it completely,
saving vertical space.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/notes_view.rs | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/notes_view.rs b/src/notes_view.rs
index 315163e..6b0a379 100644
--- a/src/notes_view.rs
+++ b/src/notes_view.rs
@@ -163,20 +163,19 @@ impl LoadableComponent for ProxmoxNotesView {
     }
     fn toolbar(&self, ctx: &LoadableComponentContext<Self>) -> Option<Html> {
         let props = ctx.props();
-        let toolbar = Toolbar::new()
-            .class("pwt-w-100")
-            .class("pwt-overflow-hidden")
-            .class("pwt-border-bottom")
-            .with_child(
-                Button::new(tr!("Edit"))
-                    .disabled(props.on_submit.is_none())
-                    .onclick(
+        props.on_submit.is_some().then_some(
+            Toolbar::new()
+                .class("pwt-w-100")
+                .class("pwt-overflow-hidden")
+                .class("pwt-border-bottom")
+                .with_child(
+                    Button::new(tr!("Edit")).on_activate(
                         ctx.link()
                             .change_view_callback(|_| Some(ViewState::EditNotes)),
                     ),
-            );
-
-        Some(toolbar.into())
+                )
+                .into(),
+        )
     }
 
     fn main_view(&self, _ctx: &LoadableComponentContext<Self>) -> Html {
-- 
2.47.3





More information about the pdm-devel mailing list