From b0f7dd2c0817acf4c8a51d094292efb2a318ae56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 28 Nov 2026 04:53:21 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20edge=20strip=20gone,=20?= =?UTF-8?q?collapse=20arrow=20returns=20at=20the=20end=20of=20the=20accoun?= =?UTF-8?q?t=20row=20(expand=20under=20the=20avatar=20when=20collapsed);?= =?UTF-8?q?=20friends=20keeps=20the=20contact=20card?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/sidebar.rs | 62 +++++++++++++++----------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/crates/client/src/gui/sidebar.rs b/crates/client/src/gui/sidebar.rs index 4dacea4..fb25420 100644 --- a/crates/client/src/gui/sidebar.rs +++ b/crates/client/src/gui/sidebar.rs @@ -51,20 +51,14 @@ impl Yumush { .flex_shrink_0() .overflow_hidden() .child(content); - let sidebar = match self.chat.sidebar_toggled { + match self.chat.sidebar_toggled { Some(at) if at.elapsed() < motion().duration => sidebar .with_animation(id, motion(), move |sidebar, delta| { sidebar.w(px(from + (to - from) * delta)) }) .into_any_element(), _ => sidebar.w(px(to)).into_any_element(), - }; - div() - .relative() - .h_full() - .flex_shrink_0() - .child(sidebar) - .child(self.sidebar_edge(entity, palette)) + } } fn collapsed_sidebar(&self, entity: &Entity, palette: Palette) -> Div { @@ -87,7 +81,8 @@ impl Yumush { self.user .as_ref() .map(|user| self.account_trigger(entity, user, false, palette)), - ), + ) + .child(self.collapse_button(entity, palette)), ) } @@ -375,30 +370,29 @@ impl Yumush { self.select_community(community_id, window, cx); } - fn sidebar_edge(&self, entity: &Entity, palette: Palette) -> impl IntoElement { - let border = palette.border; - div() - .id("sidebar_edge") - .absolute() - .top_0() - .right_0() - .h_full() - .w(px(space::XS)) - .cursor_pointer() - .hover(move |style| style.bg(border)) - .tip(if self.chat.sidebar_collapsed { - "Expand" + fn collapse_button(&self, entity: &Entity, palette: Palette) -> AnyElement { + let (icon, tip) = if self.chat.sidebar_collapsed { + (IconName::ArrowRight, "Expand") + } else { + (IconName::ArrowLeft, "Collapse") + }; + + icon_button( + if self.chat.sidebar_collapsed { + "sidebar_expand" } else { - "Collapse" - }) - .on_click({ - let toggle = entity_action(entity, |yumush, _, cx| { - yumush.chat.sidebar_collapsed = !yumush.chat.sidebar_collapsed; - yumush.chat.sidebar_toggled = Some(std::time::Instant::now()); - cx.notify(); - }); - move |_, window, cx| toggle(window, cx) - }) + "sidebar_collapse" + }, + palette, + icon, + tip, + entity_action(entity, |yumush, _, cx| { + yumush.chat.sidebar_collapsed = !yumush.chat.sidebar_collapsed; + yumush.chat.sidebar_toggled = Some(std::time::Instant::now()); + cx.notify(); + }), + ) + .into_any_element() } pub(super) fn open_friends(&mut self, window: &mut Window, cx: &mut Context) { @@ -975,7 +969,9 @@ impl Yumush { .when(ghost, |button| { button.text_color(palette.tokens.hue(super::style::my_hue())) }) - })), + })) + .child(div().flex_1()) + .child(self.collapse_button(entity, palette)), ) }