Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

git: Improve co-author button (#29742)

Danilo Leal96d785cb45e5
diff --git a/assets/icons/user_check.svg b/assets/icons/user_check.svg
new file mode 100644
index 00000000000..e5f13feeb4d
--- /dev/null
+++ b/assets/icons/user_check.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-round-check-icon lucide-user-round-check"><path d="M2 21a8 8 0 0 1 13.292-6"/><circle cx="10" cy="8" r="5"/><path d="m16 19 2 2 4-4"/></svg>
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index a5bd4a0a152..6d2cc2542cc 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<Self>) -> Option<AnyElement> {
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 f7b15dbfcd8..32ee3f80ef3 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,