feat: impl dashboard & issue list

This commit is contained in:
2026-05-06 01:42:38 +08:00
parent bef3a0b9ed
commit 7de0039d38
36 changed files with 2381 additions and 107 deletions

View File

@@ -1,6 +1,6 @@
use gpui::{bounds, point, prelude::*, px, size};
use crate::{query::fetch_query, screen::dashboard, screen::setup_wizard};
use crate::screen::{dashboard, setup_wizard};
mod api;
mod app;
@@ -38,6 +38,7 @@ fn main() {
}
fn setup_application(cx: &mut gpui::App) {
let use_github_fixtures = api::use_github_fixtures();
let query_store = query::Store::new(api::QueryContext {
http: reqwest::Client::new(),
auth: None,
@@ -45,6 +46,9 @@ fn setup_application(cx: &mut gpui::App) {
base_url: "https://api.github.com",
client_id: "Iv23liZD4bMQpGJICsR7",
},
#[cfg(debug_assertions)]
should_use_fixtures: false,
});
let theme_family = theme::ThemeFamily::default();
@@ -61,6 +65,11 @@ fn setup_application(cx: &mut gpui::App) {
// TODO: handle failure
_ = storage::ensure_data_dir();
if use_github_fixtures {
_ = dashboard::open_window(cx);
return;
}
let start = resume_application_state(cx);
match start {
@@ -75,8 +84,7 @@ fn setup_application(cx: &mut gpui::App) {
}
Start::FromSaved(_) => {
let screen = dashboard::new(cx);
_ = dashboard::open_window(screen, cx);
_ = dashboard::open_window(cx);
}
};
}
@@ -87,12 +95,14 @@ fn resume_application_state(cx: &mut gpui::App) -> Start {
return Start::FromScratch;
};
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))
};
#[cfg(debug_assertions)]
let auth_tokens = state.debug_auth_tokens.take();
#[cfg(not(debug_assertions))]
let auth_tokens = cx
.background_executor()
.block(storage::load_auth_tokens(cx, state.selected_account));
let Some(auth_tokens) = auth_tokens else {
return Start::FromScratch;
};
@@ -100,6 +110,11 @@ fn resume_application_state(cx: &mut gpui::App) -> Start {
_ = cx.update_global::<query::Store<api::QueryContext>, _>(|store, _| {
store.update_query_context(|cx| {
cx.auth = Some(auth_tokens);
#[cfg(debug_assertions)]
{
cx.should_use_fixtures = state.debug_should_use_fixtures.unwrap_or(false);
}
});
});