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

@ -1,10 +1,14 @@
use std::any::Any;
use ::settings::Settings;
use command_palette_hooks::CommandPaletteFilter;
use git::{
repository::{Branch, Upstream, UpstreamTracking, UpstreamTrackingStatus},
status::{FileStatus, StatusCode, UnmergedStatus, UnmergedStatusCode},
};
use git_panel_settings::GitPanelSettings;
use gpui::{App, Entity, FocusHandle};
use gpui::{actions, App, Entity, FocusHandle};
use onboarding::{clear_dismissed, GitOnboardingModal};
use project::Project;
use project_diff::ProjectDiff;
use ui::prelude::*;
@ -15,11 +19,14 @@ pub mod branch_picker;
mod commit_modal;
pub mod git_panel;
mod git_panel_settings;
pub mod onboarding;
pub mod picker_prompt;
pub mod project_diff;
pub(crate) mod remote_output;
pub mod repository_selector;
actions!(git, [ResetOnboarding]);
pub fn init(cx: &mut App) {
GitPanelSettings::register(cx);
branch_picker::init(cx);
@ -82,6 +89,21 @@ pub fn init(cx: &mut App) {
panel.unstage_all(action, window, cx);
});
});
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.hide_action_types(&[
zed_actions::OpenGitIntegrationOnboarding.type_id(),
// ResetOnboarding.type_id(),
]);
});
workspace.register_action(
move |workspace, _: &zed_actions::OpenGitIntegrationOnboarding, window, cx| {
GitOnboardingModal::toggle(workspace, window, cx)
},
);
workspace.register_action(move |_, _: &ResetOnboarding, window, cx| {
clear_dismissed(cx);
window.refresh();
});
workspace.register_action(|workspace, _action: &git::Init, window, cx| {
let Some(panel) = workspace.panel::<git_panel::GitPanel>(cx) else {
return;