Don't render "Initialize Repository" button when no worktrees (#26713)
Closes #26676 Release Notes: - Fixed the git panel to not show an "Initialize Repositories" button in empty projects
This commit is contained in:
parent
f3703fa8be
commit
a7f3b22051
1 changed files with 18 additions and 15 deletions
|
@ -3048,21 +3048,24 @@ impl GitPanel {
|
||||||
"No Git repositories"
|
"No Git repositories"
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
.children(self.active_repository.is_none().then(|| {
|
.children({
|
||||||
h_flex().w_full().justify_around().child(
|
let worktree_count = self.project.read(cx).visible_worktrees(cx).count();
|
||||||
panel_filled_button("Initialize Repository")
|
(worktree_count > 0 && self.active_repository.is_none()).then(|| {
|
||||||
.tooltip(Tooltip::for_action_title_in(
|
h_flex().w_full().justify_around().child(
|
||||||
"git init",
|
panel_filled_button("Initialize Repository")
|
||||||
&git::Init,
|
.tooltip(Tooltip::for_action_title_in(
|
||||||
&self.focus_handle,
|
"git init",
|
||||||
))
|
&git::Init,
|
||||||
.on_click(move |_, _, cx| {
|
&self.focus_handle,
|
||||||
cx.defer(move |cx| {
|
))
|
||||||
cx.dispatch_action(&git::Init);
|
.on_click(move |_, _, cx| {
|
||||||
})
|
cx.defer(move |cx| {
|
||||||
}),
|
cx.dispatch_action(&git::Init);
|
||||||
)
|
})
|
||||||
}))
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
.text_ui_sm(cx)
|
.text_ui_sm(cx)
|
||||||
.mx_auto()
|
.mx_auto()
|
||||||
.text_color(Color::Placeholder.color(cx)),
|
.text_color(Color::Placeholder.color(cx)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue