Redesign for the v1 stable release #3

Merged
reya merged 30 commits from v1-redesign into master 2026-02-04 01:43:24 +00:00
11 changed files with 169 additions and 288 deletions
Showing only changes of commit 6df08a9e48 - Show all commits

157
Cargo.lock generated
View File

@@ -102,11 +102,11 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "ar_archive_writer"
version = "0.2.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c269894b6fe5e9d7ada0cf69b5bf847ff35bc25fc271f08e1d080fce80339a"
checksum = "7eb93bbb63b9c227414f6eb3a0adfddca591a8ce1e9b60661bb08969b87e340b"
dependencies = [
"object 0.32.2",
"object",
]
[[package]]
@@ -567,9 +567,9 @@ dependencies = [
[[package]]
name = "aws-lc-rs"
version = "1.15.3"
version = "1.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e84ce723ab67259cfeb9877c6a639ee9eb7a27b28123abd71db7f0d5d0cc9d86"
checksum = "7b7b6141e96a8c160799cc2d5adecd5cbbe5054cb8c7c4af53da0f83bb7ad256"
dependencies = [
"aws-lc-sys",
"zeroize",
@@ -577,9 +577,9 @@ dependencies = [
[[package]]
name = "aws-lc-sys"
version = "0.36.0"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a442ece363113bd4bd4c8b18977a7798dd4d3c3383f34fb61936960e8f4ad8"
checksum = "5c34dda4df7017c8db52132f0f8a2e0f8161649d15723ed63fc00c82d0f2081a"
dependencies = [
"cc",
"cmake",
@@ -597,7 +597,7 @@ dependencies = [
"cfg-if",
"libc",
"miniz_oxide",
"object 0.37.3",
"object",
"rustc-demangle",
"windows-link 0.2.1",
]
@@ -934,9 +934,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.53"
version = "1.2.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932"
checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583"
dependencies = [
"find-msvc-tools",
"jobserver",
@@ -1180,7 +1180,7 @@ dependencies = [
[[package]]
name = "collections"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"indexmap",
"rustc-hash 2.1.1",
@@ -1619,7 +1619,7 @@ dependencies = [
[[package]]
name = "derive_refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"proc-macro2",
"quote",
@@ -1933,9 +1933,9 @@ dependencies = [
[[package]]
name = "euclid"
version = "0.22.11"
version = "0.22.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48"
checksum = "df61bf483e837f88d5c2291dcf55c67be7e676b3a51acc48db3a7b163b91ed63"
dependencies = [
"num-traits",
]
@@ -2542,7 +2542,7 @@ dependencies = [
[[package]]
name = "gpui"
version = "0.2.2"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"anyhow",
"as-raw-xcb-connection",
@@ -2644,7 +2644,7 @@ dependencies = [
[[package]]
name = "gpui_macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -2655,7 +2655,7 @@ dependencies = [
[[package]]
name = "gpui_tokio"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"anyhow",
"gpui",
@@ -2877,7 +2877,7 @@ dependencies = [
[[package]]
name = "http_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"anyhow",
"async-compression",
@@ -2902,7 +2902,7 @@ dependencies = [
[[package]]
name = "http_client_tls"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"rustls",
"rustls-platform-verifier",
@@ -3142,7 +3142,7 @@ dependencies = [
"rgb",
"tiff",
"zune-core 0.5.1",
"zune-jpeg 0.5.10",
"zune-jpeg 0.5.11",
]
[[package]]
@@ -3444,9 +3444,9 @@ dependencies = [
[[package]]
name = "libm"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
[[package]]
name = "libredox"
@@ -3663,7 +3663,7 @@ dependencies = [
[[package]]
name = "media"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"anyhow",
"bindgen",
@@ -3903,7 +3903,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]]
name = "nostr"
version = "0.44.1"
source = "git+https://github.com/rust-nostr/nostr#6d776ad79052ec908ffdabfe4229281d917abb59"
source = "git+https://github.com/rust-nostr/nostr#07daf26c737a712b74c8edb9a9697929f4de8b21"
dependencies = [
"aes",
"base64",
@@ -3928,11 +3928,11 @@ dependencies = [
[[package]]
name = "nostr-connect"
version = "0.44.0"
source = "git+https://github.com/rust-nostr/nostr#6d776ad79052ec908ffdabfe4229281d917abb59"
source = "git+https://github.com/rust-nostr/nostr#07daf26c737a712b74c8edb9a9697929f4de8b21"
dependencies = [
"async-utility",
"nostr",
"nostr-relay-pool",
"nostr-sdk",
"tokio",
"tracing",
]
@@ -3940,7 +3940,7 @@ dependencies = [
[[package]]
name = "nostr-database"
version = "0.44.0"
source = "git+https://github.com/rust-nostr/nostr#6d776ad79052ec908ffdabfe4229281d917abb59"
source = "git+https://github.com/rust-nostr/nostr#07daf26c737a712b74c8edb9a9697929f4de8b21"
dependencies = [
"btreecap",
"flatbuffers",
@@ -3952,7 +3952,7 @@ dependencies = [
[[package]]
name = "nostr-gossip"
version = "0.44.0"
source = "git+https://github.com/rust-nostr/nostr#6d776ad79052ec908ffdabfe4229281d917abb59"
source = "git+https://github.com/rust-nostr/nostr#07daf26c737a712b74c8edb9a9697929f4de8b21"
dependencies = [
"nostr",
]
@@ -3960,7 +3960,7 @@ dependencies = [
[[package]]
name = "nostr-lmdb"
version = "0.44.0"
source = "git+https://github.com/rust-nostr/nostr#6d776ad79052ec908ffdabfe4229281d917abb59"
source = "git+https://github.com/rust-nostr/nostr#07daf26c737a712b74c8edb9a9697929f4de8b21"
dependencies = [
"async-utility",
"flume",
@@ -3972,32 +3972,20 @@ dependencies = [
]
[[package]]
name = "nostr-relay-pool"
version = "0.44.0"
source = "git+https://github.com/rust-nostr/nostr#6d776ad79052ec908ffdabfe4229281d917abb59"
name = "nostr-sdk"
version = "0.44.1"
source = "git+https://github.com/rust-nostr/nostr#07daf26c737a712b74c8edb9a9697929f4de8b21"
dependencies = [
"async-utility",
"async-wsocket",
"atomic-destructor",
"futures",
"hex",
"lru",
"negentropy",
"nostr",
"nostr-database",
"tokio",
"tracing",
]
[[package]]
name = "nostr-sdk"
version = "0.44.1"
source = "git+https://github.com/rust-nostr/nostr#6d776ad79052ec908ffdabfe4229281d917abb59"
dependencies = [
"async-utility",
"nostr",
"nostr-database",
"nostr-gossip",
"nostr-relay-pool",
"tokio",
"tracing",
]
@@ -4259,15 +4247,6 @@ dependencies = [
"objc",
]
[[package]]
name = "object"
version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
dependencies = [
"memchr",
]
[[package]]
name = "object"
version = "0.37.3"
@@ -4285,9 +4264,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "oneshot"
version = "0.1.11"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ce411919553d3f9fa53a0880544cda985a112117a0444d5ff1e870a893d6ea"
checksum = "3ce66197e99546da6c6d991285f605192e794ceae69686c17163844a7bf8fcc2"
[[package]]
name = "oo7"
@@ -4375,9 +4354,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "openssl-probe"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f50d9b3dabb09ecd771ad0aa242ca6894994c130308ca3d7684634df8037391"
checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
[[package]]
name = "openssl-sys"
@@ -4523,7 +4502,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "perf"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"collections",
"serde",
@@ -4777,9 +4756,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.105"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [
"unicode-ident",
]
@@ -4805,9 +4784,9 @@ dependencies = [
[[package]]
name = "psm"
version = "0.1.28"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d11f2fedc3b7dafdc2851bc52f277377c5473d378859be234bc7ebb593144d01"
checksum = "1fa96cb91275ed31d6da3e983447320c4eb219ac180fa1679a0889ff32861e2d"
dependencies = [
"ar_archive_writer",
"cc",
@@ -4921,9 +4900,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.43"
version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a"
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
dependencies = [
"proc-macro2",
]
@@ -5158,7 +5137,7 @@ dependencies = [
[[package]]
name = "refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"derive_refineable",
]
@@ -5257,7 +5236,7 @@ dependencies = [
[[package]]
name = "reqwest_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"anyhow",
"bytes",
@@ -5311,7 +5290,7 @@ dependencies = [
[[package]]
name = "rope"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"arrayvec",
"log",
@@ -5449,7 +5428,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63"
dependencies = [
"openssl-probe 0.2.0",
"openssl-probe 0.2.1",
"rustls-pki-types",
"schannel",
"security-framework 3.5.1",
@@ -5590,7 +5569,7 @@ dependencies = [
[[package]]
name = "scheduler"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"async-task",
"backtrace",
@@ -6023,9 +6002,9 @@ checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"
[[package]]
name = "socket2"
version = "0.6.1"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881"
checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0"
dependencies = [
"libc",
"windows-sys 0.60.2",
@@ -6182,7 +6161,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "sum_tree"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"arrayvec",
"log",
@@ -7123,7 +7102,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "util"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"anyhow",
"async-fs",
@@ -7140,6 +7119,7 @@ dependencies = [
"log",
"mach2",
"nix 0.29.0",
"percent-encoding",
"regex",
"rust-embed",
"schemars",
@@ -7152,6 +7132,7 @@ dependencies = [
"tempfile",
"tendril",
"unicase",
"url",
"walkdir",
"which",
]
@@ -7159,7 +7140,7 @@ dependencies = [
[[package]]
name = "util_macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"perf",
"quote",
@@ -7168,9 +7149,9 @@ dependencies = [
[[package]]
name = "uuid"
version = "1.19.0"
version = "1.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f"
dependencies = [
"getrandom 0.3.4",
"js-sys",
@@ -8366,9 +8347,9 @@ dependencies = [
[[package]]
name = "zbus"
version = "5.13.1"
version = "5.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17f79257df967b6779afa536788657777a0001f5b42524fcaf5038d4344df40b"
checksum = "1bfeff997a0aaa3eb20c4652baf788d2dfa6d2839a0ead0b3ff69ce2f9c4bdd1"
dependencies = [
"async-broadcast",
"async-executor",
@@ -8401,9 +8382,9 @@ dependencies = [
[[package]]
name = "zbus_macros"
version = "5.13.1"
version = "5.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aad23e2d2f91cae771c7af7a630a49e755f1eb74f8a46e9f6d5f7a146edf5a37"
checksum = "0bbd5a90dbe8feee5b13def448427ae314ccd26a49cac47905cafefb9ff846f1"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -8635,7 +8616,7 @@ dependencies = [
[[package]]
name = "zlog"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"anyhow",
"chrono",
@@ -8645,14 +8626,14 @@ dependencies = [
[[package]]
name = "zmij"
version = "1.0.15"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94f63c051f4fe3c1509da62131a678643c5b6fbdc9273b2b79d4378ebda003d2"
checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439"
[[package]]
name = "ztracing"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
dependencies = [
"tracing",
"tracing-subscriber",
@@ -8663,7 +8644,7 @@ dependencies = [
[[package]]
name = "ztracing_macro"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#e476af6417576903700f8a7645a7de3315b5ff6c"
source = "git+https://github.com/zed-industries/zed#aceff52f8a93a31009d6f5284253f0b334a043dc"
[[package]]
name = "zune-core"
@@ -8697,9 +8678,9 @@ dependencies = [
[[package]]
name = "zune-jpeg"
version = "0.5.10"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea2db9186c0a6ad1aa7012046f3fadc8db9001691b367c510f5867f17f975752"
checksum = "2959ca473aae96a14ecedf501d20b3608d2825ba280d5adb57d651721885b0c2"
dependencies = [
"zune-core 0.5.1",
]

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
<path d="M9.8007 10.25C8.74816 10.25 8.16683 11.4713 8.83056 12.2882L11.0301 14.9953C11.5303 15.611 12.4701 15.611 12.9704 14.9953L15.1699 12.2882C15.8336 11.4713 15.2523 10.25 14.1997 10.25H9.8007Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 302 B

0
assets/themes/.keep Normal file
View File

View File

@@ -302,6 +302,11 @@ impl ChatRegistry {
.map(|this| this.downgrade())
}
/// Get all rooms.
pub fn rooms(&self, _cx: &App) -> &Vec<Entity<Room>> {
&self.rooms
}
/// Get all ongoing rooms.
pub fn ongoing_rooms(&self, cx: &App) -> Vec<Entity<Room>> {
self.rooms

View File

@@ -2,12 +2,12 @@ use std::ops::Range;
use std::time::Duration;
use anyhow::{anyhow, Error};
use chat::{ChatEvent, ChatRegistry, Room, RoomKind};
use chat::{ChatEvent, ChatRegistry, Room};
use common::{DebouncedDelay, RenderedTimestamp, TextUtils, BOOTSTRAP_RELAYS, SEARCH_RELAYS};
use dock::panel::{Panel, PanelEvent};
use gpui::prelude::FluentBuilder;
use gpui::{
deferred, div, relative, rems, uniform_list, App, AppContext, Context, Entity, EventEmitter,
deferred, div, rems, uniform_list, App, AppContext, Context, Decorations, Entity, EventEmitter,
FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement, Render,
RetainAllImageCache, SharedString, Styled, Subscription, Task, Window,
};
@@ -17,12 +17,11 @@ use nostr_sdk::prelude::*;
use person::PersonRegistry;
use smallvec::{smallvec, SmallVec};
use state::{NostrRegistry, GIFTWRAP_SUBSCRIPTION};
use theme::{ActiveTheme, TITLEBAR_HEIGHT};
use theme::{ActiveTheme, CLIENT_SIDE_DECORATION_ROUNDING, TITLEBAR_HEIGHT};
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::input::{InputEvent, InputState, TextInput};
use ui::popup_menu::PopupMenuExt;
use ui::{h_flex, v_flex, Icon, IconName, Selectable, Sizable, StyledExt, WindowExtension};
use ui::{h_flex, v_flex, Icon, IconName, Sizable, StyledExt, WindowExtension};
use crate::actions::{RelayStatus, Reload};
use crate::views::compose::compose_button;
@@ -64,16 +63,12 @@ pub struct Sidebar {
/// New request flag
new_request: bool,
/// Current chat room filter
active_filter: Entity<RoomKind>,
/// Event subscriptions
_subscriptions: SmallVec<[Subscription; 2]>,
}
impl Sidebar {
fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let active_filter = cx.new(|_| RoomKind::Ongoing);
let search_results = cx.new(|_| None);
// Define the find input state
@@ -131,7 +126,6 @@ impl Sidebar {
find_debouncer: DebouncedDelay::new(),
finding: false,
new_request: false,
active_filter,
find_input,
search_results,
search_task: None,
@@ -412,19 +406,6 @@ impl Sidebar {
});
}
fn filter(&self, kind: &RoomKind, cx: &Context<Self>) -> bool {
self.active_filter.read(cx) == kind
}
fn set_filter(&mut self, kind: RoomKind, cx: &mut Context<Self>) {
self.active_filter.update(cx, |this, cx| {
*this = kind;
cx.notify();
});
self.new_request = false;
cx.notify();
}
fn open(&mut self, id: u64, window: &mut Window, cx: &mut Context<Self>) {
let chat = ChatRegistry::global(cx);
@@ -536,43 +517,53 @@ impl Sidebar {
});
}
fn list_items(
fn render_list_items(
&self,
rooms: &[Entity<Room>],
range: Range<usize>,
_window: &Window,
cx: &Context<Self>,
) -> Vec<impl IntoElement> {
let mut items = Vec::with_capacity(range.end - range.start);
let chat = ChatRegistry::global(cx);
for ix in range {
let Some(room) = rooms.get(ix) else {
items.push(RoomListItem::new(ix));
continue;
};
// Get all rooms from search results or chat registry
let all_rooms = match self.search_results.read(cx).as_ref() {
Some(results) => results,
None => chat.read(cx).rooms(cx),
};
let this = room.read(cx);
let room_id = this.id;
let member = this.display_member(cx);
// If no rooms are found, return a placeholder element for each index in the range
let Some(visible_rooms) = all_rooms.get(range.clone()) else {
return range
.into_iter()
.map(|ix| RoomListItem::new(ix).into_any_element())
.collect();
};
let handler = cx.listener({
move |this, _, window, cx| {
this.open(room_id, window, cx);
}
});
visible_rooms
.iter()
.enumerate()
.map(|(ix, item)| {
let this = item.read(cx);
let room_id = this.id;
let member = this.display_member(cx);
items.push(
RoomListItem::new(ix)
let handler = cx.listener({
move |this, _ev, window, cx| {
this.open(room_id, window, cx);
}
});
RoomListItem::new(range.start + ix)
.room_id(room_id)
.name(this.display_name(cx))
.avatar(this.display_image(cx))
.public_key(member.public_key())
.kind(this.kind)
.created_at(this.created_at.to_ago())
.on_click(handler),
)
}
items
.on_click(handler)
.into_any_element()
})
.collect()
}
}
@@ -591,10 +582,8 @@ impl Focusable for Sidebar {
}
impl Render for Sidebar {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
const EMPTY_HELP: &str = "Start a conversation with someone to get started.";
const REQUEST_HELP: &str =
"New message requests from people you don't know will appear here.";
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let decorations = window.window_decorations();
let nostr = NostrRegistry::global(cx);
let identity = nostr.read(cx).identity();
@@ -603,15 +592,9 @@ impl Render for Sidebar {
let loading = chat.read(cx).loading();
// Get rooms from either search results or the chat registry
let rooms = if let Some(results) = self.search_results.read(cx).as_ref() {
results.to_owned()
} else {
// Filter rooms based on the active filter
if self.active_filter.read(cx) == &RoomKind::Ongoing {
chat.read(cx).ongoing_rooms(cx)
} else {
chat.read(cx).request_rooms(cx)
}
let rooms = match self.search_results.read(cx).as_ref() {
Some(results) => results,
None => chat.read(cx).rooms(cx),
};
// Get total rooms count
@@ -628,11 +611,18 @@ impl Render for Sidebar {
.image_cache(self.image_cache.clone())
.size_full()
.relative()
.gap_3()
.gap_2()
.bg(cx.theme().surface_background)
.map(|this| match decorations {
Decorations::Server => this,
Decorations::Client { .. } => this
.rounded_tl(CLIENT_SIDE_DECORATION_ROUNDING)
.rounded_bl(CLIENT_SIDE_DECORATION_ROUNDING),
})
// Titlebar
.child(
h_flex()
.px_2p5()
.child(
h_flex()
.w_full()
@@ -643,14 +633,15 @@ impl Render for Sidebar {
let profile = persons.read(cx).get(&public_key, cx);
this.child(
Button::new("user")
.label(profile.name())
.reverse()
.transparent()
.child(Avatar::new(profile.avatar()).size(rems(1.6))),
h_flex()
.gap_1p5()
.text_xs()
.text_color(cx.theme().text_muted)
.child(Avatar::new(profile.avatar()).size(rems(1.25)))
.child(profile.name()),
)
})
.child(div().pr_2p5().child(compose_button())),
.child(compose_button()),
)
.h(TITLEBAR_HEIGHT),
)
@@ -678,132 +669,39 @@ impl Render for Sidebar {
}),
),
)
.when(!loading && total_rooms == 0, |this| {
this.child(deferred(
v_flex()
.py_2()
.px_3()
.items_center()
.justify_center()
.text_center()
.child(
div()
.text_sm()
.font_semibold()
.child(SharedString::from("No conversations")),
)
.child(div().text_xs().text_color(cx.theme().text_muted).child(
SharedString::from("Start a conversation with someone to get started."),
)),
))
})
// Chat Rooms
.child(
v_flex()
.gap_1()
.flex_1()
.px_1p5()
.w_full()
.flex_1()
.gap_1()
.overflow_y_hidden()
.child(
div()
.px_1()
.h_flex()
.gap_2()
.flex_none()
.child(
Button::new("all")
.label("All")
.tooltip("All ongoing conversations")
.small()
.cta()
.bold()
.secondary()
.rounded()
.selected(self.filter(&RoomKind::Ongoing, cx))
.on_click(cx.listener(|this, _, _, cx| {
this.set_filter(RoomKind::Ongoing, cx);
})),
)
.child(
Button::new("requests")
.label("Requests")
.tooltip("Incoming new conversations")
.when(self.new_request, |this| {
this.child(
div().size_1().rounded_full().bg(cx.theme().cursor),
)
})
.small()
.cta()
.bold()
.secondary()
.rounded()
.selected(!self.filter(&RoomKind::Ongoing, cx))
.on_click(cx.listener(|this, _, _, cx| {
this.set_filter(RoomKind::default(), cx);
})),
)
.child(
h_flex()
.flex_1()
.w_full()
.justify_end()
.items_center()
.text_xs()
.child(
Button::new("option")
.icon(IconName::Ellipsis)
.xsmall()
.ghost()
.rounded()
.popup_menu(move |this, _window, _cx| {
this.menu("Reload", Box::new(Reload))
.menu("Relay Status", Box::new(RelayStatus))
}),
),
),
)
.when(!loading && total_rooms == 0, |this| {
this.map(|this| {
if self.filter(&RoomKind::Ongoing, cx) {
this.child(deferred(
v_flex()
.py_2()
.px_1p5()
.gap_1p5()
.items_center()
.justify_center()
.text_center()
.child(
div()
.text_sm()
.font_semibold()
.line_height(relative(1.25))
.child(SharedString::from("No conversations")),
)
.child(
div()
.text_xs()
.text_color(cx.theme().text_muted)
.line_height(relative(1.25))
.child(SharedString::from(EMPTY_HELP)),
),
))
} else {
this.child(deferred(
v_flex()
.py_2()
.px_1p5()
.gap_1p5()
.items_center()
.justify_center()
.text_center()
.child(
div()
.text_sm()
.font_semibold()
.line_height(relative(1.25))
.child(SharedString::from("No message requests")),
)
.child(
div()
.text_xs()
.text_color(cx.theme().text_muted)
.line_height(relative(1.25))
.child(SharedString::from(REQUEST_HELP)),
),
))
}
})
})
.child(
uniform_list(
"rooms",
total_rooms,
cx.processor(move |this, range, _window, cx| {
this.list_items(&rooms, range, cx)
cx.processor(|this, range, window, cx| {
this.render_list_items(range, window, cx)
}),
)
.h_full(),

View File

@@ -1,5 +1,6 @@
use std::time::Duration;
use anyhow::Error;
use common::{nip05_verify, shorten_pubkey};
use gpui::prelude::FluentBuilder;
use gpui::{

View File

@@ -1,5 +1,6 @@
use std::time::Duration;
use anyhow::Error;
use common::{nip05_verify, shorten_pubkey, RenderedProfile, RenderedTimestamp, BOOTSTRAP_RELAYS};
use gpui::prelude::FluentBuilder;
use gpui::{

View File

@@ -75,13 +75,7 @@ impl RenderOnce for WindowControl {
this.child(
svg()
.external_path(path.into_os_string().into_string().unwrap())
.map(|this| {
if cx.theme().is_dark() {
this.text_color(gpui::white())
} else {
this.text_color(gpui::black())
}
})
.text_color(cx.theme().text)
.size_4(),
)
} else {

View File

@@ -8,13 +8,10 @@ use crate::scale::{ColorScale, ColorScaleSet, ColorScales};
pub struct ThemeColors {
// Surface colors
pub background: Hsla,
pub overlay: Hsla,
pub surface_background: Hsla,
pub elevated_surface_background: Hsla,
pub panel_background: Hsla,
pub overlay: Hsla,
pub title_bar: Hsla,
pub title_bar_inactive: Hsla,
pub window_border: Hsla,
// Border colors
pub border: Hsla,
@@ -108,9 +105,6 @@ impl ThemeColors {
elevated_surface_background: neutral().dark().step_3(),
panel_background: neutral().dark().step_1(),
overlay: neutral().dark_alpha().step_3(),
title_bar: gpui::transparent_black(),
title_bar_inactive: neutral().dark().step_1(),
window_border: hsl(240.0, 3.7, 28.0),
border: neutral().dark().step_6(),
border_variant: neutral().dark().step_5(),

View File

@@ -12,6 +12,7 @@ pub enum IconName {
ArrowLeft,
ArrowRight,
Boom,
ChevronDown,
CaretDown,
CaretRight,
CaretUp,
@@ -57,6 +58,7 @@ impl IconName {
Self::ArrowLeft => "icons/arrow-left.svg",
Self::ArrowRight => "icons/arrow-right.svg",
Self::Boom => "icons/boom.svg",
Self::ChevronDown => "icons/chevron-down.svg",
Self::CaretDown => "icons/caret-down.svg",
Self::CaretRight => "icons/caret-right.svg",
Self::CaretUp => "icons/caret-up.svg",

View File

@@ -2,9 +2,9 @@ use std::rc::Rc;
use gpui::prelude::FluentBuilder;
use gpui::{
canvas, div, point, px, AnyView, App, AppContext, Bounds, Context, CursorStyle, Decorations,
Edges, Entity, FocusHandle, HitboxBehavior, Hsla, InteractiveElement, IntoElement, MouseButton,
ParentElement as _, Pixels, Point, Render, ResizeEdge, SharedString, Size, Styled,
canvas, div, point, px, rgba, AnyView, App, AppContext, Bounds, Context, CursorStyle,
Decorations, Edges, Entity, FocusHandle, HitboxBehavior, Hsla, InteractiveElement, IntoElement,
MouseButton, ParentElement as _, Pixels, Point, Render, ResizeEdge, SharedString, Size, Styled,
WeakFocusHandle, Window,
};
use theme::{
@@ -324,7 +324,9 @@ impl Render for Root {
.map(|div| match decorations {
Decorations::Server => div,
Decorations::Client { tiling } => div
.border_color(cx.theme().window_border)
.when(!cx.theme().platform.is_mac(), |div| {
div.border_color(rgba(0x64748b33))
})
.when(!(tiling.top || tiling.right), |div| {
div.rounded_tr(CLIENT_SIDE_DECORATION_ROUNDING)
})