Files
novem/src/screen/setup_wizard/mod.rs

60 lines
1.6 KiB
Rust
Raw Normal View History

2026-04-22 22:12:39 +01:00
mod github_step;
mod screen;
2026-04-26 00:58:38 +01:00
mod setup_complete_step;
2026-04-25 00:49:50 +01:00
mod storage;
2026-04-22 22:12:39 +01:00
mod welcome_step;
2026-04-26 00:01:57 +01:00
use gpui::{AppContext, BorrowAppContext, point, px, size};
pub(crate) use screen::{from_saved, new};
2026-04-25 00:49:50 +01:00
use serde::{Deserialize, Serialize};
2026-04-26 00:01:57 +01:00
pub(crate) use crate::screen::setup_wizard::storage::{SetupStatus, StoredSetupState};
use crate::{app, screen::setup_wizard::screen::Screen};
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub(crate) enum Step {
2026-04-25 00:49:50 +01:00
Welcome,
ConnectToGithub,
2026-04-26 00:58:38 +01:00
SetupComplete,
2026-04-25 00:49:50 +01:00
}
2026-04-26 00:58:38 +01:00
const ALL_SETUP_STEPS: [Step; 3] = [Step::Welcome, Step::ConnectToGithub, Step::SetupComplete];
2026-04-26 00:01:57 +01:00
pub fn read_setup_status() -> SetupStatus {
storage::read_setup_state()
}
pub fn open_window(screen: Screen, cx: &mut gpui::App) -> anyhow::Result<()> {
let (top_left, window_bounds) = cx.read_global::<app::Global, _>(|global, cx| {
(
global.safe_area.origin,
gpui::Bounds::centered(None, size(px(800.), px(600.0)), cx),
)
});
2026-05-06 01:42:38 +08:00
app::open_window(
cx,
2026-04-26 00:01:57 +01:00
gpui::WindowOptions {
window_bounds: Some(gpui::WindowBounds::Windowed(window_bounds)),
titlebar: Some(gpui::TitlebarOptions {
appears_transparent: true,
traffic_light_position: Some(top_left + point(px(12.), px(12.))),
..Default::default()
}),
is_resizable: false,
..Default::default()
},
2026-05-06 01:42:38 +08:00
|_window, _cx| screen,
2026-04-26 00:01:57 +01:00
)
}
impl Step {
pub const fn order(&self) -> usize {
match self {
Step::Welcome => 0,
Step::ConnectToGithub => 1,
2026-04-26 00:58:38 +01:00
Step::SetupComplete => 2,
2026-04-26 00:01:57 +01:00
}
}
}