feat: dashboard skeleton
This commit is contained in:
24
src/main.rs
24
src/main.rs
@@ -1,25 +1,23 @@
|
||||
use gpui::{bounds, point, prelude::*, px, size};
|
||||
|
||||
use crate::screen::setup_wizard;
|
||||
use crate::{query::fetch_query, screen::dashboard, screen::setup_wizard};
|
||||
|
||||
mod api;
|
||||
mod app;
|
||||
mod asset;
|
||||
mod colors;
|
||||
mod component;
|
||||
mod dashboard;
|
||||
mod http;
|
||||
mod query;
|
||||
mod screen;
|
||||
mod storage;
|
||||
mod theme;
|
||||
mod titlebar;
|
||||
mod util;
|
||||
|
||||
enum Start {
|
||||
FromScratch,
|
||||
FromSetup(setup_wizard::StoredSetupState),
|
||||
FromSaved,
|
||||
FromSaved(storage::PersistedState),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@@ -76,19 +74,25 @@ fn setup_application(cx: &mut gpui::App) {
|
||||
_ = setup_wizard::open_window(screen, cx);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
Start::FromSaved(_) => {
|
||||
let screen = dashboard::new(cx);
|
||||
_ = dashboard::open_window(screen, cx);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn resume_application_state(cx: &mut gpui::App) -> Start {
|
||||
let state = storage::load_persisted_state();
|
||||
let Some(state) = state else {
|
||||
let Some(mut state) = state else {
|
||||
return Start::FromScratch;
|
||||
};
|
||||
|
||||
let auth_tokens = cx
|
||||
.background_executor()
|
||||
.block(storage::load_auth_tokens(cx, state.selected_account));
|
||||
let auth_tokens = if cfg!(debug_assertions) {
|
||||
state.debug_auth_tokens.take()
|
||||
} else {
|
||||
cx.background_executor()
|
||||
.block(storage::load_auth_tokens(cx, state.selected_account))
|
||||
};
|
||||
let Some(auth_tokens) = auth_tokens else {
|
||||
return Start::FromScratch;
|
||||
};
|
||||
@@ -106,6 +110,6 @@ fn resume_application_state(cx: &mut gpui::App) -> Start {
|
||||
match setup_status {
|
||||
setup_wizard::SetupStatus::NotStarted => Start::FromScratch,
|
||||
setup_wizard::SetupStatus::InProgress(state) => Start::FromSetup(state),
|
||||
setup_wizard::SetupStatus::Completed => Start::FromSaved,
|
||||
setup_wizard::SetupStatus::Completed => Start::FromSaved(state),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user