Remove user avatar from dropdown menu

Add new options in context menu
This commit is contained in:
Piotr Osiewicz 2023-06-10 01:35:18 +02:00 committed by Mikayla Maki
parent 5f7fdd25eb
commit 0fe65b945f
No known key found for this signature in database
3 changed files with 14 additions and 26 deletions

1
Cargo.lock generated
View file

@ -1325,6 +1325,7 @@ dependencies = [
"serde_derive", "serde_derive",
"settings", "settings",
"theme", "theme",
"theme_selector",
"util", "util",
"workspace", "workspace",
] ]

View file

@ -37,6 +37,7 @@ picker = { path = "../picker" }
project = { path = "../project" } project = { path = "../project" }
settings = { path = "../settings" } settings = { path = "../settings" }
theme = { path = "../theme" } theme = { path = "../theme" }
theme_selector = { path = "../theme_selector" }
util = { path = "../util" } util = { path = "../util" }
workspace = { path = "../workspace" } workspace = { path = "../workspace" }

View file

@ -99,7 +99,7 @@ impl View for CollabTitlebarItem {
right_container.add_child(self.render_user_menu_button(&theme, avatar, cx)); right_container.add_child(self.render_user_menu_button(&theme, avatar, cx));
} else { } else {
right_container.add_children(self.render_connection_status(status, cx)); right_container.add_children(self.render_connection_status(status, cx));
right_container.add_child(self.render_sign_in_button(&theme, cx)); right_container.add_child(self.render_user_menu_button(&theme, None, cx));
} }
Stack::new() Stack::new()
@ -298,42 +298,28 @@ impl CollabTitlebarItem {
} }
pub fn toggle_user_menu(&mut self, _: &ToggleUserMenu, cx: &mut ViewContext<Self>) { pub fn toggle_user_menu(&mut self, _: &ToggleUserMenu, cx: &mut ViewContext<Self>) {
let theme = theme::current(cx).clone();
let avatar_style = theme.workspace.titlebar.leader_avatar.clone();
let item_style = theme.context_menu.item.disabled_style().clone();
self.user_menu.update(cx, |user_menu, cx| { self.user_menu.update(cx, |user_menu, cx| {
let items = if let Some(user) = self.user_store.read(cx).current_user() { let items = if let Some(_) = self.user_store.read(cx).current_user() {
vec![ vec![
ContextMenuItem::Static(Box::new(move |_| { ContextMenuItem::action("Settings", SignIn),
Flex::row() ContextMenuItem::action("Theme", theme_selector::Toggle),
.with_children(user.avatar.clone().map(|avatar| { ContextMenuItem::separator(),
Self::render_face(
avatar,
avatar_style.clone(),
Color::transparent_black(),
)
}))
.with_child(Label::new(
user.github_login.clone(),
item_style.label.clone(),
))
.contained()
.with_style(item_style.container)
.into_any()
})),
ContextMenuItem::action("Sign out", SignOut),
ContextMenuItem::action( ContextMenuItem::action(
"Send Feedback", "Share Feedback",
feedback::feedback_editor::GiveFeedback, feedback::feedback_editor::GiveFeedback,
), ),
ContextMenuItem::action("Sign out", SignOut),
] ]
} else { } else {
vec![ vec![
ContextMenuItem::action("Sign in", SignIn), ContextMenuItem::action("Settings", SignIn),
ContextMenuItem::action("Theme", theme_selector::Toggle),
ContextMenuItem::separator(),
ContextMenuItem::action( ContextMenuItem::action(
"Send Feedback", "Share Feedback",
feedback::feedback_editor::GiveFeedback, feedback::feedback_editor::GiveFeedback,
), ),
ContextMenuItem::action("Sign in", SignIn),
] ]
}; };