mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 02:48:34 +00:00
Added background to welcome page
This commit is contained in:
parent
5210be95fe
commit
62aeb6b8b3
1 changed files with 68 additions and 47 deletions
|
@ -1,6 +1,7 @@
|
||||||
use gpui::{
|
use gpui::{
|
||||||
color::Color,
|
color::Color,
|
||||||
elements::{Empty, Flex, Label, MouseEventHandler, ParentElement, Svg},
|
elements::{Canvas, Empty, Flex, Label, MouseEventHandler, ParentElement, Stack, Svg},
|
||||||
|
geometry::rect::RectF,
|
||||||
Element, ElementBox, Entity, MutableAppContext, RenderContext, Subscription, View, ViewContext,
|
Element, ElementBox, Entity, MutableAppContext, RenderContext, Subscription, View, ViewContext,
|
||||||
};
|
};
|
||||||
use settings::{settings_file::SettingsFile, Settings, SettingsFileContent};
|
use settings::{settings_file::SettingsFile, Settings, SettingsFileContent};
|
||||||
|
@ -39,60 +40,80 @@ impl View for WelcomePage {
|
||||||
enum Metrics {}
|
enum Metrics {}
|
||||||
enum Diagnostics {}
|
enum Diagnostics {}
|
||||||
|
|
||||||
Flex::column()
|
let background = theme.editor.background;
|
||||||
.with_children([
|
|
||||||
Flex::row()
|
Stack::new()
|
||||||
.with_children([
|
.with_child(
|
||||||
Svg::new("icons/terminal_16.svg")
|
Canvas::new(move |bounds, visible_bounds, cx| {
|
||||||
.with_color(Color::red())
|
let visible_bounds = bounds.intersection(visible_bounds).unwrap_or_default();
|
||||||
.constrained()
|
|
||||||
.with_width(100.)
|
cx.paint_layer(Some(visible_bounds), |cx| {
|
||||||
.with_height(100.)
|
cx.scene.push_quad(gpui::Quad {
|
||||||
.aligned()
|
bounds: RectF::new(bounds.origin(), bounds.size()),
|
||||||
.contained()
|
background: Some(background),
|
||||||
.boxed(),
|
..Default::default()
|
||||||
Label::new("Zed", theme.editor.hover_popover.prose.clone()).boxed(),
|
})
|
||||||
])
|
})
|
||||||
.boxed(),
|
})
|
||||||
Label::new(
|
|
||||||
"Code at the speed of thought",
|
|
||||||
theme.editor.hover_popover.prose.clone(),
|
|
||||||
)
|
|
||||||
.boxed(),
|
.boxed(),
|
||||||
Flex::row()
|
)
|
||||||
|
.with_child(
|
||||||
|
Flex::column()
|
||||||
.with_children([
|
.with_children([
|
||||||
self.render_settings_checkbox::<Metrics>(
|
Flex::row()
|
||||||
&theme.welcome.checkbox,
|
.with_children([
|
||||||
metrics,
|
Svg::new("icons/terminal_16.svg")
|
||||||
cx,
|
.with_color(Color::red())
|
||||||
|content, checked| {
|
.constrained()
|
||||||
content.telemetry.set_metrics(checked);
|
.with_width(100.)
|
||||||
},
|
.with_height(100.)
|
||||||
),
|
.aligned()
|
||||||
|
.contained()
|
||||||
|
.boxed(),
|
||||||
|
Label::new("Zed", theme.editor.hover_popover.prose.clone()).boxed(),
|
||||||
|
])
|
||||||
|
.boxed(),
|
||||||
Label::new(
|
Label::new(
|
||||||
"Do you want to send telemetry?",
|
"Code at the speed of thought",
|
||||||
theme.editor.hover_popover.prose.clone(),
|
theme.editor.hover_popover.prose.clone(),
|
||||||
)
|
)
|
||||||
.boxed(),
|
.boxed(),
|
||||||
|
Flex::row()
|
||||||
|
.with_children([
|
||||||
|
self.render_settings_checkbox::<Metrics>(
|
||||||
|
&theme.welcome.checkbox,
|
||||||
|
metrics,
|
||||||
|
cx,
|
||||||
|
|content, checked| {
|
||||||
|
content.telemetry.set_metrics(checked);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Label::new(
|
||||||
|
"Do you want to send telemetry?",
|
||||||
|
theme.editor.hover_popover.prose.clone(),
|
||||||
|
)
|
||||||
|
.boxed(),
|
||||||
|
])
|
||||||
|
.boxed(),
|
||||||
|
Flex::row()
|
||||||
|
.with_children([
|
||||||
|
self.render_settings_checkbox::<Diagnostics>(
|
||||||
|
&theme.welcome.checkbox,
|
||||||
|
diagnostics,
|
||||||
|
cx,
|
||||||
|
|content, checked| content.telemetry.set_diagnostics(checked),
|
||||||
|
),
|
||||||
|
Label::new(
|
||||||
|
"Send crash reports",
|
||||||
|
theme.editor.hover_popover.prose.clone(),
|
||||||
|
)
|
||||||
|
.boxed(),
|
||||||
|
])
|
||||||
|
.boxed(),
|
||||||
])
|
])
|
||||||
|
.aligned()
|
||||||
.boxed(),
|
.boxed(),
|
||||||
Flex::row()
|
)
|
||||||
.with_children([
|
|
||||||
self.render_settings_checkbox::<Diagnostics>(
|
|
||||||
&theme.welcome.checkbox,
|
|
||||||
diagnostics,
|
|
||||||
cx,
|
|
||||||
|content, checked| content.telemetry.set_diagnostics(checked),
|
|
||||||
),
|
|
||||||
Label::new(
|
|
||||||
"Send crash reports",
|
|
||||||
theme.editor.hover_popover.prose.clone(),
|
|
||||||
)
|
|
||||||
.boxed(),
|
|
||||||
])
|
|
||||||
.boxed(),
|
|
||||||
])
|
|
||||||
.aligned()
|
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue