diff --git a/Cargo.lock b/Cargo.lock index ef2f698d0a8e633e66502360cc9d2c38ed6c26bc..5ad448cc148d5d077c756515717853ffe2d09186 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10814,6 +10814,28 @@ dependencies = [ "workspace-hack", ] +[[package]] +name = "onboarding_ui" +version = "0.1.0" +dependencies = [ + "anyhow", + "client", + "command_palette_hooks", + "component", + "db", + "editor", + "feature_flags", + "gpui", + "settings", + "settings_ui", + "theme", + "ui", + "util", + "workspace", + "workspace-hack", + "zed_actions", +] + [[package]] name = "once_cell" version = "1.21.3" diff --git a/Cargo.toml b/Cargo.toml index 4239fcf1e9e52d63282ac879067da3bba47acf25..bf4b539850971f16e0eef44ee1979ce8db3a4d67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -102,6 +102,7 @@ members = [ "crates/node_runtime", "crates/notifications", "crates/ollama", + "crates/onboarding_ui", "crates/open_ai", "crates/open_router", "crates/outline", @@ -314,6 +315,7 @@ multi_buffer = { path = "crates/multi_buffer" } node_runtime = { path = "crates/node_runtime" } notifications = { path = "crates/notifications" } ollama = { path = "crates/ollama" } +onboarding_ui = { path = "crates/onboarding_ui" } open_ai = { path = "crates/open_ai" } open_router = { path = "crates/open_router", features = ["schemars"] } outline = { path = "crates/outline" } diff --git a/crates/onboarding_ui/Cargo.toml b/crates/onboarding_ui/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..cdfaad21f6745c2864448086b95670a579d3952b --- /dev/null +++ b/crates/onboarding_ui/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "onboarding_ui" +version = "0.1.0" +edition.workspace = true +publish.workspace = true +license = "GPL-3.0-or-later" + +[lints] +workspace = true + +[lib] +path = "src/onboarding_ui.rs" + +[features] +test-support = [] + +[dependencies] +anyhow.workspace = true +client.workspace = true +command_palette_hooks.workspace = true +component.workspace = true +db.workspace = true +feature_flags.workspace = true +gpui.workspace = true +settings.workspace = true +settings_ui.workspace = true +theme.workspace = true +ui.workspace = true +util.workspace = true +workspace-hack.workspace = true +workspace.workspace = true +zed_actions.workspace = true + +[dev-dependencies] +editor = { workspace = true, features = ["test-support"] } diff --git a/crates/onboarding_ui/src/onboarding_ui.rs b/crates/onboarding_ui/src/onboarding_ui.rs new file mode 100644 index 0000000000000000000000000000000000000000..6aae6d7093889fd565b75a17674073f77fb2a117 --- /dev/null +++ b/crates/onboarding_ui/src/onboarding_ui.rs @@ -0,0 +1,41 @@ +use command_palette_hooks::CommandPaletteFilter; +use feature_flags::FeatureFlagAppExt as _; +use gpui::App; +use settings_ui::SettingsUiFeatureFlag; +use workspace::Workspace; + +use gpui::actions; + +actions!(onboarding, [ShowOnboarding]); + +pub fn init(cx: &mut App) { + cx.observe_new(|workspace: &mut Workspace, _, _cx| { + workspace.register_action(|_workspace, _: &ShowOnboarding, _window, _cx| { + // Onboarding implementation will go here + }); + }) + .detach(); + + feature_gate_onboarding_ui_actions(cx); +} + +fn feature_gate_onboarding_ui_actions(cx: &mut App) { + const ONBOARDING_ACTION_NAMESPACE: &str = "onboarding"; + + CommandPaletteFilter::update_global(cx, |filter, _cx| { + filter.hide_namespace(ONBOARDING_ACTION_NAMESPACE); + }); + + cx.observe_flag::({ + move |is_enabled, cx| { + CommandPaletteFilter::update_global(cx, |filter, _cx| { + if is_enabled { + filter.show_namespace(ONBOARDING_ACTION_NAMESPACE); + } else { + filter.hide_namespace(ONBOARDING_ACTION_NAMESPACE); + } + }); + } + }) + .detach(); +}