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