onboarding: Add more telemetry (#36121)
1. Welcome Page Open 2. Welcome Nav clicked 3. Skip clicked 4. Font changed 5. Import settings clicked 6. Inlay Hints 7. Git Blame 8. Format on Save 9. Font Ligature 10. Ai Enabled 11. Ai Provider Modal open Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
parent
6c1f19571a
commit
a7442d8880
5 changed files with 111 additions and 19 deletions
|
@ -214,6 +214,7 @@ pub fn init(cx: &mut App) {
|
|||
}
|
||||
|
||||
pub fn show_onboarding_view(app_state: Arc<AppState>, cx: &mut App) -> Task<anyhow::Result<()>> {
|
||||
telemetry::event!("Onboarding Page Opened");
|
||||
open_new(
|
||||
Default::default(),
|
||||
app_state,
|
||||
|
@ -242,6 +243,16 @@ enum SelectedPage {
|
|||
AiSetup,
|
||||
}
|
||||
|
||||
impl SelectedPage {
|
||||
fn name(&self) -> &'static str {
|
||||
match self {
|
||||
SelectedPage::Basics => "Basics",
|
||||
SelectedPage::Editing => "Editing",
|
||||
SelectedPage::AiSetup => "AI Setup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Onboarding {
|
||||
workspace: WeakEntity<Workspace>,
|
||||
focus_handle: FocusHandle,
|
||||
|
@ -261,7 +272,21 @@ impl Onboarding {
|
|||
})
|
||||
}
|
||||
|
||||
fn set_page(&mut self, page: SelectedPage, cx: &mut Context<Self>) {
|
||||
fn set_page(
|
||||
&mut self,
|
||||
page: SelectedPage,
|
||||
clicked: Option<&'static str>,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
if let Some(click) = clicked {
|
||||
telemetry::event!(
|
||||
"Welcome Tab Clicked",
|
||||
from = self.selected_page.name(),
|
||||
to = page.name(),
|
||||
clicked = click,
|
||||
);
|
||||
}
|
||||
|
||||
self.selected_page = page;
|
||||
cx.notify();
|
||||
cx.emit(ItemEvent::UpdateTab);
|
||||
|
@ -325,8 +350,13 @@ impl Onboarding {
|
|||
gpui::Empty.into_any_element(),
|
||||
IntoElement::into_any_element,
|
||||
))
|
||||
.on_click(cx.listener(move |this, _, _, cx| {
|
||||
this.set_page(page, cx);
|
||||
.on_click(cx.listener(move |this, click_event, _, cx| {
|
||||
let click = match click_event {
|
||||
gpui::ClickEvent::Mouse(_) => "mouse",
|
||||
gpui::ClickEvent::Keyboard(_) => "keyboard",
|
||||
};
|
||||
|
||||
this.set_page(page, Some(click), cx);
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
@ -475,6 +505,7 @@ impl Onboarding {
|
|||
}
|
||||
|
||||
fn on_finish(_: &Finish, _: &mut Window, cx: &mut App) {
|
||||
telemetry::event!("Welcome Skip Clicked");
|
||||
go_to_welcome_page(cx);
|
||||
}
|
||||
|
||||
|
@ -532,13 +563,13 @@ impl Render for Onboarding {
|
|||
.on_action(Self::handle_sign_in)
|
||||
.on_action(Self::handle_open_account)
|
||||
.on_action(cx.listener(|this, _: &ActivateBasicsPage, _, cx| {
|
||||
this.set_page(SelectedPage::Basics, cx);
|
||||
this.set_page(SelectedPage::Basics, Some("action"), cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ActivateEditingPage, _, cx| {
|
||||
this.set_page(SelectedPage::Editing, cx);
|
||||
this.set_page(SelectedPage::Editing, Some("action"), cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ActivateAISetupPage, _, cx| {
|
||||
this.set_page(SelectedPage::AiSetup, cx);
|
||||
this.set_page(SelectedPage::AiSetup, Some("action"), cx);
|
||||
}))
|
||||
.on_action(cx.listener(|_, _: &menu::SelectNext, window, cx| {
|
||||
window.focus_next();
|
||||
|
@ -806,7 +837,7 @@ impl workspace::SerializableItem for Onboarding {
|
|||
if let Some(page) = page {
|
||||
zlog::info!("Onboarding page {page:?} loaded");
|
||||
onboarding_page.update(cx, |onboarding_page, cx| {
|
||||
onboarding_page.set_page(page, cx);
|
||||
onboarding_page.set_page(page, None, cx);
|
||||
})
|
||||
}
|
||||
onboarding_page
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue