git_ui: Git panel polish (#25164)
- Hides header when no active repo/no repo - Entire commit editor now has i-beam cursor on hover - Adds an icon to the project diff tab Release Notes: - N/A
This commit is contained in:
parent
c0c48d30db
commit
086f002f44
2 changed files with 22 additions and 13 deletions
|
@ -1539,7 +1539,7 @@ impl GitPanel {
|
||||||
&self,
|
&self,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> impl IntoElement {
|
) -> Option<impl IntoElement> {
|
||||||
let all_repositories = self
|
let all_repositories = self
|
||||||
.project
|
.project
|
||||||
.read(cx)
|
.read(cx)
|
||||||
|
@ -1554,17 +1554,21 @@ impl GitPanel {
|
||||||
.is_above_project()
|
.is_above_project()
|
||||||
});
|
});
|
||||||
|
|
||||||
self.panel_header_container(window, cx).when(
|
let has_visible_repo = all_repositories.len() > 0 || has_repo_above;
|
||||||
all_repositories.len() > 1 || has_repo_above,
|
|
||||||
|el| {
|
if has_visible_repo {
|
||||||
el.child(
|
Some(
|
||||||
|
self.panel_header_container(window, cx)
|
||||||
|
.child(
|
||||||
Label::new("Repository")
|
Label::new("Repository")
|
||||||
.size(LabelSize::Small)
|
.size(LabelSize::Small)
|
||||||
.color(Color::Muted),
|
.color(Color::Muted),
|
||||||
)
|
)
|
||||||
.child(self.render_repository_selector(cx))
|
.child(self.render_repository_selector(cx)),
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render_repository_selector(&self, cx: &mut Context<Self>) -> impl IntoElement {
|
pub fn render_repository_selector(&self, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
|
@ -1690,6 +1694,7 @@ impl GitPanel {
|
||||||
.border_t_1()
|
.border_t_1()
|
||||||
.border_color(cx.theme().colors().border)
|
.border_color(cx.theme().colors().border)
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
|
.cursor_text()
|
||||||
.on_click(cx.listener(move |_, _: &ClickEvent, window, _cx| {
|
.on_click(cx.listener(move |_, _: &ClickEvent, window, _cx| {
|
||||||
window.focus(&editor_focus_handle);
|
window.focus(&editor_focus_handle);
|
||||||
}))
|
}))
|
||||||
|
@ -2260,7 +2265,7 @@ impl Render for GitPanel {
|
||||||
.size_full()
|
.size_full()
|
||||||
.overflow_hidden()
|
.overflow_hidden()
|
||||||
.bg(ElevationIndex::Surface.bg(cx))
|
.bg(ElevationIndex::Surface.bg(cx))
|
||||||
.child(self.render_panel_header(window, cx))
|
.children(self.render_panel_header(window, cx))
|
||||||
.child(if has_entries {
|
.child(if has_entries {
|
||||||
self.render_entries(has_write_access, window, cx)
|
self.render_entries(has_write_access, window, cx)
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
|
|
|
@ -386,6 +386,10 @@ impl Focusable for ProjectDiff {
|
||||||
impl Item for ProjectDiff {
|
impl Item for ProjectDiff {
|
||||||
type Event = EditorEvent;
|
type Event = EditorEvent;
|
||||||
|
|
||||||
|
fn tab_icon(&self, _window: &Window, _cx: &App) -> Option<Icon> {
|
||||||
|
Some(Icon::new(IconName::GitBranch).color(Color::Muted))
|
||||||
|
}
|
||||||
|
|
||||||
fn to_item_events(event: &EditorEvent, f: impl FnMut(ItemEvent)) {
|
fn to_item_events(event: &EditorEvent, f: impl FnMut(ItemEvent)) {
|
||||||
Editor::to_item_events(event, f)
|
Editor::to_item_events(event, f)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue