feat: dashboard skeleton
This commit is contained in:
45
src/app.rs
45
src/app.rs
@@ -1,10 +1,6 @@
|
||||
use gpui::{div, prelude::*};
|
||||
|
||||
use crate::dashboard;
|
||||
use crate::api;
|
||||
use crate::query;
|
||||
use crate::theme;
|
||||
use crate::titlebar;
|
||||
use crate::{api, app};
|
||||
|
||||
pub struct Global {
|
||||
pub safe_area: gpui::Bounds<gpui::Pixels>,
|
||||
@@ -13,45 +9,6 @@ pub struct Global {
|
||||
pub rng: rand::prelude::ThreadRng,
|
||||
}
|
||||
|
||||
pub struct Chrome {}
|
||||
|
||||
impl Chrome {
|
||||
pub fn new(window: &mut gpui::Window, cx: &mut gpui::Context<Self>) -> Self {
|
||||
cx.observe_window_appearance(window, |_, window, cx| {
|
||||
cx.update_global::<app::Global, ()>(|global, cx| {
|
||||
global.current_theme = global
|
||||
.theme_family
|
||||
.theme_for_appearance(window.appearance());
|
||||
cx.notify();
|
||||
});
|
||||
})
|
||||
.detach();
|
||||
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl gpui::Render for Chrome {
|
||||
fn render(
|
||||
&mut self,
|
||||
_window: &mut gpui::Window,
|
||||
cx: &mut gpui::Context<Self>,
|
||||
) -> impl gpui::IntoElement {
|
||||
let title_bar = cx.new(|cx| titlebar::TitleBar::new(cx));
|
||||
|
||||
let dashboard = cx.new(|_| dashboard::Screen {
|
||||
text: "World".into(),
|
||||
});
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.child(title_bar)
|
||||
.child(dashboard)
|
||||
}
|
||||
}
|
||||
|
||||
impl gpui::Global for Global {}
|
||||
|
||||
pub fn current_theme(cx: &gpui::App) -> &theme::Theme {
|
||||
|
||||
Reference in New Issue
Block a user