feat: add titlebar

This commit is contained in:
2024-11-27 14:02:45 +07:00
parent f82b415c36
commit 018769b780
2 changed files with 11 additions and 4 deletions

View File

@@ -71,7 +71,7 @@ async fn main() {
.detach();
// Set window size
let bounds = Bounds::centered(None, size(px(860.0), px(650.0)), cx);
let bounds = Bounds::centered(None, size(px(900.0), px(680.0)), cx);
cx.open_window(
WindowOptions {
@@ -80,7 +80,7 @@ async fn main() {
titlebar: Some(TitlebarOptions {
title: Some(SharedString::new_static(APP_NAME)),
appears_transparent: true,
..Default::default()
traffic_light_position: Some(point(px(9.0), px(9.0))),
}),
..Default::default()
},

View File

@@ -3,6 +3,7 @@ use std::sync::Arc;
use components::{
dock::{DockArea, DockItem},
theme::{ActiveTheme, Theme},
TitleBar,
};
use gpui::*;
@@ -70,6 +71,7 @@ impl AppView {
Axis::Vertical,
vec![DockItem::tabs(
vec![
Arc::new(BlockContainer::panel::<WelcomeBlock>(cx)),
Arc::new(BlockContainer::panel::<WelcomeBlock>(cx)),
// TODO: add chat block
],
@@ -86,12 +88,17 @@ impl AppView {
impl Render for AppView {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let mut content = div().size_full().flex().items_center().justify_center();
let mut content = div();
if cx.global::<AppState>().signer.is_none() {
content = content.child(self.onboarding.clone())
} else {
content = content.child(self.dock_area.clone())
content = content
.size_full()
.flex()
.flex_col()
.child(TitleBar::new())
.child(self.dock_area.clone())
}
div()