Add a note on how to check the telemetry
This commit is contained in:
parent
a65dd0fd98
commit
943ea61452
5 changed files with 47 additions and 8 deletions
|
@ -869,6 +869,7 @@ pub struct WelcomeStyle {
|
||||||
pub page_width: f32,
|
pub page_width: f32,
|
||||||
pub logo: IconStyle,
|
pub logo: IconStyle,
|
||||||
pub logo_subheading: ContainedText,
|
pub logo_subheading: ContainedText,
|
||||||
|
pub usage_note: ContainedText,
|
||||||
pub checkbox: CheckboxStyle,
|
pub checkbox: CheckboxStyle,
|
||||||
pub checkbox_container: ContainerStyle,
|
pub checkbox_container: ContainerStyle,
|
||||||
pub button: Interactive<ContainedText>,
|
pub button: Interactive<ContainedText>,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use gpui::{
|
||||||
ConstrainedBox, Container, ContainerStyle, Empty, Flex, KeystrokeLabel, Label,
|
ConstrainedBox, Container, ContainerStyle, Empty, Flex, KeystrokeLabel, Label,
|
||||||
MouseEventHandler, ParentElement, Svg,
|
MouseEventHandler, ParentElement, Svg,
|
||||||
},
|
},
|
||||||
Action, Element, EventContext, RenderContext, View,
|
Action, Element, ElementBox, EventContext, RenderContext, View,
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
@ -26,6 +26,21 @@ pub fn checkbox<T: 'static, V: View>(
|
||||||
checked: bool,
|
checked: bool,
|
||||||
cx: &mut RenderContext<V>,
|
cx: &mut RenderContext<V>,
|
||||||
change: fn(checked: bool, cx: &mut EventContext) -> (),
|
change: fn(checked: bool, cx: &mut EventContext) -> (),
|
||||||
|
) -> MouseEventHandler<T> {
|
||||||
|
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<T: 'static, V: View>(
|
||||||
|
label: ElementBox,
|
||||||
|
style: &CheckboxStyle,
|
||||||
|
checked: bool,
|
||||||
|
cx: &mut RenderContext<V>,
|
||||||
|
change: fn(checked: bool, cx: &mut EventContext) -> (),
|
||||||
) -> MouseEventHandler<T> {
|
) -> MouseEventHandler<T> {
|
||||||
MouseEventHandler::<T>::new(0, cx, |state, _| {
|
MouseEventHandler::<T>::new(0, cx, |state, _| {
|
||||||
let indicator = if checked {
|
let indicator = if checked {
|
||||||
|
@ -55,10 +70,7 @@ pub fn checkbox<T: 'static, V: View>(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.boxed(),
|
.boxed(),
|
||||||
Label::new(label, style.label.text.clone())
|
label,
|
||||||
.contained()
|
|
||||||
.with_style(style.label.container)
|
|
||||||
.boxed(),
|
|
||||||
])
|
])
|
||||||
.align_children_center()
|
.align_children_center()
|
||||||
.boxed()
|
.boxed()
|
||||||
|
|
|
@ -124,8 +124,25 @@ impl View for WelcomePage {
|
||||||
.boxed(),
|
.boxed(),
|
||||||
Flex::column()
|
Flex::column()
|
||||||
.with_children([
|
.with_children([
|
||||||
theme::ui::checkbox::<Metrics, Self>(
|
theme::ui::checkbox_with_label::<Metrics, Self>(
|
||||||
"Send anonymous usage data to improve Zed (View what we're sending via Help > View Telemetry Log)",
|
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,
|
&theme.welcome.checkbox,
|
||||||
metrics,
|
metrics,
|
||||||
cx,
|
cx,
|
||||||
|
|
|
@ -137,7 +137,7 @@ pub fn menus() -> Vec<Menu<'static>> {
|
||||||
items: vec![
|
items: vec![
|
||||||
MenuItem::action("Command Palette", command_palette::Toggle),
|
MenuItem::action("Command Palette", command_palette::Toggle),
|
||||||
MenuItem::separator(),
|
MenuItem::separator(),
|
||||||
MenuItem::action("View Telemetry Log", crate::OpenTelemetryLog),
|
MenuItem::action("View Telemetry", crate::OpenTelemetryLog),
|
||||||
MenuItem::action("View Dependency Licenses", crate::OpenLicenses),
|
MenuItem::action("View Dependency Licenses", crate::OpenLicenses),
|
||||||
MenuItem::separator(),
|
MenuItem::separator(),
|
||||||
MenuItem::action(
|
MenuItem::action(
|
||||||
|
|
|
@ -86,10 +86,19 @@ export default function welcome(colorScheme: ColorScheme) {
|
||||||
border: border(layer, "active"),
|
border: border(layer, "active"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
usageNote: {
|
||||||
|
...text(layer, "sans", "variant", { size: "2xs" }),
|
||||||
|
margin: {
|
||||||
|
top: -4
|
||||||
|
}
|
||||||
|
},
|
||||||
checkboxContainer: {
|
checkboxContainer: {
|
||||||
margin: {
|
margin: {
|
||||||
top: 4,
|
top: 4,
|
||||||
},
|
},
|
||||||
|
padding: {
|
||||||
|
bottom: 8,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
checkbox: {
|
checkbox: {
|
||||||
label: {
|
label: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue