From 943ea61452a6550bec95a23db5a006bff8b38ea2 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 8 Mar 2023 18:47:52 -0800 Subject: [PATCH] Add a note on how to check the telemetry --- crates/theme/src/theme.rs | 1 + crates/theme/src/ui.rs | 22 +++++++++++++++++----- crates/welcome/src/welcome.rs | 21 +++++++++++++++++++-- crates/zed/src/menus.rs | 2 +- styles/src/styleTree/welcome.ts | 9 +++++++++ 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 524b7656268a1b143b0857075e2e43eaea17a9bc..d331ca80a9fad31457fe648aaf7ae1b0e838d455 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -869,6 +869,7 @@ pub struct WelcomeStyle { pub page_width: f32, pub logo: IconStyle, pub logo_subheading: ContainedText, + pub usage_note: ContainedText, pub checkbox: CheckboxStyle, pub checkbox_container: ContainerStyle, pub button: Interactive, diff --git a/crates/theme/src/ui.rs b/crates/theme/src/ui.rs index 5396265ad8fc0f5db41616a5acfd973e21c3ff70..5441e711685970d3c33c9db94f9ac03815626531 100644 --- a/crates/theme/src/ui.rs +++ b/crates/theme/src/ui.rs @@ -4,7 +4,7 @@ use gpui::{ ConstrainedBox, Container, ContainerStyle, Empty, Flex, KeystrokeLabel, Label, MouseEventHandler, ParentElement, Svg, }, - Action, Element, EventContext, RenderContext, View, + Action, Element, ElementBox, EventContext, RenderContext, View, }; use serde::Deserialize; @@ -26,6 +26,21 @@ pub fn checkbox( checked: bool, cx: &mut RenderContext, change: fn(checked: bool, cx: &mut EventContext) -> (), +) -> MouseEventHandler { + let label = Label::new(label, style.label.text.clone()) + .contained() + .with_style(style.label.container) + .boxed(); + + checkbox_with_label(label, style, checked, cx, change) +} + +pub fn checkbox_with_label( + label: ElementBox, + style: &CheckboxStyle, + checked: bool, + cx: &mut RenderContext, + change: fn(checked: bool, cx: &mut EventContext) -> (), ) -> MouseEventHandler { MouseEventHandler::::new(0, cx, |state, _| { let indicator = if checked { @@ -55,10 +70,7 @@ pub fn checkbox( } }) .boxed(), - Label::new(label, style.label.text.clone()) - .contained() - .with_style(style.label.container) - .boxed(), + label, ]) .align_children_center() .boxed() diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rs index a1045ea1e8d9d20fe5ddd1ab35f4354f87cba509..3a35920b88922bb2b7bf13e5bd849acd77e4be3a 100644 --- a/crates/welcome/src/welcome.rs +++ b/crates/welcome/src/welcome.rs @@ -124,8 +124,25 @@ impl View for WelcomePage { .boxed(), Flex::column() .with_children([ - theme::ui::checkbox::( - "Send anonymous usage data to improve Zed (View what we're sending via Help > View Telemetry Log)", + theme::ui::checkbox_with_label::( + Flex::column() + .with_children([ + Label::new( + "Send anonymous usage data", + theme.welcome.checkbox.label.text.clone(), + ) + .contained() + .with_style(theme.welcome.checkbox.label.container) + .boxed(), + Label::new( + "Help > View Telemetry", + theme.welcome.usage_note.text.clone(), + ) + .contained() + .with_style(theme.welcome.usage_note.container) + .boxed(), + ]) + .boxed(), &theme.welcome.checkbox, metrics, cx, diff --git a/crates/zed/src/menus.rs b/crates/zed/src/menus.rs index 9381a909075b72364789e765600fd25885827f02..d5fb94b2b698aa8260fb9eab7bd5dee8c6af7b4c 100644 --- a/crates/zed/src/menus.rs +++ b/crates/zed/src/menus.rs @@ -137,7 +137,7 @@ pub fn menus() -> Vec> { items: vec![ MenuItem::action("Command Palette", command_palette::Toggle), MenuItem::separator(), - MenuItem::action("View Telemetry Log", crate::OpenTelemetryLog), + MenuItem::action("View Telemetry", crate::OpenTelemetryLog), MenuItem::action("View Dependency Licenses", crate::OpenLicenses), MenuItem::separator(), MenuItem::action( diff --git a/styles/src/styleTree/welcome.ts b/styles/src/styleTree/welcome.ts index 7c437f110ef49e67acea1dfe72fe102f26205a61..4ad3e51cd84545ef796b89d608996ad1aee0d872 100644 --- a/styles/src/styleTree/welcome.ts +++ b/styles/src/styleTree/welcome.ts @@ -86,10 +86,19 @@ export default function welcome(colorScheme: ColorScheme) { border: border(layer, "active"), }, }, + usageNote: { + ...text(layer, "sans", "variant", { size: "2xs" }), + margin: { + top: -4 + } + }, checkboxContainer: { margin: { top: 4, }, + padding: { + bottom: 8, + } }, checkbox: { label: {