63 lines
1.8 KiB
Rust
63 lines
1.8 KiB
Rust
use gpui::{ParentElement, Styled, div, prelude::FluentBuilder};
|
|
|
|
use crate::component::{button::button, text::text};
|
|
|
|
#[derive(gpui::IntoElement)]
|
|
pub(crate) struct WelcomeStep {
|
|
on_next: Option<Box<dyn Fn(&(), &mut gpui::Window, &mut gpui::App) + 'static>>,
|
|
}
|
|
|
|
pub(crate) fn welcome_step() -> WelcomeStep {
|
|
WelcomeStep { on_next: None }
|
|
}
|
|
|
|
impl WelcomeStep {
|
|
pub fn on_next(mut self, f: impl Fn(&(), &mut gpui::Window, &mut gpui::App) + 'static) -> Self {
|
|
self.on_next = Some(Box::new(f));
|
|
self
|
|
}
|
|
}
|
|
|
|
impl gpui::RenderOnce for WelcomeStep {
|
|
fn render(self, _window: &mut gpui::Window, _cx: &mut gpui::App) -> impl gpui::IntoElement {
|
|
let next_button = button("next")
|
|
.label("Next")
|
|
.when(self.on_next.is_some(), |b| {
|
|
b.on_click(move |_, window, cx| self.on_next.as_ref().unwrap()(&(), window, cx))
|
|
});
|
|
|
|
div()
|
|
.flex()
|
|
.flex_col()
|
|
.size_full()
|
|
.items_start()
|
|
.justify_center()
|
|
.child(
|
|
div()
|
|
.flex()
|
|
.flex_col()
|
|
.flex_1()
|
|
.justify_center()
|
|
.w_full()
|
|
.p_8()
|
|
.child(
|
|
text(
|
|
"Welcome to Novem!\nThis wizard will guide you through setting up Novem.\n",
|
|
)
|
|
.opacity(0.8),
|
|
)
|
|
.child(text("Press 'Next' to begin setup.").medium()),
|
|
)
|
|
.child(
|
|
div()
|
|
.flex()
|
|
.flex_row()
|
|
.justify_end()
|
|
.w_full()
|
|
.p_4()
|
|
.pt_0()
|
|
.child(next_button),
|
|
)
|
|
}
|
|
}
|