use asset::Assets; use client::NostrClient; use components::theme::{Theme, ThemeColor, ThemeMode}; use gpui::*; use state::AppState; use std::sync::Arc; use views::app::AppView; pub mod asset; pub mod state; pub mod utils; pub mod views; actions!(main_menu, [Quit]); #[tokio::main] async fn main() { tracing_subscriber::fmt::init(); // Initialize nostr client let nostr = NostrClient::init().await; // Initialize app state let app_state = AppState::new(); App::new() .with_assets(Assets) .with_http_client(Arc::new(reqwest_client::ReqwestClient::new())) .run(move |cx| { // Initialize components components::init(cx); // Set custom theme let mut theme = Theme::from(ThemeColor::dark()); // Set dark mode by default theme.mode = ThemeMode::Dark; // Set app state cx.set_global(theme); cx.set_global(nostr); cx.set_global(app_state); // Set quit action cx.on_action(quit); // Refresh cx.refresh(); // Set window size let bounds = Bounds::centered(None, size(px(860.0), px(650.0)), cx); cx.open_window( WindowOptions { window_bounds: Some(WindowBounds::Windowed(bounds)), window_decorations: Some(WindowDecorations::Client), titlebar: Some(TitlebarOptions { title: Some(SharedString::new_static("coop")), appears_transparent: true, ..Default::default() }), ..Default::default() }, |cx| cx.new_view(AppView::new), ) .unwrap(); }); } fn quit(_: &Quit, cx: &mut AppContext) { cx.quit(); }