This commit is contained in:
2026-09-19 18:14:18 +07:00
parent b8f8737dc5
commit bd8bff4693
6 changed files with 95 additions and 46 deletions
+13 -22
View File
@@ -67,14 +67,10 @@ enum Command {
}
pub struct Workspace {
sidebar: Entity<Sidebar>,
/// App's Dock Area
dock: Entity<DockArea>,
title_bar_chrome: Rc<dock::TitleBarChrome>,
/// Async tasks
tasks: Vec<Task<Result<(), Error>>>,
/// Event subscriptions
_subscriptions: SmallVec<[Subscription; 6]>,
}
@@ -221,17 +217,25 @@ impl Workspace {
}),
);
cx.defer_in(window, |this, window, cx| {
cx.defer_in(window, move |this, window, cx| {
let sidebar = PanelHandle::new(sidebar);
this.dock.update(cx, |area, cx| {
let left = DockLayout::tabs().panel_view(Arc::new(sidebar), cx);
area.set_dock(DockPlacement::Left, left, window, cx);
area.set_dock_size(DockPlacement::Left, SIDEBAR_WIDTH, window, cx);
});
let greeter = PanelHandle::new(greeter::init(window, cx));
let center = DockLayout::v_split()
.child(DockLayout::tabs().panel_view(Arc::new(greeter), cx), None);
this.dock
.update(cx, |area, cx| area.set_center(center, window, cx));
this.dock.update(cx, |area, cx| {
area.set_center(center, window, cx);
});
});
Self {
sidebar,
dock,
title_bar_chrome,
tasks: vec![],
@@ -725,20 +729,7 @@ impl Render for Workspace {
.on_action(cx.listener(Self::on_command))
.relative()
.size_full()
.child(
h_flex()
.size_full()
.child(
div()
.flex_shrink_0()
.h_full()
.w(SIDEBAR_WIDTH)
.border_r_1()
.border_color(cx.theme().border_variant)
.child(self.sidebar.clone()),
)
.child(self.dock.clone()),
)
.child(self.dock.clone())
// Notifications
.children(notification_layer)
// Modals