From b965333325436477f4cd6773ded68ad980da6117 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 23 Feb 2023 15:09:32 +0100 Subject: [PATCH] Show avatar in user menu --- crates/collab_ui/src/collab_titlebar_item.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index 5c2fd822c6a8b17ed7c56989b74b539cc832e754..35ffb5c729d87cab7fd30b9061d549b657415aa3 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -278,12 +278,27 @@ impl CollabTitlebarItem { pub fn toggle_user_menu(&mut self, _: &ToggleUserMenu, cx: &mut ViewContext) { let theme = cx.global::().theme.clone(); - let label_style = theme.context_menu.item.disabled_style().label.clone(); + let avatar_style = theme.workspace.titlebar.avatar.clone(); + let item_style = theme.context_menu.item.disabled_style().clone(); self.user_menu.update(cx, |user_menu, cx| { let items = if let Some(user) = self.user_store.read(cx).current_user() { vec![ ContextMenuItem::Static(Box::new(move |_| { - Label::new(user.github_login.clone(), label_style.clone()).boxed() + Flex::row() + .with_children(user.avatar.clone().map(|avatar| { + Self::render_face( + avatar, + avatar_style.clone(), + Color::transparent_black(), + ) + })) + .with_child( + Label::new(user.github_login.clone(), item_style.label.clone()) + .boxed(), + ) + .contained() + .with_style(item_style.container) + .boxed() })), ContextMenuItem::Item { label: "Sign out".into(),