diff --git a/src/ui/components/sidebar.rs b/src/ui/components/sidebar.rs index 469848c..edca902 100644 --- a/src/ui/components/sidebar.rs +++ b/src/ui/components/sidebar.rs @@ -12,6 +12,7 @@ pub struct AppSidebar { state: GlobalDeviceState, on_select: Option)>>, refresh_btn: Option, + refresh_btn_collapsed: Option, } impl AppSidebar { @@ -28,6 +29,7 @@ impl AppSidebar { state, on_select: None, refresh_btn: None, + refresh_btn_collapsed: None, } } @@ -44,6 +46,11 @@ impl AppSidebar { self } + pub fn with_refresh_btn_collapsed(mut self, btn: impl IntoElement) -> Self { + self.refresh_btn_collapsed = Some(btn.into_any_element()); + self + } + pub fn render(self, cx: &mut Context) -> impl IntoElement { let width = self.width; let collapsed = self.collapsed; @@ -169,7 +176,7 @@ impl AppSidebar { .items_center() .justify_center() .gap_2() - .children(self.refresh_btn) + .children(self.refresh_btn_collapsed) .child(div().w(px(8.)).h(px(8.)).rounded_full().bg( if let Some(status) = &state.device_status { if status.method == DeviceMethod::Fido { diff --git a/src/ui/rootview.rs b/src/ui/rootview.rs index 2658835..5e8405f 100644 --- a/src/ui/rootview.rs +++ b/src/ui/rootview.rs @@ -115,6 +115,14 @@ impl Render for ApplicationRoot { this.active_view = view; }) .with_refresh_btn(self.refresh_button.clone()) + .with_refresh_btn_collapsed( + Button::new("refresh-btn-collapsed") + .ghost() + .child(Icon::default().path("icons/refresh-cw.svg")) + .on_click(cx.listener(|this, _, _, cx| { + this.refresh_device_status(cx); + })), + ) .render(cx), ) .child(