wip: refactor

This commit is contained in:
2025-02-03 08:23:03 +07:00
parent c982c802e2
commit d921720042
29 changed files with 534 additions and 265 deletions

231
Cargo.lock generated
View File

@@ -163,7 +163,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -338,7 +338,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -367,13 +367,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.85" version = "0.1.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" checksum = "644dd749086bf3771a2fbc5f256fdb982d53f011c7d5d560304eafeecebce79d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -390,8 +390,9 @@ dependencies = [
[[package]] [[package]]
name = "async-wsocket" name = "async-wsocket"
version = "0.12.0" version = "0.13.0"
source = "git+https://github.com/yukibtc/async-wsocket?rev=5fba7927576064ac0698a4ee3df0d26e5cf726dd#5fba7927576064ac0698a4ee3df0d26e5cf726dd" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "197c8c4d501d615e193e548ff0225925306b1f413a0f27f0b0952367ff25e41c"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"futures", "futures",
@@ -503,7 +504,7 @@ dependencies = [
"regex", "regex",
"rustc-hash 1.1.0", "rustc-hash 1.1.0",
"shlex", "shlex",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -631,7 +632,7 @@ source = "git+https://github.com/kvark/blade?rev=b16f5c7bd873c7126f48c82c39e7ae6
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -730,7 +731,7 @@ checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -799,16 +800,16 @@ dependencies = [
"quote", "quote",
"serde", "serde",
"serde_json", "serde_json",
"syn 2.0.96", "syn 2.0.97",
"tempfile", "tempfile",
"toml", "toml",
] ]
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.10" version = "1.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" checksum = "e4730490333d58093109dc02c23174c3f4d490998c3fed3cc8e82d57afedb9cf"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -877,7 +878,7 @@ dependencies = [
] ]
[[package]] [[package]]
name = "chat" name = "chat_state"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
@@ -956,7 +957,7 @@ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -1038,7 +1039,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
@@ -1109,7 +1110,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"app_state", "app_state",
"chat", "chat_state",
"chrono", "chrono",
"common", "common",
"dirs 5.0.1", "dirs 5.0.1",
@@ -1313,7 +1314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -1338,13 +1339,13 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustc_version", "rustc_version",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1411,7 +1412,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -1458,9 +1459,9 @@ dependencies = [
[[package]] [[package]]
name = "dyn-clone" name = "dyn-clone"
version = "1.0.17" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" checksum = "feeef44e73baff3a26d371801df019877a9866a8c493d315ab00177843314f35"
[[package]] [[package]]
name = "either" name = "either"
@@ -1515,7 +1516,7 @@ checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -1764,7 +1765,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -1887,7 +1888,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -2057,7 +2058,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@@ -2144,7 +2145,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macros" name = "gpui_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2154,7 +2155,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_tokio" name = "gpui_tokio"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"gpui", "gpui",
"tokio", "tokio",
@@ -2359,7 +2360,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client" name = "http_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -2574,7 +2575,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -2684,7 +2685,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -2876,7 +2877,7 @@ checksum = "edbe595006d355eaf9ae11db92707d4338cd2384d16866131cc1afdbdd35d8d9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -3021,7 +3022,7 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen", "bindgen",
@@ -3158,8 +3159,9 @@ checksum = "e664971378a3987224f7a0e10059782035e89899ae403718ee07de85bec42afe"
[[package]] [[package]]
name = "negentropy" name = "negentropy"
version = "0.4.3" version = "0.5.0"
source = "git+https://github.com/rust-nostr/negentropy?rev=311013ce05dd3f670d9d9c444c09195837837271#311013ce05dd3f670d9d9c444c09195837837271" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0efe882e02d206d8d279c20eb40e03baf7cb5136a1476dc084a324fbc3ec42d"
[[package]] [[package]]
name = "new_debug_unreachable" name = "new_debug_unreachable"
@@ -3198,8 +3200,8 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]] [[package]]
name = "nostr" name = "nostr"
version = "0.38.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#3c248e5fbb42f608110c33d4c8d470e479e361f3" source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a"
dependencies = [ dependencies = [
"aes", "aes",
"base64", "base64",
@@ -3226,8 +3228,8 @@ dependencies = [
[[package]] [[package]]
name = "nostr-database" name = "nostr-database"
version = "0.38.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#3c248e5fbb42f608110c33d4c8d470e479e361f3" source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a"
dependencies = [ dependencies = [
"flatbuffers", "flatbuffers",
"nostr", "nostr",
@@ -3236,8 +3238,8 @@ dependencies = [
[[package]] [[package]]
name = "nostr-lmdb" name = "nostr-lmdb"
version = "0.38.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#3c248e5fbb42f608110c33d4c8d470e479e361f3" source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"heed", "heed",
@@ -3247,14 +3249,14 @@ dependencies = [
[[package]] [[package]]
name = "nostr-relay-pool" name = "nostr-relay-pool"
version = "0.38.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#3c248e5fbb42f608110c33d4c8d470e479e361f3" source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"async-wsocket", "async-wsocket",
"atomic-destructor", "atomic-destructor",
"negentropy 0.3.1", "negentropy 0.3.1",
"negentropy 0.4.3", "negentropy 0.5.0",
"nostr", "nostr",
"nostr-database", "nostr-database",
"tokio", "tokio",
@@ -3263,8 +3265,8 @@ dependencies = [
[[package]] [[package]]
name = "nostr-sdk" name = "nostr-sdk"
version = "0.38.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#3c248e5fbb42f608110c33d4c8d470e479e361f3" source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"nostr", "nostr",
@@ -3344,7 +3346,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -3828,7 +3830,7 @@ dependencies = [
"phf_shared", "phf_shared",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -3863,7 +3865,7 @@ checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -3973,7 +3975,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -4010,7 +4012,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -4030,9 +4032,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
[[package]] [[package]]
name = "quick-xml" name = "quick-xml"
version = "0.36.2" version = "0.37.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@@ -4272,7 +4274,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
] ]
@@ -4401,7 +4403,7 @@ dependencies = [
[[package]] [[package]]
name = "reqwest_client" name = "reqwest_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -4478,7 +4480,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rust-embed-utils", "rust-embed-utils",
"syn 2.0.96", "syn 2.0.97",
"walkdir", "walkdir",
] ]
@@ -4535,9 +4537,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.21" version = "0.23.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" checksum = "9fb9263ab4eb695e42321db096e3b8fbd715a59b154d5c88d82db2175b681ba7"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"ring", "ring",
@@ -4666,7 +4668,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde_derive_internals", "serde_derive_internals",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -4751,7 +4753,7 @@ checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe"
[[package]] [[package]]
name = "semantic_version" name = "semantic_version"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@@ -4780,7 +4782,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -4791,7 +4793,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -4824,7 +4826,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -5064,7 +5066,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -5076,7 +5078,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "sum_tree" name = "sum_tree"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@@ -5201,9 +5203,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.96" version = "2.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" checksum = "5dabd04e3b9a8c3c03d5e743f5ef5e1207befc9de704d477f7198cc28049763e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -5236,7 +5238,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -5367,7 +5369,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -5378,7 +5380,7 @@ checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -5499,7 +5501,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -5576,15 +5578,15 @@ dependencies = [
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.22.22" version = "0.22.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"winnow", "winnow 0.7.0",
] ]
[[package]] [[package]]
@@ -5633,7 +5635,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -5898,7 +5900,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e1af35aa154ddc10faf4e9a5aac37ae543b1f6ac" source = "git+https://github.com/zed-industries/zed#2f8237492641b4c97f61977a39f8a10225578a6d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs", "async-fs",
@@ -6079,7 +6081,7 @@ dependencies = [
"log", "log",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -6114,7 +6116,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -6143,9 +6145,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-backend" name = "wayland-backend"
version = "0.3.7" version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf"
dependencies = [ dependencies = [
"cc", "cc",
"downcast-rs", "downcast-rs",
@@ -6157,9 +6159,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-client" name = "wayland-client"
version = "0.31.7" version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
"rustix", "rustix",
@@ -6169,9 +6171,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-cursor" name = "wayland-cursor"
version = "0.31.7" version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c" checksum = "a93029cbb6650748881a00e4922b076092a6a08c11e7fbdb923f064b23968c5d"
dependencies = [ dependencies = [
"rustix", "rustix",
"wayland-client", "wayland-client",
@@ -6205,9 +6207,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-scanner" name = "wayland-scanner"
version = "0.31.5" version = "0.31.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quick-xml", "quick-xml",
@@ -6216,9 +6218,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-sys" name = "wayland-sys"
version = "0.31.5" version = "0.31.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09" checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615"
dependencies = [ dependencies = [
"dlib", "dlib",
"log", "log",
@@ -6248,9 +6250,9 @@ dependencies = [
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.26.7" version = "0.26.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9"
dependencies = [ dependencies = [
"rustls-pki-types", "rustls-pki-types",
] ]
@@ -6332,7 +6334,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -6343,7 +6345,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -6526,9 +6528,18 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.25" version = "0.6.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad699df48212c6cc6eb4435f35500ac6fd3b9913324f938aea302022ce19d310" checksum = "1e90edd2ac1aa278a5c4599b1d89cf03074b610800f866d4026dc199d7929a28"
dependencies = [
"memchr",
]
[[package]]
name = "winnow"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e49d2d35d3fad69b39b94139037ecfb4f359f08958b9c11e7315ce770462419"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@@ -6707,7 +6718,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"synstructure", "synstructure",
] ]
@@ -6778,7 +6789,7 @@ dependencies = [
"tracing", "tracing",
"uds_windows", "uds_windows",
"windows-sys 0.59.0", "windows-sys 0.59.0",
"winnow", "winnow 0.6.26",
"xdg-home", "xdg-home",
"zbus_macros 5.3.1", "zbus_macros 5.3.1",
"zbus_names 4.1.1", "zbus_names 4.1.1",
@@ -6794,7 +6805,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"zvariant_utils 2.1.0", "zvariant_utils 2.1.0",
] ]
@@ -6807,7 +6818,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"zbus_names 4.1.1", "zbus_names 4.1.1",
"zvariant 5.2.0", "zvariant 5.2.0",
"zvariant_utils 3.1.0", "zvariant_utils 3.1.0",
@@ -6832,7 +6843,7 @@ checksum = "519629a3f80976d89c575895b05677cbc45eaf9f70d62a364d819ba646409cc8"
dependencies = [ dependencies = [
"serde", "serde",
"static_assertions", "static_assertions",
"winnow", "winnow 0.6.26",
"zvariant 5.2.0", "zvariant 5.2.0",
] ]
@@ -6860,7 +6871,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -6880,7 +6891,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"synstructure", "synstructure",
] ]
@@ -6901,7 +6912,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -6923,7 +6934,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -6974,7 +6985,7 @@ dependencies = [
"serde", "serde",
"static_assertions", "static_assertions",
"url", "url",
"winnow", "winnow 0.6.26",
"zvariant_derive 5.2.0", "zvariant_derive 5.2.0",
"zvariant_utils 3.1.0", "zvariant_utils 3.1.0",
] ]
@@ -6988,7 +6999,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"zvariant_utils 2.1.0", "zvariant_utils 2.1.0",
] ]
@@ -7001,7 +7012,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
"zvariant_utils 3.1.0", "zvariant_utils 3.1.0",
] ]
@@ -7013,7 +7024,7 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.96", "syn 2.0.97",
] ]
[[package]] [[package]]
@@ -7026,6 +7037,6 @@ dependencies = [
"quote", "quote",
"serde", "serde",
"static_assertions", "static_assertions",
"syn 2.0.96", "syn 2.0.97",
"winnow", "winnow 0.6.26",
] ]

View File

@@ -1,4 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
<path fill="currentColor" fill-rule="evenodd" d="M4.75 4A2.75 2.75 0 0 0 2 6.75v10.5A2.75 2.75 0 0 0 4.75 20h14.5A2.75 2.75 0 0 0 22 17.25V6.75A2.75 2.75 0 0 0 19.25 4H4.75ZM3.5 6.75c0-.69.56-1.25 1.25-1.25h5.75v13H4.75c-.69 0-1.25-.56-1.25-1.25V6.75Z" clip-rule="evenodd"/> <path fill="#000" fill-rule="evenodd" d="M9 4.5v15h9.25c.69 0 1.25-.56 1.25-1.25V5.75c0-.69-.56-1.25-1.25-1.25H9ZM3 5.75A2.75 2.75 0 0 1 5.75 3h12.5A2.75 2.75 0 0 1 21 5.75v12.5A2.75 2.75 0 0 1 18.25 21H5.75A2.75 2.75 0 0 1 3 18.25V5.75Z" clip-rule="evenodd"/>
<path fill="currentColor" fill-rule="evenodd" d="M7 9.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2ZM7 13a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 3.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z" clip-rule="evenodd"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 374 B

View File

@@ -1,4 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path fill="currentColor" fill-rule="evenodd" d="M4.75 4A2.75 2.75 0 0 0 2 6.75v10.5A2.75 2.75 0 0 0 4.75 20h14.5A2.75 2.75 0 0 0 22 17.25V6.75A2.75 2.75 0 0 0 19.25 4H4.75ZM3.5 6.75c0-.69.56-1.25 1.25-1.25h5.75v13H4.75c-.69 0-1.25-.56-1.25-1.25V6.75Z" clip-rule="evenodd"/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M3.75 5.75a2 2 0 0 1 2-2h12.5a2 2 0 0 1 2 2v12.5a2 2 0 0 1-2 2H5.75a2 2 0 0 1-2-2V5.75Zm5-1.75v16"/>
<path fill="currentColor" fill-rule="evenodd" d="M7 9.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2ZM7 13a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 3.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z" clip-rule="evenodd"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 303 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
<path fill="#000" fill-rule="evenodd" d="M15 4.5v15H5.75c-.69 0-1.25-.56-1.25-1.25V5.75c0-.69.56-1.25 1.25-1.25H15Zm6 1.25A2.75 2.75 0 0 0 18.25 3H5.75A2.75 2.75 0 0 0 3 5.75v12.5A2.75 2.75 0 0 0 5.75 21h12.5A2.75 2.75 0 0 0 21 18.25V5.75Z" clip-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 376 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M15.25 4v16M3.75 5.75a2 2 0 0 1 2-2h12.5a2 2 0 0 1 2 2v12.5a2 2 0 0 1-2 2H5.75a2 2 0 0 1-2-2V5.75Z"/>
</svg>

After

Width:  |  Height:  |  Size: 304 B

View File

@@ -13,7 +13,7 @@ ui = { path = "../ui" }
common = { path = "../common" } common = { path = "../common" }
state = { path = "../state" } state = { path = "../state" }
app_state = { path = "../app_state" } app_state = { path = "../app_state" }
chat = { path = "../chat" } chat_state = { path = "../chat_state" }
gpui.workspace = true gpui.workspace = true
gpui_tokio.workspace = true gpui_tokio.workspace = true

View File

@@ -1,7 +1,7 @@
use app_state::registry::AppRegistry; use app_state::registry::AppRegistry;
use asset::Assets; use asset::Assets;
use async_utility::task::spawn; use async_utility::task::spawn;
use chat::registry::ChatRegistry; use chat_state::registry::ChatRegistry;
use common::{ use common::{
constants::{ constants::{
ALL_MESSAGES_SUB_ID, APP_ID, APP_NAME, FAKE_SIG, KEYRING_SERVICE, NEW_MESSAGE_SUB_ID, ALL_MESSAGES_SUB_ID, APP_ID, APP_NAME, FAKE_SIG, KEYRING_SERVICE, NEW_MESSAGE_SUB_ID,

View File

@@ -1,11 +1,14 @@
use super::{chat::ChatPanel, onboarding::Onboarding, sidebar::Sidebar, welcome::WelcomePanel}; use super::{
chat, contacts, onboarding::Onboarding, profile, settings, sidebar::Sidebar,
welcome::WelcomePanel,
};
use app_state::registry::AppRegistry; use app_state::registry::AppRegistry;
use chat::registry::ChatRegistry; use chat_state::registry::ChatRegistry;
use common::profile::NostrProfile; use common::profile::NostrProfile;
use gpui::{ use gpui::{
actions, div, img, impl_internal_actions, px, AppContext, Axis, BorrowAppContext, Context, actions, div, img, impl_internal_actions, px, AppContext, Axis, BorrowAppContext, Context,
Edges, Entity, InteractiveElement, IntoElement, ObjectFit, ParentElement, Render, Styled, Entity, InteractiveElement, IntoElement, ObjectFit, ParentElement, Render, Styled, StyledImage,
StyledImage, Window, Window,
}; };
use serde::Deserialize; use serde::Deserialize;
use state::get_client; use state::get_client;
@@ -13,24 +16,33 @@ use std::sync::Arc;
use ui::{ use ui::{
button::{Button, ButtonVariants}, button::{Button, ButtonVariants},
dock_area::{dock::DockPlacement, DockArea, DockItem}, dock_area::{dock::DockPlacement, DockArea, DockItem},
notification::NotificationType,
popup_menu::PopupMenuExt, popup_menu::PopupMenuExt,
ContextModal, Icon, IconName, Root, Sizable, TitleBar, Icon, IconName, Root, Sizable, TitleBar,
}; };
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Clone, PartialEq, Eq, Deserialize)]
pub enum PanelKind { pub enum PanelKind {
Room(u64), Room(u64),
Profile,
Contacts,
Settings,
} }
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Clone, PartialEq, Eq, Deserialize)]
pub struct AddPanel { pub struct AddPanel {
pub panel: PanelKind, panel: PanelKind,
pub position: DockPlacement, position: DockPlacement,
}
impl AddPanel {
pub fn new(panel: PanelKind, position: DockPlacement) -> Self {
Self { panel, position }
}
} }
// Dock actions // Dock actions
impl_internal_actions!(dock, [AddPanel]); impl_internal_actions!(dock, [AddPanel]);
// Account actions // Account actions
actions!(account, [OpenProfile, OpenContacts, OpenSettings, Logout]); actions!(account, [OpenProfile, OpenContacts, OpenSettings, Logout]);
@@ -53,9 +65,8 @@ impl AppView {
pub fn new(account: NostrProfile, window: &mut Window, cx: &mut Context<'_, Self>) -> AppView { pub fn new(account: NostrProfile, window: &mut Window, cx: &mut Context<'_, Self>) -> AppView {
let dock = cx.new(|cx| DockArea::new(DOCK_AREA.id, Some(DOCK_AREA.version), window, cx)); let dock = cx.new(|cx| DockArea::new(DOCK_AREA.id, Some(DOCK_AREA.version), window, cx));
let weak_dock = dock.downgrade(); let weak_dock = dock.downgrade();
let left_panel = DockItem::panel(Arc::new(Sidebar::new(window, cx)));
let left = DockItem::panel(Arc::new(Sidebar::new(window, cx))); let center_panel = DockItem::split_with_sizes(
let center = DockItem::split_with_sizes(
Axis::Vertical, Axis::Vertical,
vec![DockItem::tabs( vec![DockItem::tabs(
vec![Arc::new(WelcomePanel::new(window, cx))], vec![Arc::new(WelcomePanel::new(window, cx))],
@@ -72,18 +83,8 @@ impl AppView {
_ = weak_dock.update(cx, |view, cx| { _ = weak_dock.update(cx, |view, cx| {
view.set_version(DOCK_AREA.version, window, cx); view.set_version(DOCK_AREA.version, window, cx);
view.set_left_dock(left, Some(px(240.)), true, window, cx); view.set_left_dock(left_panel, Some(px(240.)), true, window, cx);
view.set_center(center, window, cx); view.set_center(center_panel, window, cx);
view.set_dock_collapsible(
Edges {
left: false,
..Default::default()
},
window,
cx,
);
// TODO: support right dock?
// TODO: support bottom dock?
}); });
AppView { account, dock } AppView { account, dock }
@@ -102,9 +103,18 @@ impl AppView {
.object_fit(ObjectFit::Cover), .object_fit(ObjectFit::Cover),
) )
.popup_menu(move |this, _, _cx| { .popup_menu(move |this, _, _cx| {
this.menu("Profile", Box::new(OpenProfile)) this.menu(
.menu("Contacts", Box::new(OpenContacts)) "Profile",
.menu("Settings", Box::new(OpenSettings)) Box::new(AddPanel::new(PanelKind::Profile, DockPlacement::Right)),
)
.menu(
"Contacts",
Box::new(AddPanel::new(PanelKind::Contacts, DockPlacement::Right)),
)
.menu(
"Settings",
Box::new(AddPanel::new(PanelKind::Settings, DockPlacement::Center)),
)
.separator() .separator()
.menu("Change account", Box::new(Logout)) .menu("Change account", Box::new(Logout))
}) })
@@ -115,51 +125,37 @@ impl AppView {
PanelKind::Room(id) => { PanelKind::Room(id) => {
if let Some(weak_room) = cx.global::<ChatRegistry>().get_room(id, cx) { if let Some(weak_room) = cx.global::<ChatRegistry>().get_room(id, cx) {
if let Some(room) = weak_room.upgrade() { if let Some(room) = weak_room.upgrade() {
let panel = Arc::new(ChatPanel::new(room, window, cx)); let panel = Arc::new(chat::init(room, window, cx));
self.dock.update(cx, |dock_area, cx| { self.dock.update(cx, |dock_area, cx| {
dock_area.add_panel(panel, action.position, window, cx); dock_area.add_panel(panel, action.position, window, cx);
}); });
} else {
window.push_notification(
(
NotificationType::Error,
"System error. Cannot open this chat room.",
),
cx,
);
} }
} }
} }
PanelKind::Profile => {
let panel = Arc::new(profile::init(window, cx));
self.dock.update(cx, |dock_area, cx| {
dock_area.add_panel(panel, action.position, window, cx);
});
}
PanelKind::Contacts => {
let panel = Arc::new(contacts::init(window, cx));
self.dock.update(cx, |dock_area, cx| {
dock_area.add_panel(panel, action.position, window, cx);
});
}
PanelKind::Settings => {
let panel = Arc::new(settings::init(window, cx));
self.dock.update(cx, |dock_area, cx| {
dock_area.add_panel(panel, action.position, window, cx);
});
}
}; };
} }
fn on_profile_action(
&mut self,
_action: &OpenProfile,
_window: &mut Window,
_cx: &mut Context<Self>,
) {
// TODO
}
fn on_contacts_action(
&mut self,
_action: &OpenContacts,
_window: &mut Window,
_cx: &mut Context<Self>,
) {
// TODO
}
fn on_settings_action(
&mut self,
_action: &OpenSettings,
_window: &mut Window,
_cx: &mut Context<Self>,
) {
// TODO
}
fn on_logout_action(&mut self, _action: &Logout, window: &mut Window, cx: &mut Context<Self>) { fn on_logout_action(&mut self, _action: &Logout, window: &mut Window, cx: &mut Context<Self>) {
cx.update_global::<AppRegistry, _>(|this, cx| { cx.update_global::<AppRegistry, _>(|this, cx| {
cx.background_executor() cx.background_executor()
@@ -210,8 +206,5 @@ impl Render for AppView {
.children(modal_layer) .children(modal_layer)
.on_action(cx.listener(Self::on_panel_action)) .on_action(cx.listener(Self::on_panel_action))
.on_action(cx.listener(Self::on_logout_action)) .on_action(cx.listener(Self::on_logout_action))
.on_action(cx.listener(Self::on_profile_action))
.on_action(cx.listener(Self::on_contacts_action))
.on_action(cx.listener(Self::on_settings_action))
} }
} }

View File

@@ -1,5 +1,5 @@
use async_utility::task::spawn; use async_utility::task::spawn;
use chat::room::Room; use chat_state::room::Room;
use common::{ use common::{
constants::IMAGE_SERVICE, constants::IMAGE_SERVICE,
utils::{compare, message_time, nip96_upload}, utils::{compare, message_time, nip96_upload},
@@ -28,15 +28,19 @@ use ui::{
mod message; mod message;
pub fn init(room: Entity<Room>, window: &mut Window, cx: &mut App) -> Entity<Chat> {
Chat::new(room, window, cx)
}
#[derive(Clone)] #[derive(Clone)]
pub struct State { pub struct State {
count: usize, count: usize,
items: Vec<Message>, items: Vec<Message>,
} }
pub struct ChatPanel { pub struct Chat {
// Panel // Panel
closeable: bool, closable: bool,
zoomable: bool, zoomable: bool,
focus_handle: FocusHandle, focus_handle: FocusHandle,
// Chat Room // Chat Room
@@ -52,7 +56,7 @@ pub struct ChatPanel {
is_uploading: bool, is_uploading: bool,
} }
impl ChatPanel { impl Chat {
pub fn new(model: Entity<Room>, window: &mut Window, cx: &mut App) -> Entity<Self> { pub fn new(model: Entity<Room>, window: &mut Window, cx: &mut App) -> Entity<Self> {
let room = model.read(cx); let room = model.read(cx);
let id = room.id.to_string().into(); let id = room.id.to_string().into();
@@ -84,7 +88,7 @@ impl ChatPanel {
cx.subscribe_in( cx.subscribe_in(
&input, &input,
window, window,
move |this: &mut ChatPanel, view, input_event, window, cx| { move |this: &mut Chat, view, input_event, window, cx| {
if let InputEvent::PressEnter = input_event { if let InputEvent::PressEnter = input_event {
this.send_message(view.downgrade(), window, cx); this.send_message(view.downgrade(), window, cx);
} }
@@ -118,7 +122,7 @@ impl ChatPanel {
let attaches = cx.new(|_| None); let attaches = cx.new(|_| None);
Self { Self {
closeable: true, closable: true,
zoomable: true, zoomable: true,
focus_handle: cx.focus_handle(), focus_handle: cx.focus_handle(),
room: model, room: model,
@@ -425,7 +429,7 @@ impl ChatPanel {
} }
} }
impl Panel for ChatPanel { impl Panel for Chat {
fn panel_id(&self) -> SharedString { fn panel_id(&self) -> SharedString {
self.id.clone() self.id.clone()
} }
@@ -445,8 +449,8 @@ impl Panel for ChatPanel {
self.name.clone().into_any_element() self.name.clone().into_any_element()
} }
fn closeable(&self, _cx: &App) -> bool { fn closable(&self, _cx: &App) -> bool {
self.closeable self.closable
} }
fn zoomable(&self, _cx: &App) -> bool { fn zoomable(&self, _cx: &App) -> bool {
@@ -462,15 +466,15 @@ impl Panel for ChatPanel {
} }
} }
impl EventEmitter<PanelEvent> for ChatPanel {} impl EventEmitter<PanelEvent> for Chat {}
impl Focusable for ChatPanel { impl Focusable for Chat {
fn focus_handle(&self, _: &App) -> FocusHandle { fn focus_handle(&self, _: &App) -> FocusHandle {
self.focus_handle.clone() self.focus_handle.clone()
} }
} }
impl Render for ChatPanel { impl Render for Chat {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
v_flex() v_flex()
.size_full() .size_full()

View File

@@ -0,0 +1,76 @@
use gpui::{
div, AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
IntoElement, ParentElement, Render, SharedString, Styled, Window,
};
use ui::{
button::Button,
dock_area::panel::{Panel, PanelEvent},
popup_menu::PopupMenu,
};
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Contacts> {
Contacts::new(window, cx)
}
pub struct Contacts {
name: SharedString,
closable: bool,
zoomable: bool,
focus_handle: FocusHandle,
}
impl Contacts {
pub fn new(_window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self {
name: "Contacts".into(),
closable: true,
zoomable: true,
focus_handle: cx.focus_handle(),
})
}
}
impl Panel for Contacts {
fn panel_id(&self) -> SharedString {
"ContactPanel".into()
}
fn title(&self, _cx: &App) -> AnyElement {
self.name.clone().into_any_element()
}
fn closable(&self, _cx: &App) -> bool {
self.closable
}
fn zoomable(&self, _cx: &App) -> bool {
self.zoomable
}
fn popup_menu(&self, menu: PopupMenu, _cx: &App) -> PopupMenu {
menu.track_focus(&self.focus_handle)
}
fn toolbar_buttons(&self, _window: &Window, _cx: &App) -> Vec<Button> {
vec![]
}
}
impl EventEmitter<PanelEvent> for Contacts {}
impl Focusable for Contacts {
fn focus_handle(&self, _: &App) -> gpui::FocusHandle {
self.focus_handle.clone()
}
}
impl Render for Contacts {
fn render(&mut self, _window: &mut gpui::Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.size_full()
.flex()
.items_center()
.justify_center()
.child("Contacts")
}
}

View File

@@ -1,4 +1,7 @@
mod chat; mod chat;
mod contacts;
mod profile;
mod settings;
mod sidebar; mod sidebar;
mod welcome; mod welcome;

View File

@@ -1,8 +1,17 @@
use common::constants::KEYRING_SERVICE; use app_state::registry::AppRegistry;
use gpui::{div, AppContext, Context, Entity, IntoElement, ParentElement, Render, Styled, Window}; use common::{constants::KEYRING_SERVICE, profile::NostrProfile};
use gpui::{
div, AppContext, BorrowAppContext, Context, Entity, IntoElement, ParentElement, Render, Styled,
Window,
};
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use state::get_client; use state::get_client;
use ui::input::{InputEvent, TextInput}; use ui::{
input::{InputEvent, TextInput},
Root,
};
use super::app::AppView;
pub struct Onboarding { pub struct Onboarding {
input: Entity<TextInput>, input: Entity<TextInput>,
@@ -33,43 +42,56 @@ impl Onboarding {
fn save_keys( fn save_keys(
content: &str, content: &str,
_window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> anyhow::Result<(), anyhow::Error> { ) -> anyhow::Result<(), anyhow::Error> {
let keys = Keys::parse(content)?; let keys = Keys::parse(content)?;
let public_key = keys.public_key(); let public_key = keys.public_key();
let bech32 = public_key.to_bech32()?; let bech32 = public_key.to_bech32()?;
let secret = keys.secret_key().to_secret_hex(); let secret = keys.secret_key().to_secret_hex();
let window_handle = window.window_handle();
let async_cx = cx.to_async();
cx.foreground_executor()
.spawn({
let client = get_client();
let task = cx.write_credentials(KEYRING_SERVICE, &bech32, secret.as_bytes()); let task = cx.write_credentials(KEYRING_SERVICE, &bech32, secret.as_bytes());
async move { cx.spawn(|_, mut cx| async move {
let client = get_client();
if task.await.is_ok() { if task.await.is_ok() {
let query: anyhow::Result<Metadata, anyhow::Error> = async_cx let (tx, mut rx) = tokio::sync::mpsc::channel::<NostrProfile>(1);
.background_executor()
cx.background_executor()
.spawn(async move { .spawn(async move {
// Update signer // Update signer
_ = client.set_signer(keys).await; _ = client.set_signer(keys).await;
// Get metadata // Get metadata
if let Some(metadata) = let metadata = if let Ok(Some(metadata)) =
client.database().metadata(public_key).await? client.database().metadata(public_key).await
{ {
Ok(metadata) metadata
} else { } else {
Ok(Metadata::new()) Metadata::new()
} };
_ = tx.send(NostrProfile::new(public_key, metadata)).await;
}) })
.await; .await;
if let Ok(_metadata) = query { while let Some(profile) = rx.recv().await {
// cx.update_window(window_handle, |_, window, cx| {
cx.update_global::<AppRegistry, _>(|this, cx| {
this.set_user(Some(profile.clone()));
if let Some(root) = this.root() {
cx.update_entity(&root, |this: &mut Root, cx| {
this.set_view(
cx.new(|cx| AppView::new(profile, window, cx)).into(),
cx,
);
});
} }
});
})
.unwrap();
} }
} }
}) })

View File

@@ -0,0 +1,76 @@
use gpui::{
div, AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
IntoElement, ParentElement, Render, SharedString, Styled, Window,
};
use ui::{
button::Button,
dock_area::panel::{Panel, PanelEvent},
popup_menu::PopupMenu,
};
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Profile> {
Profile::new(window, cx)
}
pub struct Profile {
name: SharedString,
closable: bool,
zoomable: bool,
focus_handle: FocusHandle,
}
impl Profile {
pub fn new(_window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self {
name: "Profile".into(),
closable: true,
zoomable: true,
focus_handle: cx.focus_handle(),
})
}
}
impl Panel for Profile {
fn panel_id(&self) -> SharedString {
"ProfilePanel".into()
}
fn title(&self, _cx: &App) -> AnyElement {
self.name.clone().into_any_element()
}
fn closable(&self, _cx: &App) -> bool {
self.closable
}
fn zoomable(&self, _cx: &App) -> bool {
self.zoomable
}
fn popup_menu(&self, menu: PopupMenu, _cx: &App) -> PopupMenu {
menu.track_focus(&self.focus_handle)
}
fn toolbar_buttons(&self, _window: &Window, _cx: &App) -> Vec<Button> {
vec![]
}
}
impl EventEmitter<PanelEvent> for Profile {}
impl Focusable for Profile {
fn focus_handle(&self, _: &App) -> gpui::FocusHandle {
self.focus_handle.clone()
}
}
impl Render for Profile {
fn render(&mut self, _window: &mut gpui::Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.size_full()
.flex()
.items_center()
.justify_center()
.child("Profile")
}
}

View File

@@ -0,0 +1,76 @@
use gpui::{
div, AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
IntoElement, ParentElement, Render, SharedString, Styled, Window,
};
use ui::{
button::Button,
dock_area::panel::{Panel, PanelEvent},
popup_menu::PopupMenu,
};
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Settings> {
Settings::new(window, cx)
}
pub struct Settings {
name: SharedString,
closable: bool,
zoomable: bool,
focus_handle: FocusHandle,
}
impl Settings {
pub fn new(_window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self {
name: "Settings".into(),
closable: true,
zoomable: true,
focus_handle: cx.focus_handle(),
})
}
}
impl Panel for Settings {
fn panel_id(&self) -> SharedString {
"SettingsPanel".into()
}
fn title(&self, _cx: &App) -> AnyElement {
self.name.clone().into_any_element()
}
fn closable(&self, _cx: &App) -> bool {
self.closable
}
fn zoomable(&self, _cx: &App) -> bool {
self.zoomable
}
fn popup_menu(&self, menu: PopupMenu, _cx: &App) -> PopupMenu {
menu.track_focus(&self.focus_handle)
}
fn toolbar_buttons(&self, _window: &Window, _cx: &App) -> Vec<Button> {
vec![]
}
}
impl EventEmitter<PanelEvent> for Settings {}
impl Focusable for Settings {
fn focus_handle(&self, _: &App) -> gpui::FocusHandle {
self.focus_handle.clone()
}
}
impl Render for Settings {
fn render(&mut self, _window: &mut gpui::Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.size_full()
.flex()
.items_center()
.justify_center()
.child("Settings")
}
}

View File

@@ -1,5 +1,5 @@
use app_state::registry::AppRegistry; use app_state::registry::AppRegistry;
use chat::room::Room; use chat_state::room::Room;
use common::{ use common::{
profile::NostrProfile, profile::NostrProfile,
utils::{random_name, room_hash}, utils::{random_name, room_hash},

View File

@@ -1,5 +1,5 @@
use crate::views::app::{AddPanel, PanelKind}; use crate::views::app::{AddPanel, PanelKind};
use chat::registry::ChatRegistry; use chat_state::registry::ChatRegistry;
use common::utils::message_ago; use common::utils::message_ago;
use gpui::{ use gpui::{
div, img, percentage, prelude::FluentBuilder, px, Context, InteractiveElement, IntoElement, div, img, percentage, prelude::FluentBuilder, px, Context, InteractiveElement, IntoElement,
@@ -104,10 +104,7 @@ impl Inbox {
fn action(&self, id: u64, window: &mut Window, cx: &mut Context<Self>) { fn action(&self, id: u64, window: &mut Window, cx: &mut Context<Self>) {
window.dispatch_action( window.dispatch_action(
Box::new(AddPanel { Box::new(AddPanel::new(PanelKind::Room(id), DockPlacement::Center)),
panel: PanelKind::Room(id),
position: DockPlacement::Center,
}),
cx, cx,
); );
} }

View File

@@ -1,5 +1,5 @@
use crate::views::sidebar::inbox::Inbox; use crate::views::sidebar::inbox::Inbox;
use chat::registry::ChatRegistry; use chat_state::registry::ChatRegistry;
use compose::Compose; use compose::Compose;
use gpui::{ use gpui::{
div, px, AnyElement, App, AppContext, BorrowAppContext, Context, Entity, EntityId, div, px, AnyElement, App, AppContext, BorrowAppContext, Context, Entity, EntityId,
@@ -21,7 +21,7 @@ mod inbox;
pub struct Sidebar { pub struct Sidebar {
// Panel // Panel
name: SharedString, name: SharedString,
closeable: bool, closable: bool,
zoomable: bool, zoomable: bool,
focus_handle: FocusHandle, focus_handle: FocusHandle,
// Dock // Dock
@@ -39,7 +39,7 @@ impl Sidebar {
Self { Self {
name: "Sidebar".into(), name: "Sidebar".into(),
closeable: true, closable: true,
zoomable: true, zoomable: true,
focus_handle: cx.focus_handle(), focus_handle: cx.focus_handle(),
view_id: cx.entity().entity_id(), view_id: cx.entity().entity_id(),
@@ -93,8 +93,8 @@ impl Panel for Sidebar {
self.name.clone().into_any_element() self.name.clone().into_any_element()
} }
fn closeable(&self, _cx: &App) -> bool { fn closable(&self, _cx: &App) -> bool {
self.closeable self.closable
} }
fn zoomable(&self, _cx: &App) -> bool { fn zoomable(&self, _cx: &App) -> bool {

View File

@@ -12,7 +12,7 @@ use ui::{
pub struct WelcomePanel { pub struct WelcomePanel {
name: SharedString, name: SharedString,
closeable: bool, closable: bool,
zoomable: bool, zoomable: bool,
focus_handle: FocusHandle, focus_handle: FocusHandle,
} }
@@ -25,7 +25,7 @@ impl WelcomePanel {
fn view(_window: &mut Window, cx: &mut Context<Self>) -> Self { fn view(_window: &mut Window, cx: &mut Context<Self>) -> Self {
Self { Self {
name: "Welcome".into(), name: "Welcome".into(),
closeable: true, closable: true,
zoomable: true, zoomable: true,
focus_handle: cx.focus_handle(), focus_handle: cx.focus_handle(),
} }
@@ -41,8 +41,8 @@ impl Panel for WelcomePanel {
self.name.clone().into_any_element() self.name.clone().into_any_element()
} }
fn closeable(&self, _cx: &App) -> bool { fn closable(&self, _cx: &App) -> bool {
self.closeable self.closable
} }
fn zoomable(&self, _cx: &App) -> bool { fn zoomable(&self, _cx: &App) -> bool {

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "chat" name = "chat_state"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
publish = false publish = false

View File

@@ -244,7 +244,8 @@ impl Dock {
.right(px(1.)) .right(px(1.))
.h_full() .h_full()
.w(HANDLE_SIZE) .w(HANDLE_SIZE)
.py_10() .pt_12()
.pb_4()
}) })
.when(self.placement.is_right(), |this| { .when(self.placement.is_right(), |this| {
this.cursor_col_resize() this.cursor_col_resize()
@@ -252,7 +253,8 @@ impl Dock {
.left(px(1.)) .left(px(1.))
.h_full() .h_full()
.w(HANDLE_SIZE) .w(HANDLE_SIZE)
.py_10() .pt_12()
.pb_4()
}) })
.when(self.placement.is_bottom(), |this| { .when(self.placement.is_bottom(), |this| {
this.cursor_row_resize() this.cursor_row_resize()

View File

@@ -5,7 +5,7 @@ use crate::dock_area::{
tab_panel::TabPanel, tab_panel::TabPanel,
}; };
use gpui::{ use gpui::{
actions, canvas, div, prelude::FluentBuilder, AnyElement, AnyView, App, AppContext, Axis, actions, canvas, div, prelude::FluentBuilder, px, AnyElement, AnyView, App, AppContext, Axis,
Bounds, Context, Edges, Entity, EntityId, EventEmitter, InteractiveElement as _, IntoElement, Bounds, Context, Edges, Entity, EntityId, EventEmitter, InteractiveElement as _, IntoElement,
ParentElement as _, Pixels, Render, SharedString, Styled, Subscription, WeakEntity, Window, ParentElement as _, Pixels, Render, SharedString, Styled, Subscription, WeakEntity, Window,
}; };
@@ -543,7 +543,7 @@ impl DockArea {
} else { } else {
self.set_left_dock( self.set_left_dock(
DockItem::tabs(vec![panel], None, &weak_self, window, cx), DockItem::tabs(vec![panel], None, &weak_self, window, cx),
None, Some(px(320.)),
true, true,
window, window,
cx, cx,
@@ -569,7 +569,7 @@ impl DockArea {
} else { } else {
self.set_right_dock( self.set_right_dock(
DockItem::tabs(vec![panel], None, &weak_self, window, cx), DockItem::tabs(vec![panel], None, &weak_self, window, cx),
None, Some(px(320.)),
true, true,
window, window,
cx, cx,

View File

@@ -42,7 +42,7 @@ pub trait Panel: EventEmitter<PanelEvent> + Render + Focusable {
} }
/// Whether the panel can be closed, default is `true`. /// Whether the panel can be closed, default is `true`.
fn closeable(&self, _cx: &App) -> bool { fn closable(&self, _cx: &App) -> bool {
true true
} }
@@ -66,7 +66,7 @@ pub trait PanelView: 'static + Send + Sync {
fn panel_id(&self, cx: &App) -> SharedString; fn panel_id(&self, cx: &App) -> SharedString;
fn panel_facepile(&self, cx: &App) -> Option<Vec<String>>; fn panel_facepile(&self, cx: &App) -> Option<Vec<String>>;
fn title(&self, cx: &App) -> AnyElement; fn title(&self, cx: &App) -> AnyElement;
fn closeable(&self, cx: &App) -> bool; fn closable(&self, cx: &App) -> bool;
fn zoomable(&self, cx: &App) -> bool; fn zoomable(&self, cx: &App) -> bool;
fn popup_menu(&self, menu: PopupMenu, cx: &App) -> PopupMenu; fn popup_menu(&self, menu: PopupMenu, cx: &App) -> PopupMenu;
fn toolbar_buttons(&self, window: &Window, cx: &App) -> Vec<Button>; fn toolbar_buttons(&self, window: &Window, cx: &App) -> Vec<Button>;
@@ -87,8 +87,8 @@ impl<T: Panel> PanelView for Entity<T> {
self.read(cx).title(cx) self.read(cx).title(cx)
} }
fn closeable(&self, cx: &App) -> bool { fn closable(&self, cx: &App) -> bool {
self.read(cx).closeable(cx) self.read(cx).closable(cx)
} }
fn zoomable(&self, cx: &App) -> bool { fn zoomable(&self, cx: &App) -> bool {

View File

@@ -89,14 +89,14 @@ impl Panel for TabPanel {
.unwrap_or("Empty Tab".into_any_element()) .unwrap_or("Empty Tab".into_any_element())
} }
fn closeable(&self, cx: &App) -> bool { fn closable(&self, cx: &App) -> bool {
if !self.closeable { if !self.closeable {
return false; return false;
} }
self.active_panel() self.active_panel()
.map(|panel| panel.closeable(cx)) .map(|panel| panel.closable(cx))
.unwrap_or(false) .unwrap_or(true)
} }
fn zoomable(&self, cx: &App) -> bool { fn zoomable(&self, cx: &App) -> bool {
@@ -409,6 +409,7 @@ impl TabPanel {
} }
let dock_area = self.dock_area.upgrade()?.read(cx); let dock_area = self.dock_area.upgrade()?.read(cx);
if !dock_area.is_dock_collapsible(placement, cx) { if !dock_area.is_dock_collapsible(placement, cx) {
return None; return None;
} }
@@ -651,6 +652,7 @@ impl TabPanel {
.h_full() .h_full()
.flex_grow() .flex_grow()
.min_w_16() .min_w_16()
.rounded(px(cx.theme().radius))
.when(state.droppable, |this| { .when(state.droppable, |this| {
this.drag_over::<DragPanel>(|this, _, _, cx| { this.drag_over::<DragPanel>(|this, _, _, cx| {
this.bg(cx.theme().base.step(cx, ColorScaleStep::TWO)) this.bg(cx.theme().base.step(cx, ColorScaleStep::TWO))
@@ -1013,7 +1015,7 @@ impl Render for TabPanel {
let focus_handle = self.focus_handle(cx); let focus_handle = self.focus_handle(cx);
let mut state = TabState { let mut state = TabState {
closeable: self.closeable(cx), closeable: self.closable(cx),
draggable: self.draggable(cx), draggable: self.draggable(cx),
droppable: self.droppable(cx), droppable: self.droppable(cx),
zoomable: self.zoomable(cx), zoomable: self.zoomable(cx),

View File

@@ -51,7 +51,8 @@ impl RenderOnce for ResizeHandle {
.left(px(-1.)) .left(px(-1.))
.w(HANDLE_SIZE) .w(HANDLE_SIZE)
.h_full() .h_full()
.py_10() .pt_12()
.pb_4()
}) })
.when(self.axis.is_vertical(), |this| { .when(self.axis.is_vertical(), |this| {
this.cursor_row_resize() this.cursor_row_resize()
@@ -59,7 +60,7 @@ impl RenderOnce for ResizeHandle {
.left_0() .left_0()
.w_full() .w_full()
.h(HANDLE_SIZE) .h(HANDLE_SIZE)
.px_10() .px_6()
}) })
.child( .child(
div() div()

View File

@@ -1,7 +1,7 @@
use crate::theme::{scale::ColorScaleStep, ActiveTheme}; use crate::theme::{scale::ColorScaleStep, ActiveTheme};
use gpui::{ use gpui::{
div, px, App, AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, div, px, relative, App, AppContext, Context, Entity, IntoElement, ParentElement, Render,
Styled, Window, SharedString, Styled, Window,
}; };
pub struct Tooltip { pub struct Tooltip {
@@ -21,13 +21,15 @@ impl Render for Tooltip {
div() div()
.font_family(".SystemUIFont") .font_family(".SystemUIFont")
.m_3() .m_3()
.bg(cx.theme().base.step(cx, ColorScaleStep::TWELVE)) .border_1()
.text_color(cx.theme().base.step(cx, ColorScaleStep::ONE)) .border_color(cx.theme().base.step(cx, ColorScaleStep::FIVE))
.bg(cx.theme().base.step(cx, ColorScaleStep::THREE))
.shadow_md() .shadow_md()
.rounded(px(6.)) .rounded(px(6.))
.py_0p5() .py_1()
.px_2() .px_2()
.text_sm() .text_xs()
.line_height(relative(1.))
.child(self.text.clone()), .child(self.text.clone()),
) )
} }