forge
Explore
Log in

Don't you dare go Hollow

Edge strip gone, collapse arrow returns at the end of the account row (expand under the avatar when collapsed)

Browse files at this commit

b0f7dd2c0817acf4c8a51d094292efb2a318ae56Ahmet Kaan GümüşParent: aef2bdf
  • style
    • edge strip gone, collapse arrow returns at the end of the account row (expand under the avatar when collapsed)
    • friends keeps the contact card
Show full message
💄 style: edge strip gone, collapse arrow returns at the end of the account row (expand under the avatar when collapsed); friends keeps the contact card
crates/client/src/gui/sidebar.rsmodified+29 -33
@@ -51,20 +51,14 @@ impl Yumush {
51 .flex_shrink_0()51 .flex_shrink_0()
52 .overflow_hidden()52 .overflow_hidden()
53 .child(content);53 .child(content);
54- let sidebar = match self.chat.sidebar_toggled {54+ match self.chat.sidebar_toggled {
55 Some(at) if at.elapsed() < motion().duration => sidebar55 Some(at) if at.elapsed() < motion().duration => sidebar
56 .with_animation(id, motion(), move |sidebar, delta| {56 .with_animation(id, motion(), move |sidebar, delta| {
57 sidebar.w(px(from + (to - from) * delta))57 sidebar.w(px(from + (to - from) * delta))
58 })58 })
59 .into_any_element(),59 .into_any_element(),
60 _ => sidebar.w(px(to)).into_any_element(),60 _ => sidebar.w(px(to)).into_any_element(),
61- };61+ }
62- div()
63- .relative()
64- .h_full()
65- .flex_shrink_0()
66- .child(sidebar)
67- .child(self.sidebar_edge(entity, palette))
68 }62 }
69 63
70 fn collapsed_sidebar(&self, entity: &Entity<Self>, palette: Palette) -> Div {64 fn collapsed_sidebar(&self, entity: &Entity<Self>, palette: Palette) -> Div {
@@ -87,7 +81,8 @@ impl Yumush {
87 self.user81 self.user
88 .as_ref()82 .as_ref()
89 .map(|user| self.account_trigger(entity, user, false, palette)),83 .map(|user| self.account_trigger(entity, user, false, palette)),
90- ),84+ )
85+ .child(self.collapse_button(entity, palette)),
91 )86 )
92 }87 }
93 88
@@ -375,30 +370,29 @@ impl Yumush {
375 self.select_community(community_id, window, cx);370 self.select_community(community_id, window, cx);
376 }371 }
377 372
378- fn sidebar_edge(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement {373+ fn collapse_button(&self, entity: &Entity<Self>, palette: Palette) -> AnyElement {
379- let border = palette.border;374+ let (icon, tip) = if self.chat.sidebar_collapsed {
380- div()375+ (IconName::ArrowRight, "Expand")
381- .id("sidebar_edge")376+ } else {
382- .absolute()377+ (IconName::ArrowLeft, "Collapse")
383- .top_0()378+ };
384- .right_0()379+
385- .h_full()380+ icon_button(
386- .w(px(space::XS))381+ if self.chat.sidebar_collapsed {
387- .cursor_pointer()382+ "sidebar_expand"
388- .hover(move |style| style.bg(border))
389- .tip(if self.chat.sidebar_collapsed {
390- "Expand"
391 } else {383 } else {
392- "Collapse"384+ "sidebar_collapse"
393- })385+ },
394- .on_click({386+ palette,
395- let toggle = entity_action(entity, |yumush, _, cx| {387+ icon,
396- yumush.chat.sidebar_collapsed = !yumush.chat.sidebar_collapsed;388+ tip,
397- yumush.chat.sidebar_toggled = Some(std::time::Instant::now());389+ entity_action(entity, |yumush, _, cx| {
398- cx.notify();390+ yumush.chat.sidebar_collapsed = !yumush.chat.sidebar_collapsed;
399- });391+ yumush.chat.sidebar_toggled = Some(std::time::Instant::now());
400- move |_, window, cx| toggle(window, cx)392+ cx.notify();
401- })393+ }),
394+ )
395+ .into_any_element()
402 }396 }
403 397
404 pub(super) fn open_friends(&mut self, window: &mut Window, cx: &mut Context<Self>) {398 pub(super) fn open_friends(&mut self, window: &mut Window, cx: &mut Context<Self>) {
@@ -975,7 +969,9 @@ impl Yumush {
975 .when(ghost, |button| {969 .when(ghost, |button| {
976 button.text_color(palette.tokens.hue(super::style::my_hue()))970 button.text_color(palette.tokens.hue(super::style::my_hue()))
977 })971 })
978- })),972+ }))
973+ .child(div().flex_1())
974+ .child(self.collapse_button(entity, palette)),
979 )975 )
980 }976 }
981 977