git: Add an onboarding and banner flow (#26518)

TODO:

- [ ] Hide the reset onboarding action (only useful for development,
uncomment:
https://github.com/zed-industries/zed/pull/26518/files#diff-f0ce01d9a3df30f60c64b6f9906c54aa0191246a58dbf5297ee321575a180879R96)
- [x] Get a designer to replace the modal background (@danilo-leal)

Release Notes:

- Added a small onboarding banner for the git launch

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
This commit is contained in:
Mikayla Maki 2025-03-12 09:17:47 -07:00 committed by GitHub
parent 5f74297576
commit 45b126a977
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 352 additions and 10 deletions

View file

@ -702,7 +702,10 @@ impl GitPanel {
let mut dispatch_context = KeyContext::new_with_defaults();
dispatch_context.add("GitPanel");
if self.is_focused(window, cx) {
if window
.focused(cx)
.map_or(false, |focused| self.focus_handle == focused)
{
dispatch_context.add("menu");
dispatch_context.add("ChangesList");
}
@ -714,12 +717,6 @@ impl GitPanel {
dispatch_context
}
fn is_focused(&self, window: &Window, cx: &Context<Self>) -> bool {
window
.focused(cx)
.map_or(false, |focused| self.focus_handle == focused)
}
fn close_panel(&mut self, _: &Close, _window: &mut Window, cx: &mut Context<Self>) {
cx.emit(PanelEvent::Close);
}
@ -3811,8 +3808,12 @@ impl Render for GitPanel {
}
impl Focusable for GitPanel {
fn focus_handle(&self, _: &App) -> gpui::FocusHandle {
self.focus_handle.clone()
fn focus_handle(&self, cx: &App) -> gpui::FocusHandle {
if self.entries.is_empty() {
self.commit_editor.focus_handle(cx)
} else {
self.focus_handle.clone()
}
}
}