From 8afc67345fdd5db4bc8ab0e5a9c72b53c706a821 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Fri, 13 Feb 2026 10:39:30 -0300 Subject: [PATCH] git_ui: Fix graph icon button design in the panel (#49099) Adding the Git Graph icon and adjusting button sizing, spacing, and positioning within the Git panel. Release Notes: - N/A --- assets/icons/git_graph.svg | 4 ++ crates/git_ui/src/git_panel.rs | 80 ++++++++++++++++++---------------- crates/icons/src/icons.rs | 1 + 3 files changed, 47 insertions(+), 38 deletions(-) create mode 100644 assets/icons/git_graph.svg diff --git a/assets/icons/git_graph.svg b/assets/icons/git_graph.svg new file mode 100644 index 0000000000000000000000000000000000000000..8f372a305d3fddf2901756108c83d09b31fb657e --- /dev/null +++ b/assets/icons/git_graph.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 5e71b62e22b8b3f4bbfcdcbff3f93c9ea6abde91..50b29381fba0f54e4a03bca904e15d017ff4968b 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -4478,10 +4478,10 @@ impl GitPanel { .child( div() .id("commit-msg-hover") - .px_1() .cursor_pointer() - .line_clamp(1) + .px_1() .rounded_sm() + .line_clamp(1) .hover(|s| s.bg(cx.theme().colors().element_hover)) .child( Label::new(commit.subject.clone()) @@ -4517,42 +4517,46 @@ impl GitPanel { } }), ) - .when(commit.has_parent, |this| { - let has_unstaged = self.has_unstaged_changes(); - this.pr_2().child( - h_flex().gap_1().child( - panel_icon_button("undo", IconName::Undo) - .icon_size(IconSize::XSmall) - .icon_color(Color::Muted) - .tooltip(move |_window, cx| { - Tooltip::with_meta( - "Uncommit", - Some(&git::Uncommit), - if has_unstaged { - "git reset HEAD^ --soft" - } else { - "git reset HEAD^" - }, - cx, - ) - }) - .on_click( - cx.listener(|this, _, window, cx| this.uncommit(window, cx)), - ), - ), - ) - }) - .when(window.is_action_available(&Open, cx), |this| { - this.child( - panel_icon_button("git-graph-button", IconName::ListTree) - .icon_size(IconSize::XSmall) - .icon_color(Color::Muted) - .tooltip(|_window, cx| Tooltip::for_action("Open Git Graph", &Open, cx)) - .on_click(|_, window, cx| { - window.dispatch_action(Open.boxed_clone(), cx) - }), - ) - }), + .child( + h_flex() + .gap_0p5() + .when(commit.has_parent, |this| { + let has_unstaged = self.has_unstaged_changes(); + this.child( + panel_icon_button("undo", IconName::Undo) + .icon_size(IconSize::Small) + .tooltip(move |_window, cx| { + Tooltip::with_meta( + "Uncommit", + Some(&git::Uncommit), + if has_unstaged { + "git reset HEAD^ --soft" + } else { + "git reset HEAD^" + }, + cx, + ) + }) + .on_click( + cx.listener(|this, _, window, cx| { + this.uncommit(window, cx) + }), + ), + ) + }) + .when(window.is_action_available(&Open, cx), |this| { + this.child( + panel_icon_button("git-graph-button", IconName::GitGraph) + .icon_size(IconSize::Small) + .tooltip(|_window, cx| { + Tooltip::for_action("Open Git Graph", &Open, cx) + }) + .on_click(|_, window, cx| { + window.dispatch_action(Open.boxed_clone(), cx) + }), + ) + }), + ), ) } diff --git a/crates/icons/src/icons.rs b/crates/icons/src/icons.rs index 1f6e9c5fa15f5b8eca0bfd84a08ff168dbc7f6c6..9ed9a8b658cc8bbf89c9d14d131fc8faefbc80ed 100644 --- a/crates/icons/src/icons.rs +++ b/crates/icons/src/icons.rs @@ -142,6 +142,7 @@ pub enum IconName { GitBranch, GitBranchAlt, GitBranchPlus, + GitGraph, Github, Hash, HistoryRerun,