git_graph: Add some design adjustments (#49899)
- Made hover/active styles, as well as clicks, work for the entire row, capture the graph element, too (needed to make some manual hover and other states management to pull that off) - Used the existing `Chip` component for the branch chip instead of a local recreation - Adjusted spacing and sizing of commit detail panel, including button labels truncation and tooltip content - Added diff stat numbers for the changed files, to match the commit view - Standardized the commit avatar component across the git graph, the commit view, and the file history view - Added scrollbar to the changed files uniform list - Removed author name display redundancy (kept only email) - Made the commit detail UI have a min-width <img width="750" height="1964" alt="Screenshot 2026-02-23 at 11 31@2x" src="https://github.com/user-attachments/assets/d1433bd8-5edb-4829-882b-52b1bffbd6db" /> --- Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - N/A --------- Co-authored-by: Anthony Eid <anthony@zed.dev>
This commit is contained in:
1 parent
b775e5d63f
commit
a3c62de696
10 files changed
+588
-412
No files matched your search
@@ -5,7 +5,7 @@ use git::blame::BlameEntry;
|
||||
use git::repository::CommitSummary;
|
||||
use git::{GitRemote, commit::ParsedCommitMessage};
|
||||
use gpui::{
|
||||
App, Asset, Element, Entity, MouseButton, ParentElement, Render, ScrollHandle,
|
||||
AbsoluteLength, App, Asset, Element, Entity, MouseButton, ParentElement, Render, ScrollHandle,
|
||||
StatefulInteractiveElement, WeakEntity, prelude::*,
|
||||
};
|
||||
use markdown::{Markdown, MarkdownElement};
|
||||
@@ -30,7 +30,7 @@ pub struct CommitAvatar<'a> {
|
||||
sha: &'a SharedString,
|
||||
author_email: Option<SharedString>,
|
||||
remote: Option<&'a GitRemote>,
|
||||
size: Option<IconSize>,
|
||||
size: Option<AbsoluteLength>,
|
||||
}
|
||||
|
||||
impl<'a> CommitAvatar<'a> {
|
||||
@@ -59,21 +59,38 @@ impl<'a> CommitAvatar<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn size(mut self, size: IconSize) -> Self {
|
||||
self.size = Some(size);
|
||||
pub fn size(mut self, size: impl Into<AbsoluteLength>) -> Self {
|
||||
self.size = Some(size.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn render(&'a self, window: &mut Window, cx: &mut App) -> AnyElement {
|
||||
let border_color = cx.theme().colors().border_variant;
|
||||
let border_width = px(1.);
|
||||
|
||||
match self.avatar(window, cx) {
|
||||
// Loading or no avatar found
|
||||
None => Icon::new(IconName::Person)
|
||||
.color(Color::Muted)
|
||||
.when_some(self.size, |this, size| this.size(size))
|
||||
.into_any_element(),
|
||||
// Found
|
||||
None => {
|
||||
let container_size = self
|
||||
.size
|
||||
.map(|s| s.to_pixels(window.rem_size()) + border_width * 2.);
|
||||
|
||||
h_flex()
|
||||
.when_some(container_size, |this, size| this.size(size))
|
||||
.justify_center()
|
||||
.rounded_full()
|
||||
.border(border_width)
|
||||
.border_color(border_color)
|
||||
.bg(cx.theme().colors().element_disabled)
|
||||
.child(
|
||||
Icon::new(IconName::Person)
|
||||
.color(Color::Muted)
|
||||
.size(IconSize::Small),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
Some(avatar) => avatar
|
||||
.when_some(self.size, |this, size| this.size(size.rems()))
|
||||
.when_some(self.size, |this, size| this.size(size))
|
||||
.border_color(border_color)
|
||||
.into_any_element(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user