wip: refactor

This commit is contained in:
2024-12-10 09:07:17 +07:00
parent ab8a7acf4a
commit 9f0e367527
5 changed files with 117 additions and 136 deletions

194
Cargo.lock generated
View File

@@ -67,12 +67,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1"
[[package]]
name = "allocator-api2"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]] [[package]]
name = "android-tzdata" name = "android-tzdata"
version = "0.1.1" version = "0.1.1"
@@ -216,7 +210,7 @@ checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec"
dependencies = [ dependencies = [
"async-task", "async-task",
"concurrent-queue", "concurrent-queue",
"fastrand 2.2.0", "fastrand 2.3.0",
"futures-lite 2.5.0", "futures-lite 2.5.0",
"slab", "slab",
] ]
@@ -277,7 +271,7 @@ dependencies = [
"futures-lite 2.5.0", "futures-lite 2.5.0",
"parking", "parking",
"polling 3.7.4", "polling 3.7.4",
"rustix 0.38.41", "rustix 0.38.42",
"slab", "slab",
"tracing", "tracing",
"windows-sys 0.59.0", "windows-sys 0.59.0",
@@ -338,7 +332,7 @@ dependencies = [
"cfg-if", "cfg-if",
"event-listener 3.1.0", "event-listener 3.1.0",
"futures-lite 1.13.0", "futures-lite 1.13.0",
"rustix 0.38.41", "rustix 0.38.42",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
@@ -357,7 +351,7 @@ dependencies = [
"cfg-if", "cfg-if",
"event-listener 5.3.1", "event-listener 5.3.1",
"futures-lite 2.5.0", "futures-lite 2.5.0",
"rustix 0.38.41", "rustix 0.38.42",
"tracing", "tracing",
] ]
@@ -384,7 +378,7 @@ dependencies = [
"cfg-if", "cfg-if",
"futures-core", "futures-core",
"futures-io", "futures-io",
"rustix 0.38.41", "rustix 0.38.42",
"signal-hook-registry", "signal-hook-registry",
"slab", "slab",
"windows-sys 0.59.0", "windows-sys 0.59.0",
@@ -833,7 +827,7 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"log", "log",
"polling 3.7.4", "polling 3.7.4",
"rustix 0.38.41", "rustix 0.38.42",
"slab", "slab",
"thiserror 1.0.69", "thiserror 1.0.69",
] ]
@@ -845,7 +839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
dependencies = [ dependencies = [
"calloop", "calloop",
"rustix 0.38.41", "rustix 0.38.42",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
] ]
@@ -879,9 +873,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.2" version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -951,9 +945,9 @@ dependencies = [
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.38" version = "0.4.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
@@ -1058,7 +1052,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"rustc-hash 1.1.0", "rustc-hash 1.1.0",
] ]
@@ -1383,7 +1377,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1666,15 +1660,15 @@ dependencies = [
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.2.0" version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]] [[package]]
name = "fdeflate" name = "fdeflate"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb" checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
dependencies = [ dependencies = [
"simd-adler32", "simd-adler32",
] ]
@@ -1740,12 +1734,6 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foldhash"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2"
[[package]] [[package]]
name = "font-kit" name = "font-kit"
version = "0.14.1" version = "0.14.1"
@@ -1941,7 +1929,7 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1"
dependencies = [ dependencies = [
"fastrand 2.2.0", "fastrand 2.3.0",
"futures-core", "futures-core",
"futures-io", "futures-io",
"parking", "parking",
@@ -2125,7 +2113,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@@ -2210,7 +2198,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#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2263,11 +2251,6 @@ name = "hashbrown"
version = "0.15.2" version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash",
]
[[package]] [[package]]
name = "heck" name = "heck"
@@ -2426,7 +2409,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#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -2855,9 +2838,9 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.74" version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"wasm-bindgen", "wasm-bindgen",
@@ -2929,9 +2912,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.167" version = "0.2.168"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
[[package]] [[package]]
name = "libdbus-sys" name = "libdbus-sys"
@@ -3084,15 +3067,6 @@ dependencies = [
"imgref", "imgref",
] ]
[[package]]
name = "lru"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
dependencies = [
"hashbrown 0.15.2",
]
[[package]] [[package]]
name = "mac" name = "mac"
version = "0.1.1" version = "0.1.1"
@@ -3131,7 +3105,7 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen", "bindgen",
@@ -3309,7 +3283,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr" name = "nostr"
version = "0.37.0" version = "0.37.0"
source = "git+https://github.com/rust-nostr/nostr#d6e354436f139b6fb24049b941bb548a08e7f75c" source = "git+https://github.com/rust-nostr/nostr#0d12a1d44eaa223d065d4136179296124d955765"
dependencies = [ dependencies = [
"aes", "aes",
"async-trait", "async-trait",
@@ -3340,35 +3314,30 @@ dependencies = [
[[package]] [[package]]
name = "nostr-database" name = "nostr-database"
version = "0.37.0" version = "0.37.0"
source = "git+https://github.com/rust-nostr/nostr#d6e354436f139b6fb24049b941bb548a08e7f75c" source = "git+https://github.com/rust-nostr/nostr#0d12a1d44eaa223d065d4136179296124d955765"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"flatbuffers", "flatbuffers",
"lru",
"nostr", "nostr",
"thiserror 1.0.69",
"tokio", "tokio",
"tracing",
] ]
[[package]] [[package]]
name = "nostr-lmdb" name = "nostr-lmdb"
version = "0.37.0" version = "0.37.0"
source = "git+https://github.com/rust-nostr/nostr#d6e354436f139b6fb24049b941bb548a08e7f75c" source = "git+https://github.com/rust-nostr/nostr#0d12a1d44eaa223d065d4136179296124d955765"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"heed", "heed",
"nostr", "nostr",
"nostr-database", "nostr-database",
"thiserror 1.0.69",
"tokio", "tokio",
"tracing",
] ]
[[package]] [[package]]
name = "nostr-relay-pool" name = "nostr-relay-pool"
version = "0.37.0" version = "0.37.0"
source = "git+https://github.com/rust-nostr/nostr#d6e354436f139b6fb24049b941bb548a08e7f75c" source = "git+https://github.com/rust-nostr/nostr#0d12a1d44eaa223d065d4136179296124d955765"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"async-wsocket", "async-wsocket",
@@ -3377,16 +3346,14 @@ dependencies = [
"negentropy 0.4.3", "negentropy 0.4.3",
"nostr", "nostr",
"nostr-database", "nostr-database",
"thiserror 1.0.69",
"tokio", "tokio",
"tokio-stream",
"tracing", "tracing",
] ]
[[package]] [[package]]
name = "nostr-sdk" name = "nostr-sdk"
version = "0.37.0" version = "0.37.0"
source = "git+https://github.com/rust-nostr/nostr#d6e354436f139b6fb24049b941bb548a08e7f75c" source = "git+https://github.com/rust-nostr/nostr#0d12a1d44eaa223d065d4136179296124d955765"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"lnurl-pay", "lnurl-pay",
@@ -3403,11 +3370,10 @@ dependencies = [
[[package]] [[package]]
name = "nostr-zapper" name = "nostr-zapper"
version = "0.37.0" version = "0.37.0"
source = "git+https://github.com/rust-nostr/nostr#d6e354436f139b6fb24049b941bb548a08e7f75c" source = "git+https://github.com/rust-nostr/nostr#0d12a1d44eaa223d065d4136179296124d955765"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"nostr", "nostr",
"thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -3818,7 +3784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
dependencies = [ dependencies = [
"atomic-waker", "atomic-waker",
"fastrand 2.2.0", "fastrand 2.3.0",
"futures-io", "futures-io",
] ]
@@ -3830,9 +3796,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]] [[package]]
name = "png" name = "png"
version = "0.17.14" version = "0.17.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52f9d46a34a05a6a57566bc2bfae066ef07585a6e3fa30fbbdff5936380623f0" checksum = "b67582bd5b65bdff614270e2ea89a1cf15bef71245cc1e5f7ea126977144211d"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"crc32fast", "crc32fast",
@@ -3867,7 +3833,7 @@ dependencies = [
"concurrent-queue", "concurrent-queue",
"hermit-abi 0.4.0", "hermit-abi 0.4.0",
"pin-project-lite", "pin-project-lite",
"rustix 0.38.41", "rustix 0.38.42",
"tracing", "tracing",
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
@@ -3999,7 +3965,7 @@ dependencies = [
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
"rustls", "rustls",
"socket2 0.5.8", "socket2 0.5.8",
"thiserror 2.0.4", "thiserror 2.0.6",
"tokio", "tokio",
"tracing", "tracing",
] ]
@@ -4018,7 +3984,7 @@ dependencies = [
"rustls", "rustls",
"rustls-pki-types", "rustls-pki-types",
"slab", "slab",
"thiserror 2.0.4", "thiserror 2.0.6",
"tinyvec", "tinyvec",
"tracing", "tracing",
"web-time", "web-time",
@@ -4026,9 +3992,9 @@ dependencies = [
[[package]] [[package]]
name = "quinn-udp" name = "quinn-udp"
version = "0.5.7" version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527"
dependencies = [ dependencies = [
"cfg_aliases 0.2.1", "cfg_aliases 0.2.1",
"libc", "libc",
@@ -4204,7 +4170,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
] ]
@@ -4331,7 +4297,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#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -4520,15 +4486,15 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.41" version = "0.38.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.4.14", "linux-raw-sys 0.4.14",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -4799,7 +4765,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#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@@ -5142,7 +5108,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#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@@ -5380,9 +5346,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand 2.2.0", "fastrand 2.3.0",
"once_cell", "once_cell",
"rustix 0.38.41", "rustix 0.38.42",
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
@@ -5417,11 +5383,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.4" version = "2.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47"
dependencies = [ dependencies = [
"thiserror-impl 2.0.4", "thiserror-impl 2.0.6",
] ]
[[package]] [[package]]
@@ -5437,9 +5403,9 @@ dependencies = [
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.4" version = "2.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -5578,17 +5544,6 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "tokio-stream"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
]
[[package]] [[package]]
name = "tokio-tungstenite" name = "tokio-tungstenite"
version = "0.24.0" version = "0.24.0"
@@ -5818,7 +5773,7 @@ dependencies = [
[[package]] [[package]]
name = "ui" name = "ui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/lumehq/gpui-component#7000e40e6a60e52bea58aa967496d27809000ea3" source = "git+https://github.com/lumehq/gpui-component#ca5232d1e7e66defe02271781ceadf2a81ed0e3d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@@ -6009,7 +5964,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#cf4e847c62e435a8c2daa8d750386609c9b67461" source = "git+https://github.com/zed-industries/zed#8a85d6ef96cc9d38e1c0e7e420765cd4b31b6954"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs 1.6.0", "async-fs 1.6.0",
@@ -6159,9 +6114,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.97" version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"once_cell", "once_cell",
@@ -6170,13 +6125,12 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.97" version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"log", "log",
"once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn 2.0.90",
@@ -6185,9 +6139,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.47" version = "0.4.49"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@@ -6198,9 +6152,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.97" version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@@ -6208,9 +6162,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.97" version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -6221,9 +6175,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.97" version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6"
[[package]] [[package]]
name = "wasm-streams" name = "wasm-streams"
@@ -6246,7 +6200,7 @@ checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6"
dependencies = [ dependencies = [
"cc", "cc",
"downcast-rs", "downcast-rs",
"rustix 0.38.41", "rustix 0.38.42",
"scoped-tls", "scoped-tls",
"smallvec", "smallvec",
"wayland-sys", "wayland-sys",
@@ -6259,7 +6213,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"rustix 0.38.41", "rustix 0.38.42",
"wayland-backend", "wayland-backend",
"wayland-scanner", "wayland-scanner",
] ]
@@ -6270,7 +6224,7 @@ version = "0.31.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c" checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c"
dependencies = [ dependencies = [
"rustix 0.38.41", "rustix 0.38.42",
"wayland-client", "wayland-client",
"xcursor", "xcursor",
] ]
@@ -6325,9 +6279,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.74" version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@@ -6689,7 +6643,7 @@ dependencies = [
"as-raw-xcb-connection", "as-raw-xcb-connection",
"gethostname", "gethostname",
"libc", "libc",
"rustix 0.38.41", "rustix 0.38.42",
"x11rb-protocol", "x11rb-protocol",
] ]

View File

@@ -88,10 +88,7 @@ impl AppView {
DockItem::split_with_sizes( DockItem::split_with_sizes(
Axis::Vertical, Axis::Vertical,
vec![DockItem::tabs( vec![DockItem::tabs(
vec![ vec![Arc::new(WelcomePanel::new(cx))],
Arc::new(WelcomePanel::new(cx)),
// TODO: add chat block
],
None, None,
dock_area, dock_area,
cx, cx,

View File

View File

@@ -1,13 +1,16 @@
use components::{ use components::{
button::Button, button::Button,
button_group::ButtonGroup,
dock::{DockItemState, Panel, PanelEvent, TitleStyle}, dock::{DockItemState, Panel, PanelEvent, TitleStyle},
input::TextInput,
popup_menu::PopupMenu, popup_menu::PopupMenu,
theme::{ActiveTheme, Colorize}, Sizable,
StyledExt,
}; };
use gpui::*; use gpui::*;
use nostr_sdk::*; use nostr_sdk::*;
pub mod list;
pub struct ChatPanel { pub struct ChatPanel {
// Panel // Panel
name: SharedString, name: SharedString,
@@ -16,16 +19,24 @@ pub struct ChatPanel {
focus_handle: FocusHandle, focus_handle: FocusHandle,
// Chat Room // Chat Room
receiver: PublicKey, receiver: PublicKey,
input: View<TextInput>,
} }
impl ChatPanel { impl ChatPanel {
pub fn new(receiver: PublicKey, cx: &mut WindowContext) -> View<Self> { pub fn new(receiver: PublicKey, cx: &mut WindowContext) -> View<Self> {
let input = cx.new_view(TextInput::new);
input.update(cx, |input, _cx| {
input.set_placeholder("Message");
});
cx.new_view(|cx| Self { cx.new_view(|cx| Self {
name: "Chat".into(), name: "Chat".into(),
closeable: true, closeable: true,
zoomable: true, zoomable: true,
focus_handle: cx.focus_handle(), focus_handle: cx.focus_handle(),
receiver, receiver,
input,
}) })
} }
} }
@@ -73,15 +84,34 @@ impl FocusableView for ChatPanel {
} }
impl Render for ChatPanel { impl Render for ChatPanel {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement { fn render(&mut self, _cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {
div() div()
.size_full() .size_full()
.flex() .flex()
.items_center() .flex_col()
.justify_center() .child(
.child(self.receiver.to_hex()) div()
.text_color(cx.theme().muted.darken(0.1)) .flex_1()
.font_black() .flex()
.text_sm() .items_center()
.justify_center()
.child(self.receiver.to_hex()),
)
.child(
div()
.flex_shrink_0()
.flex()
.items_center()
.gap_2()
.px_2()
.h_11()
.child(self.input.clone())
.child(
ButtonGroup::new("actions")
.large()
.child(Button::new("upload").label("Upload"))
.child(Button::new("send").label("Send")),
),
)
} }
} }

View File

@@ -35,9 +35,9 @@ impl Inbox {
if let Ok(events) = client.database().query(vec![filter]).await { if let Ok(events) = client.database().query(vec![filter]).await {
events events
.into_iter() .into_iter()
.sorted_by_key(|ev| Reverse(ev.created_at)) .filter(|ev| ev.pubkey != public_key) // Filter messages from current user
.filter(|ev| ev.pubkey != public_key) .unique_by(|ev| ev.pubkey) // Get unique list
.unique_by(|ev| ev.pubkey) .sorted_by_key(|ev| Reverse(ev.created_at)) // Sort by created at
.collect::<Vec<_>>() .collect::<Vec<_>>()
} else { } else {
Vec::new() Vec::new()