.
This commit is contained in:
@@ -13,6 +13,7 @@ use gpui::{
|
||||
use gpui_component::clipboard::Clipboard;
|
||||
use gpui_component::dock::{Panel, PanelEvent};
|
||||
use gpui_component::list::ListItem;
|
||||
use gpui_component::resizable::{resizable_panel, v_resizable};
|
||||
use gpui_component::spinner::Spinner;
|
||||
use gpui_component::tag::Tag;
|
||||
use gpui_component::tree::{TreeEntry, TreeItem, TreeState, tree};
|
||||
@@ -201,12 +202,12 @@ impl CommitDiffView {
|
||||
.flex_1()
|
||||
.min_h_0()
|
||||
.when(self.diff.is_some(), |this| {
|
||||
this.child(tree(
|
||||
&tree_state,
|
||||
move |ix, entry, selected, _window, _cx| {
|
||||
this.child(
|
||||
tree(&tree_state, move |ix, entry, selected, _window, _cx| {
|
||||
Self::render_tree_item(ix, entry, selected, &view)
|
||||
},
|
||||
))
|
||||
})
|
||||
.p_2(),
|
||||
)
|
||||
})
|
||||
.when(self.diff.is_none() && !self.loading, |this| {
|
||||
this.child(
|
||||
@@ -425,14 +426,12 @@ impl CommitDiffView {
|
||||
|
||||
v_flex()
|
||||
.px_4()
|
||||
.py_2()
|
||||
.pt_2()
|
||||
.pb_4()
|
||||
.w_full()
|
||||
.gap_4()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().border)
|
||||
.child(
|
||||
v_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.font_semibold()
|
||||
@@ -442,7 +441,7 @@ impl CommitDiffView {
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2p5()
|
||||
.gap_2()
|
||||
.text_sm()
|
||||
.child(h_flex().child(format!("{} committed", commit.author)))
|
||||
.child(
|
||||
@@ -482,7 +481,7 @@ impl CommitDiffView {
|
||||
})
|
||||
.when(deletions > 0, |this| {
|
||||
this.child(
|
||||
Tag::success()
|
||||
Tag::danger()
|
||||
.outline()
|
||||
.small()
|
||||
.child(format!("- {insertions}")),
|
||||
@@ -528,17 +527,24 @@ impl Focusable for CommitDiffView {
|
||||
|
||||
impl Render for CommitDiffView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
v_flex()
|
||||
.id("commit-diff")
|
||||
.size_full()
|
||||
.child(self.render_header(cx))
|
||||
v_resizable("commit-diff")
|
||||
.child(
|
||||
resizable_panel()
|
||||
.size(px(170.))
|
||||
.size_range(px(100.)..px(400.))
|
||||
.flex_none()
|
||||
.bg(cx.theme().background)
|
||||
.child(self.render_header(cx)),
|
||||
)
|
||||
.child(
|
||||
resizable_panel().child(
|
||||
h_flex()
|
||||
.flex_1()
|
||||
.w_full()
|
||||
.size_full()
|
||||
.min_h_0()
|
||||
.bg(cx.theme().background)
|
||||
.child(self.render_tree_column(cx))
|
||||
.child(self.render_detail_column(cx)),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,19 +592,18 @@ impl RepoDetailView {
|
||||
let Some(worktree) = self.worktree.clone() else {
|
||||
return;
|
||||
};
|
||||
|
||||
// Same display name as the repo detail panel's title.
|
||||
let announcement = self.announcement.as_ref().unwrap_or(&self.initial);
|
||||
let repo_name = announcement
|
||||
.name
|
||||
.clone()
|
||||
.unwrap_or_else(|| SharedString::from(announcement.id.clone()));
|
||||
|
||||
let panel =
|
||||
cx.new(|cx| CommitDiffView::new(worktree, repo_name, commit.clone(), window, cx));
|
||||
|
||||
if let Some(dock_area) = self.dock_area.upgrade() {
|
||||
dock_area.update(cx, |dock_area, cx| {
|
||||
// The diff viewer lives in the bottom dock, leaving the
|
||||
// central explorer open while browsing a commit.
|
||||
dock_area.add_panel(Arc::new(panel), DockPlacement::Bottom, None, window, cx);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user