fix(ui): collapsed sidebare refresh status button

This commit is contained in:
Suyog Tandel
2026-01-31 02:53:18 +05:30
parent e2aadff1d8
commit 15f6ac776a
2 changed files with 16 additions and 1 deletions
+8 -1
View File
@@ -12,6 +12,7 @@ pub struct AppSidebar<V: 'static> {
state: GlobalDeviceState,
on_select: Option<Rc<dyn Fn(&mut V, ActiveView, &mut Window, &mut Context<V>)>>,
refresh_btn: Option<AnyElement>,
refresh_btn_collapsed: Option<AnyElement>,
}
impl<V: 'static> AppSidebar<V> {
@@ -28,6 +29,7 @@ impl<V: 'static> AppSidebar<V> {
state,
on_select: None,
refresh_btn: None,
refresh_btn_collapsed: None,
}
}
@@ -44,6 +46,11 @@ impl<V: 'static> AppSidebar<V> {
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<V>) -> impl IntoElement {
let width = self.width;
let collapsed = self.collapsed;
@@ -169,7 +176,7 @@ impl<V: 'static> AppSidebar<V> {
.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 {
+8
View File
@@ -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(