initial commit - just the welcome screen and db connection, at present
This commit is contained in:
1 parent
d67871f491
commit
2bd81a66a4
10 files changed
+9377
No files matched your search
+48
@@ -0,0 +1,48 @@
|
||||
use gpui_kit::{
|
||||
AppContext, Context, Entity, IntoElement, ParentElement, Render, Styled, Window, WindowOptions,
|
||||
};
|
||||
use gpui_omarchy::{ActiveTheme, ButtonVariant, button, focus_scope, panel};
|
||||
|
||||
mod config;
|
||||
mod db;
|
||||
mod error;
|
||||
mod screens;
|
||||
mod session;
|
||||
|
||||
use session::AppSession;
|
||||
use screens::WelcomeScreen;
|
||||
|
||||
enum AppScreen {
|
||||
Welcome(Entity<WelcomeScreen>),
|
||||
}
|
||||
|
||||
struct CreddyApp {
|
||||
session: Entity<AppSession>,
|
||||
screen: AppScreen,
|
||||
}
|
||||
|
||||
impl Render for CreddyApp {
|
||||
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
||||
match &self.screen {
|
||||
AppScreen::Welcome(s) => s.clone().into_any_element(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Icons are read through the asset source, so register the bundle.
|
||||
gpui_kit::application()
|
||||
.with_assets(gpui_kit::assets::Assets)
|
||||
.run(|cx| {
|
||||
gpui_omarchy::init(cx);
|
||||
let session = cx.new(|_| AppSession::Empty);
|
||||
cx.open_window(WindowOptions::default(), |window, cx| {
|
||||
let screen = AppScreen::Welcome(
|
||||
cx.new(|cx| WelcomeScreen::new(session.clone(), window, cx)),
|
||||
);
|
||||
cx.new(|_| CreddyApp { session, screen })
|
||||
})
|
||||
.expect("open window");
|
||||
cx.activate(true);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user