onboarding: Continue work on new flow (#35233)

This PR continues the work on the new and revamped onboarding flow.


Release Notes:

- N/A
This commit is contained in:
Finn Evers 2025-07-28 23:10:28 +02:00 committed by GitHub
parent 8207621a4a
commit 7ccf8c2f8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 314 additions and 2 deletions

View file

@ -1,3 +1,4 @@
use crate::welcome::{ShowWelcome, WelcomePage};
use command_palette_hooks::CommandPaletteFilter;
use db::kvp::KEY_VALUE_STORE;
use feature_flags::{FeatureFlag, FeatureFlagViewExt as _};
@ -20,6 +21,8 @@ use workspace::{
open_new, with_active_or_new_workspace,
};
mod welcome;
pub struct OnBoardingFeatureFlag {}
impl FeatureFlag for OnBoardingFeatureFlag {
@ -63,12 +66,43 @@ pub fn init(cx: &mut App) {
.detach();
});
});
cx.on_action(|_: &ShowWelcome, cx| {
with_active_or_new_workspace(cx, |workspace, window, cx| {
workspace
.with_local_workspace(window, cx, |workspace, window, cx| {
let existing = workspace
.active_pane()
.read(cx)
.items()
.find_map(|item| item.downcast::<WelcomePage>());
if let Some(existing) = existing {
workspace.activate_item(&existing, true, true, window, cx);
} else {
let settings_page = WelcomePage::new(cx);
workspace.add_item_to_active_pane(
Box::new(settings_page),
None,
true,
window,
cx,
)
}
})
.detach();
});
});
cx.observe_new::<Workspace>(|_, window, cx| {
let Some(window) = window else {
return;
};
let onboarding_actions = [std::any::TypeId::of::<OpenOnboarding>()];
let onboarding_actions = [
std::any::TypeId::of::<OpenOnboarding>(),
std::any::TypeId::of::<ShowWelcome>(),
];
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.hide_action_types(&onboarding_actions);