From 96d785cb45e5496fd694a579ef7aa86b7ab247c0 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 1 May 2025 14:12:52 -0300 Subject: [PATCH] git: Improve co-author button (#29742) This PR changes the tooltip label to say "Remove" when you have the button toggled on and collaborators in the list. Release Notes: - N/A Co-authored-by: Joseph T. Lyons --- assets/icons/user_check.svg | 1 + crates/git_ui/src/git_panel.rs | 12 ++++++++++-- crates/icons/src/icons.rs | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 assets/icons/user_check.svg diff --git a/assets/icons/user_check.svg b/assets/icons/user_check.svg new file mode 100644 index 0000000000..e5f13feeb4 --- /dev/null +++ b/assets/icons/user_check.svg @@ -0,0 +1 @@ + diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index a5bd4a0a15..6d2cc2542c 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -2755,18 +2755,26 @@ impl GitPanel { pub(crate) fn render_co_authors(&self, cx: &Context) -> Option { let potential_co_authors = self.potential_co_authors(cx); + + let (tooltip_label, icon) = if self.add_coauthors { + ("Add co-authored-by", IconName::UserCheck) + } else { + ("Remove co-authored-by", IconName::Person) + }; + if potential_co_authors.is_empty() { None } else { Some( - IconButton::new("co-authors", IconName::Person) + IconButton::new("co-authors", icon) .shape(ui::IconButtonShape::Square) .icon_color(Color::Disabled) .selected_icon_color(Color::Selected) .toggle_state(self.add_coauthors) .tooltip(move |_, cx| { let title = format!( - "Add co-authored-by:{}{}", + "{}:{}{}", + tooltip_label, if potential_co_authors.len() == 1 { "" } else { diff --git a/crates/icons/src/icons.rs b/crates/icons/src/icons.rs index f7b15dbfcd..32ee3f80ef 100644 --- a/crates/icons/src/icons.rs +++ b/crates/icons/src/icons.rs @@ -238,6 +238,7 @@ pub enum IconName { Undo, Unpin, Update, + UserCheck, UserGroup, UserRoundPen, Visible,