mod github_step; mod screen; mod setup_complete_step; mod storage; mod welcome_step; use gpui::{AppContext, BorrowAppContext, point, px, size}; pub(crate) use screen::{from_saved, new}; use serde::{Deserialize, Serialize}; 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 { Welcome, ConnectToGithub, SetupComplete, } const ALL_SETUP_STEPS: [Step; 3] = [Step::Welcome, Step::ConnectToGithub, Step::SetupComplete]; 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::(|global, cx| { ( global.safe_area.origin, gpui::Bounds::centered(None, size(px(800.), px(600.0)), cx), ) }); app::open_window( cx, 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() }, |_window, _cx| screen, ) } impl Step { pub const fn order(&self) -> usize { match self { Step::Welcome => 0, Step::ConnectToGithub => 1, Step::SetupComplete => 2, } } }