fix titlebar

This commit is contained in:
2026-06-13 16:06:52 +07:00
parent e95cc5967f
commit ac987dc305
11 changed files with 398 additions and 747 deletions

View File

@@ -29,7 +29,6 @@ icons = [
[dependencies]
assets = { path = "../crates/assets" }
ui = { path = "../crates/ui" }
title_bar = { path = "../crates/title_bar" }
theme = { path = "../crates/theme" }
common = { path = "../crates/common" }
state = { path = "../crates/state" }

View File

@@ -16,13 +16,12 @@ use serde::Deserialize;
use smallvec::{SmallVec, smallvec};
use state::{IMAGE_CACHE_SIZE, NostrRegistry, StateEvent};
use theme::{ActiveTheme, SIDEBAR_WIDTH, Theme, ThemeRegistry};
use title_bar::TitleBar;
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::dock::{ClosePanel, DockArea, DockItem, DockPlacement, PanelView};
use ui::menu::{DropdownMenu, PopupMenuItem};
use ui::notification::{Notification, NotificationKind};
use ui::{Icon, IconName, Root, Sizable, WindowExtension, h_flex, v_flex};
use ui::{Icon, IconName, Root, Sizable, TitleBar, WindowExtension, h_flex, v_flex};
use crate::dialogs::import::ImportIdentity;
use crate::dialogs::restore::RestoreEncryption;
@@ -58,9 +57,6 @@ enum Command {
}
pub struct Workspace {
/// App's Title Bar
titlebar: Entity<TitleBar>,
/// App's Dock Area
dock: Entity<DockArea>,
@@ -78,7 +74,6 @@ impl Workspace {
let nostr = NostrRegistry::global(cx);
let signer = nostr.read(cx).signer.clone();
let titlebar = cx.new(|_| TitleBar::new());
let dock = cx.new(|cx| DockArea::new(window, cx));
let image_cache = CoopImageCache::new(IMAGE_CACHE_SIZE, cx);
@@ -259,7 +254,6 @@ impl Workspace {
});
Self {
titlebar,
dock,
image_cache,
_subscriptions: subscriptions,
@@ -498,6 +492,7 @@ impl Workspace {
window.open_modal(cx, move |this, _window, _cx| {
this.width(px(420.))
.show_close(false)
.overlay_closable(false)
.title("Import Identity")
.child(import.clone())
});
@@ -845,15 +840,6 @@ impl Render for Workspace {
let modal_layer = Root::render_modal_layer(window, cx);
let notification_layer = Root::render_notification_layer(window, cx);
// Titlebar elements
let left = self.titlebar_left(cx).into_any_element();
let right = self.titlebar_right(cx).into_any_element();
// Update title bar children
self.titlebar.update(cx, |this, _cx| {
this.set_children(vec![left, right]);
});
div()
.id(SharedString::from("workspace"))
.on_action(cx.listener(Self::on_command))
@@ -867,7 +853,11 @@ impl Render for Workspace {
v_flex()
.size_full()
// Title Bar
.child(self.titlebar.clone())
.child(
TitleBar::new()
.child(self.titlebar_left(cx))
.child(self.titlebar_right(cx)),
)
// Dock
.child(self.dock.clone()),
),