chore: improve render modal and update deps

This commit is contained in:
2025-07-17 07:54:40 +07:00
parent 73a2678278
commit 59cfdb9ae2
5 changed files with 64 additions and 57 deletions

46
Cargo.lock generated
View File

@@ -1075,7 +1075,7 @@ dependencies = [
[[package]]
name = "collections"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"indexmap",
"rustc-hash 2.1.1",
@@ -1476,7 +1476,7 @@ dependencies = [
[[package]]
name = "derive_refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"proc-macro2",
"quote",
@@ -2328,7 +2328,7 @@ dependencies = [
[[package]]
name = "gpui"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"anyhow",
"as-raw-xcb-connection",
@@ -2421,7 +2421,7 @@ dependencies = [
[[package]]
name = "gpui_macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -2433,7 +2433,7 @@ dependencies = [
[[package]]
name = "gpui_tokio"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"gpui",
"tokio",
@@ -2655,7 +2655,7 @@ dependencies = [
[[package]]
name = "http_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"anyhow",
"bytes",
@@ -2672,7 +2672,7 @@ dependencies = [
[[package]]
name = "http_client_tls"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"rustls",
"rustls-platform-verifier",
@@ -3449,7 +3449,7 @@ dependencies = [
[[package]]
name = "media"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"anyhow",
"bindgen 0.71.1",
@@ -3672,7 +3672,7 @@ dependencies = [
[[package]]
name = "nostr"
version = "0.42.1"
source = "git+https://github.com/rust-nostr/nostr#870bf5eb3e075cd5383e4a92d5f2703a967bef88"
source = "git+https://github.com/rust-nostr/nostr#ef342a983007ad46fc681d90afd9d8458f632b7b"
dependencies = [
"aes",
"base64",
@@ -3695,7 +3695,7 @@ dependencies = [
[[package]]
name = "nostr-connect"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#870bf5eb3e075cd5383e4a92d5f2703a967bef88"
source = "git+https://github.com/rust-nostr/nostr#ef342a983007ad46fc681d90afd9d8458f632b7b"
dependencies = [
"async-utility",
"nostr",
@@ -3707,7 +3707,7 @@ dependencies = [
[[package]]
name = "nostr-database"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#870bf5eb3e075cd5383e4a92d5f2703a967bef88"
source = "git+https://github.com/rust-nostr/nostr#ef342a983007ad46fc681d90afd9d8458f632b7b"
dependencies = [
"flatbuffers",
"lru",
@@ -3718,7 +3718,7 @@ dependencies = [
[[package]]
name = "nostr-lmdb"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#870bf5eb3e075cd5383e4a92d5f2703a967bef88"
source = "git+https://github.com/rust-nostr/nostr#ef342a983007ad46fc681d90afd9d8458f632b7b"
dependencies = [
"async-utility",
"heed",
@@ -3731,7 +3731,7 @@ dependencies = [
[[package]]
name = "nostr-relay-pool"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#870bf5eb3e075cd5383e4a92d5f2703a967bef88"
source = "git+https://github.com/rust-nostr/nostr#ef342a983007ad46fc681d90afd9d8458f632b7b"
dependencies = [
"async-utility",
"async-wsocket",
@@ -3747,7 +3747,7 @@ dependencies = [
[[package]]
name = "nostr-sdk"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#870bf5eb3e075cd5383e4a92d5f2703a967bef88"
source = "git+https://github.com/rust-nostr/nostr#ef342a983007ad46fc681d90afd9d8458f632b7b"
dependencies = [
"async-utility",
"nostr",
@@ -4802,7 +4802,7 @@ dependencies = [
[[package]]
name = "refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"derive_refineable",
"workspace-hack",
@@ -4953,7 +4953,7 @@ dependencies = [
[[package]]
name = "reqwest_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"anyhow",
"bytes",
@@ -5479,7 +5479,7 @@ checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749"
[[package]]
name = "semantic_version"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"anyhow",
"serde",
@@ -5864,7 +5864,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "sum_tree"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"arrayvec",
"log",
@@ -6838,7 +6838,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "util"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#42b2b65241feafa7bdccfdc81972fd9bd8ab2922"
source = "git+https://github.com/zed-industries/zed#b9ff538747556f3f2f5ed4ee109654eb80cc9c9c"
dependencies = [
"anyhow",
"async-fs",
@@ -8018,9 +8018,9 @@ dependencies = [
[[package]]
name = "zbus"
version = "5.8.0"
version = "5.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597f45e98bc7e6f0988276012797855613cd8269e23b5be62cc4e5d28b7e515d"
checksum = "4bb4f9a464286d42851d18a605f7193b8febaf5b0919d71c6399b7b26e5b0aad"
dependencies = [
"async-broadcast",
"async-executor",
@@ -8051,9 +8051,9 @@ dependencies = [
[[package]]
name = "zbus_macros"
version = "5.8.0"
version = "5.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5c8e4e14dcdd9d97a98b189cd1220f30e8394ad271e8c987da84f73693862c2"
checksum = "ef9859f68ee0c4ee2e8cde84737c78e3f4c54f946f2a38645d0d4c7a95327659"
dependencies = [
"proc-macro-crate",
"proc-macro2",

View File

@@ -160,11 +160,6 @@ impl ChatSpace {
if !state.read(cx).has_signer() {
this.open_onboarding(window, cx);
} else {
// Load all chat rooms from database
Registry::global(cx).update(cx, |this, cx| {
this.load_rooms(window, cx);
});
// Open chat panels
this.open_chats(window, cx);
}
},
@@ -229,6 +224,11 @@ impl ChatSpace {
// Enable the toolbar for logged in users
self.toolbar(true, cx);
// Load all chat rooms from database
Registry::global(cx).update(cx, |this, cx| {
this.load_rooms(window, cx);
});
let weak_dock = self.dock.downgrade();
let left = DockItem::panel(Arc::new(sidebar::init(window, cx)));
let center = DockItem::split_with_sizes(

View File

@@ -103,6 +103,8 @@ impl Compose {
.map(|profile| Contact::new(profile.public_key()))
.collect_vec();
log::info!("get contacts");
Ok(contacts)
});

View File

@@ -51,11 +51,11 @@ impl Preferences {
fn open_edit_profile(&self, window: &mut Window, cx: &mut Context<Self>) {
let edit_profile = edit_profile::init(window, cx);
let title = SharedString::new(t!("preferences.modal_profile_title"));
window.open_modal(cx, move |modal, _window, _cx| {
let title = SharedString::new(t!("preferences.modal_profile_title"));
modal
.title(title)
.title(title.clone())
.width(px(DEFAULT_MODAL_WIDTH))
.child(edit_profile.clone())
});
@@ -63,11 +63,11 @@ impl Preferences {
fn open_relays(&self, window: &mut Window, cx: &mut Context<Self>) {
let relays = relays::init(window, cx);
let title = SharedString::new(t!("preferences.modal_relays_title"));
window.open_modal(cx, move |this, _window, _cx| {
let title = SharedString::new(t!("preferences.modal_relays_title"));
this.width(px(DEFAULT_MODAL_WIDTH))
.title(title)
.title(title.clone())
.child(relays.clone())
});
}

View File

@@ -576,19 +576,24 @@ impl Sidebar {
fn open_compose(&self, window: &mut Window, cx: &mut Context<Self>) {
let compose = compose::init(window, cx);
let title = SharedString::new(t!("sidebar.direct_messages"));
window.open_modal(cx, move |modal, _window, _cx| {
modal
.title(SharedString::new(t!("sidebar.direct_messages")))
.title(title.clone())
.width(px(DEFAULT_MODAL_WIDTH))
.child(compose.clone())
});
}
fn open_loading_modal(&self, window: &mut Window, cx: &mut Context<Self>) {
let title = SharedString::new(t!("sidebar.loading_modal_title"));
let text_1 = SharedString::new(t!("sidebar.loading_modal_body_1"));
let text_2 = SharedString::new(t!("sidebar.loading_modal_body_2"));
let desc = SharedString::new(t!("sidebar.loading_modal_description"));
window.open_modal(cx, move |this, _window, cx| {
this.title(SharedString::new(t!("sidebar.loading_modal_title")))
.child(
this.title(title.clone()).child(
div()
.px_4()
.pb_4()
@@ -601,14 +606,14 @@ impl Sidebar {
.flex_col()
.gap_2()
.text_sm()
.child(SharedString::new(t!("sidebar.loading_modal_body_1")))
.child(SharedString::new(t!("sidebar.loading_modal_body_2"))),
.child(text_1.clone())
.child(text_2.clone()),
)
.child(
div()
.text_xs()
.text_color(cx.theme().text_muted)
.child(SharedString::new(t!("sidebar.loading_modal_description"))),
.child(desc.clone()),
),
)
});