some more bs

This commit is contained in:
2026-04-21 11:50:04 +01:00
parent 74a01bd9e6
commit 6c60013295
11 changed files with 177 additions and 58 deletions

View File

@@ -1,15 +1,14 @@
use gpui::{div, prelude::*};
use crate::{api, app};
use crate::query;
use crate::dashboard;
use crate::query;
use crate::theme;
use crate::titlebar;
use crate::{api, app};
pub struct Global {
pub safe_area: gpui::Bounds<gpui::Pixels>,
pub current_theme: theme::Theme,
pub query_store: query::Store<api::QueryContext>
}
pub struct Chrome {}
@@ -17,8 +16,9 @@ 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| {
cx.update_global::<app::Global, ()>(|global, cx| {
global.current_theme = window.appearance().into();
cx.notify();
});
})
.detach();
@@ -33,15 +33,16 @@ impl gpui::Render for Chrome {
_window: &mut gpui::Window,
cx: &mut gpui::Context<Self>,
) -> impl gpui::IntoElement {
let title_bar = cx.new(|_| titlebar::TitleBar {});
let title_bar = cx.new(|cx| titlebar::TitleBar::new(cx));
let dashboard = cx.new(|_| dashboard::Screen {
text: "World".into(),
});
div()
.size_full()
.flex()
.flex_col()
.size_full()
.child(title_bar)
.child(dashboard)
}
@@ -54,5 +55,5 @@ pub fn current_theme<'a, E>(cx: &'a gpui::Context<E>) -> &'a theme::Theme {
}
pub fn query_store<'a, E>(cx: &'a gpui::Context<E>) -> &'a query::Store<api::QueryContext> {
&cx.global::<Global>().query_store
cx.global::<query::Store<api::QueryContext>>()
}