From 9bfa24cf4890ea0e75aceb753d91cc47a848ac0c Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Mon, 5 Oct 2026 20:36:10 +0700 Subject: [PATCH] update sidebar --- Cargo.lock | 160 +++++++++++++--------------- assets/icons/book.svg | 4 +- assets/icons/plus-chat.svg | 1 + crates/ui/src/icon.rs | 2 + crates/ui/src/menu/popup_menu.rs | 6 +- crates/workspace/src/sidebar/mod.rs | 77 +++++-------- 6 files changed, 106 insertions(+), 144 deletions(-) create mode 100644 assets/icons/plus-chat.svg diff --git a/Cargo.lock b/Cargo.lock index a5710ca7..c897cc82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -396,13 +396,13 @@ dependencies = [ [[package]] name = "async-recursion" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.6", ] [[package]] @@ -839,16 +839,6 @@ dependencies = [ "piper", ] -[[package]] -name = "borsh" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" -dependencies = [ - "bytes", - "cfg_aliases", -] - [[package]] name = "browser-signer-proxy" version = "0.1.0" @@ -2690,9 +2680,9 @@ dependencies = [ [[package]] name = "gpui-base" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64bb52b29a8dcdc8d3f595b8b0839c076f237572ab601ba4577d3da8ae085728" +checksum = "3cf698677b253118459f552fe15513858c669d79a25837a94e480db2ae330050" dependencies = [ "aho-corasick", "anyhow", @@ -2723,6 +2713,7 @@ dependencies = [ "smallvec", "smol", "tracing", + "unicode-linebreak", "unicode-segmentation", "web-time", "windows 0.58.0", @@ -2730,14 +2721,15 @@ dependencies = [ [[package]] name = "gpui-pre" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e87a42bb37c7cb4e76dd1ac0ce88851e46e976e0373a47ab3e0757abffee54d" +checksum = "d7f0bc3ebba070f8981b3f8e905a12f47d27794a30d029e59cdb9edf7a4b3360" dependencies = [ "accesskit", "anyhow", "async-channel", "async-task", + "backtrace", "bindgen", "bitflags 2.13.2", "chrono", @@ -2762,6 +2754,7 @@ dependencies = [ "image", "inventory", "itertools 0.14.0", + "libc", "log", "lyon", "num_cpus", @@ -2800,33 +2793,39 @@ dependencies = [ [[package]] name = "gpui-pre-apple" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00053551517815ab169fda28fff78dbebf2712722593c7671c511785cb3f79d5" +checksum = "bfdd914311cd12894367c8b9908947bb0c27fd42f8b9a5ff7a0730551a83fa4c" dependencies = [ "anyhow", + "async-task", "block2 0.6.2", "cbindgen", - "cocoa 0.26.1", "core-foundation 0.10.1", + "core-graphics 0.24.0", "core-video", "derive_more", + "dispatch2", "etagere", "foreign-types", "gpui-pre", + "gpui-pre-util", "image", + "libc", "log", + "mach2", "metal", - "objc", "objc2 0.6.4", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", "parking_lot", ] [[package]] name = "gpui-pre-collections" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79760925c31ed06924d28d68981b5b22b2ce25665f58f0a33dfea11170e6e28" +checksum = "2c060863025dc3b8e90febad2d1f4ffd23a5d0dcedba39d3f6b7820ea2fdd3a0" dependencies = [ "gpui-pre-util", "indexmap", @@ -2835,9 +2834,9 @@ dependencies = [ [[package]] name = "gpui-pre-derive-refineable" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1aea3f941581a6a9dd545ecd351ef2d336fe6e2a1a4555cb6414944a4984260" +checksum = "bc834f30f5f49791e214f1fde01a009c7de91c9cd0a9f31dabfed130ba39e6cf" dependencies = [ "proc-macro2", "quote", @@ -2846,9 +2845,9 @@ dependencies = [ [[package]] name = "gpui-pre-http-client" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddce27e989e877a3a1a243f97d7ea4f1ade2532abec418d5a0be9cca802702c7" +checksum = "5d2935cf82333da3f41774e5757837756408f01356197b41c817ad2666034453" dependencies = [ "anyhow", "async-compression", @@ -2867,9 +2866,9 @@ dependencies = [ [[package]] name = "gpui-pre-http-client-tls" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0076f6cf87b87b5629d55692638df4edc04fab3da92f897c2294d520efac17d3" +checksum = "9bbac58d44e80c2bfdd736cacd334e5c9446d5847cd584193ee3c8634c729c2b" dependencies = [ "log", "rustls", @@ -2879,16 +2878,15 @@ dependencies = [ [[package]] name = "gpui-pre-linux" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aac7022e347409454777701082201742710052813964a1e25160f7e22c965ad" +checksum = "b1131746fad5c87b5de74dc9c73105655b0c820a2dd4bb247586573e7cf5720e" dependencies = [ "accesskit", "accesskit_unix", "anyhow", "as-raw-xcb-connection", "ashpd", - "bitflags 2.13.2", "bytemuck", "calloop", "calloop-wayland-source", @@ -2917,7 +2915,6 @@ dependencies = [ "wayland-protocols", "wayland-protocols-plasma", "wayland-protocols-wlr", - "x11-clipboard", "x11rb", "xkbcommon", "zed-scap", @@ -2926,20 +2923,20 @@ dependencies = [ [[package]] name = "gpui-pre-macos" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a43af845b260b09393e923c4f1e1a67a10fcfc847b4815192bbfd02ed9fe725" +checksum = "0d756813ff1cd741a502af60fd18869e0677795936d7349642b41c49f43120c0" dependencies = [ "accesskit", "accesskit_macos", "anyhow", - "async-task", "block2 0.6.2", "cocoa 0.26.1", "core-foundation 0.10.1", "core-foundation-sys", "core-graphics 0.24.0", "core-text", + "core-video", "ctor", "dispatch2", "foreign-types", @@ -2947,12 +2944,11 @@ dependencies = [ "gpui-pre", "gpui-pre-apple", "gpui-pre-collections", + "gpui-pre-scheduler", "gpui-pre-util", "image", "itertools 0.14.0", - "libc", "log", - "mach2", "objc", "objc2 0.6.4", "objc2-app-kit 0.3.2", @@ -2973,9 +2969,9 @@ dependencies = [ [[package]] name = "gpui-pre-macros" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1627c5dd3c3351e39e0621d3f3e31dbbe7c7658df90b1d2ec12bfe95d54cd37" +checksum = "d2ad26ca759364694cb55487bebff4c1b7dd6accab49990ff3cda6f7a818a9f4" dependencies = [ "heck 0.5.0", "proc-macro-crate", @@ -2986,9 +2982,9 @@ dependencies = [ [[package]] name = "gpui-pre-perf" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01954497dd02ba96ab4c252a8668643b0cc3085e7a75dca62e7ba0e3dcd83b02" +checksum = "2fcb288a506a476b6cbf97e6ec1cc0118db43f0ca91087588afa1c2d8cd4f842" dependencies = [ "gpui-pre-collections", "serde", @@ -2997,9 +2993,9 @@ dependencies = [ [[package]] name = "gpui-pre-platform" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0112105c2ac6757fbf527c9c92a753be9bcbce9f4cf26959a11eaa1db6565aa5" +checksum = "e200b7b78836f1a0fc70767d971768e88f29d8b91b697285c15fb8e373635a3e" dependencies = [ "anyhow", "console_error_panic_hook", @@ -3012,9 +3008,9 @@ dependencies = [ [[package]] name = "gpui-pre-refineable" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffd14639e5dfab906bbaeabfe0f94289120dcf2e6ed37217deb13964867e89a5" +checksum = "4042345bb5bd3ecbc5d15b21ed128154f462a992058d7038cd397631f5462338" dependencies = [ "gpui-pre-derive-refineable", ] @@ -3071,9 +3067,9 @@ dependencies = [ [[package]] name = "gpui-pre-reqwest-client" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fa47d680f9e186b33af323f97345d67b6150c0e4c0bc894406bff822a4d9b4" +checksum = "894b8d8618c92cbd4da28a04dd3fcf3c0e0607074fa99416a864ac9b63b18aae" dependencies = [ "anyhow", "bytes", @@ -3089,9 +3085,9 @@ dependencies = [ [[package]] name = "gpui-pre-scheduler" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8049963b716df01b67b58f86000597f222d5b31b15b35069b23a3b07f3c68352" +checksum = "f4acd73345bc3c09f1b98c1b21eb4459ad8336f89bb2edcef619e11c5a08456e" dependencies = [ "async-task", "backtrace", @@ -3106,9 +3102,9 @@ dependencies = [ [[package]] name = "gpui-pre-shared-string" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ef6314bdf5ab162c1913712ec4a91b013ce2a9cfb0b557ecdfdd5793c8b61d3" +checksum = "477529fd5aa90bff969785ee9a3938484d94aa5101cdf7b84719629c0345f98a" dependencies = [ "schemars", "serde", @@ -3117,9 +3113,9 @@ dependencies = [ [[package]] name = "gpui-pre-sum-tree" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cca7e5fad9d53b2d265860fefdffc5f171966cb99c3fd99ecac15c033f19209" +checksum = "9ec0ec176d576b82aed716cf47185856b54ea9528caaf9d01787024689bfd824" dependencies = [ "gpui-pre-ztracing", "heapless 0.9.3", @@ -3130,9 +3126,9 @@ dependencies = [ [[package]] name = "gpui-pre-util" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82e06359ae76f8bb07ed713c54adb80cea6a9a2d3dc715f41aec30cd2aadb4d" +checksum = "e1635ae7d0b05400bfa211ddef6c67dc8d9f223c463022c2b3bf2c1c14c6044f" dependencies = [ "anyhow", "log", @@ -3141,9 +3137,9 @@ dependencies = [ [[package]] name = "gpui-pre-util-macros" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a0da4143bb0e7eb926eed7edd3a61c9d17344207543dcc25fb398f0cb96b2f" +checksum = "01486fce7722e5d7d7e7bb71c719dfdcc6ed917112bdc7c56d0556fdb60d10ab" dependencies = [ "gpui-pre-perf", "quote", @@ -3152,9 +3148,9 @@ dependencies = [ [[package]] name = "gpui-pre-web" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3870cc909471bb830c3d79496770c754401aad6cfa122147ccb13e8908ad08" +checksum = "184776d0763e6889dd2842dcb1204c15055945f2bdfe926b5ef57bdbd1952a65" dependencies = [ "anyhow", "console_error_panic_hook", @@ -3181,9 +3177,9 @@ dependencies = [ [[package]] name = "gpui-pre-wgpu" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b02657b56b09140ce542f5e4434fb96d9fdaba0fd0035ba7dba13c171ddb9b" +checksum = "439c5421cafe1a7cf68d0c0ae5cc82b26fad6b0e6345ac98d20acaf1f2463914" dependencies = [ "anyhow", "bytemuck", @@ -3208,9 +3204,9 @@ dependencies = [ [[package]] name = "gpui-pre-windows" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05592a6f9e3e6bb7a9f2a0d4779271cf747a948db1c07b02448de777ffff8f3" +checksum = "371f9bb13f97e3bea2f8b8e5e81232bb74d735153c244ae67f7400e743925b1c" dependencies = [ "accesskit", "accesskit_windows", @@ -3220,6 +3216,7 @@ dependencies = [ "futures", "gpui-pre", "gpui-pre-collections", + "gpui-pre-scheduler", "gpui-pre-util", "image", "itertools 0.14.0", @@ -3237,9 +3234,9 @@ dependencies = [ [[package]] name = "gpui-pre-zlog" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7506302091e66d7fb5e04a5b3480e90cff0bbe3157458d7df91a41c59238c48" +checksum = "3bbe5b98630ef4bfed5a7105ec1062e78d571912bc491388f07ea22f2457c18b" dependencies = [ "anyhow", "chrono", @@ -3249,9 +3246,9 @@ dependencies = [ [[package]] name = "gpui-pre-ztracing" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ed1bc6d53b3ca93785a8573d1066d555b67bc475b344fb28871f9811eb6f218" +checksum = "f806400f6bda1fdd9fc627e158c0e44fb0c4b7767582a3621efcf92f4a850db7" dependencies = [ "gpui-pre-zlog", "gpui-pre-ztracing-macro", @@ -3261,9 +3258,9 @@ dependencies = [ [[package]] name = "gpui-pre-ztracing-macro" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829258540ea51bb9ea4a71686beffe5c99586901ba9f39944d06e4a180ab63fe" +checksum = "d337c9acf058238e45ce0570d8a5958439242889492f91ae2d8e324211a61ccd" [[package]] name = "gpui-updater-core" @@ -4442,9 +4439,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" dependencies = [ "libc", "wasi", @@ -5756,9 +5753,9 @@ dependencies = [ [[package]] name = "powerfmt" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" [[package]] name = "ppv-lite86" @@ -7037,7 +7034,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523" dependencies = [ - "borsh", "serde_core", ] @@ -7617,9 +7613,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "tokio" -version = "1.53.1" +version = "1.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044" dependencies = [ "bytes", "libc", @@ -9472,16 +9468,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "x11-clipboard" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662d74b3d77e396b8e5beb00b9cad6a9eccf40b2ef68cc858784b14c41d535a3" -dependencies = [ - "libc", - "x11rb", -] - [[package]] name = "x11rb" version = "0.13.2" diff --git a/assets/icons/book.svg b/assets/icons/book.svg index 9f5eee0c..9f439a6f 100644 --- a/assets/icons/book.svg +++ b/assets/icons/book.svg @@ -1,3 +1 @@ - - - + diff --git a/assets/icons/plus-chat.svg b/assets/icons/plus-chat.svg new file mode 100644 index 00000000..e4649d28 --- /dev/null +++ b/assets/icons/plus-chat.svg @@ -0,0 +1 @@ + diff --git a/crates/ui/src/icon.rs b/crates/ui/src/icon.rs index 198f5977..b2642e6a 100644 --- a/crates/ui/src/icon.rs +++ b/crates/ui/src/icon.rs @@ -56,6 +56,7 @@ pub enum IconName { Message, Moon, Plus, + PlusChat, PlusCircle, Profile, Reset, @@ -139,6 +140,7 @@ impl IconNamed for IconName { Self::Message => "icons/message.svg", Self::Moon => "icons/moon.svg", Self::Plus => "icons/plus.svg", + Self::PlusChat => "icons/plus-chat.svg", Self::PlusCircle => "icons/plus-circle.svg", Self::Profile => "icons/profile.svg", Self::Reset => "icons/reset.svg", diff --git a/crates/ui/src/menu/popup_menu.rs b/crates/ui/src/menu/popup_menu.rs index c9325526..285f4eb3 100644 --- a/crates/ui/src/menu/popup_menu.rs +++ b/crates/ui/src/menu/popup_menu.rs @@ -990,7 +990,7 @@ impl PopupMenu { let this = MenuItemElement::new(ix, &group_name) .relative() - .text_sm() + .text_xs() .py_0() .px(INNER_PADDING) .rounded(radius) @@ -1063,7 +1063,7 @@ impl PopupMenu { }) .disabled(*disabled) .h(item_height) - .gap_x_1() + .gap_x_1p5() .children(Self::render_icon( has_left_icon, is_left_check, @@ -1110,7 +1110,7 @@ impl PopupMenu { .min_h(item_height) .size_full() .items_center() - .gap_x_1() + .gap_x_1p5() .children(Self::render_icon( has_left_icon, false, diff --git a/crates/workspace/src/sidebar/mod.rs b/crates/workspace/src/sidebar/mod.rs index 8a66c4f2..84c4b962 100644 --- a/crates/workspace/src/sidebar/mod.rs +++ b/crates/workspace/src/sidebar/mod.rs @@ -394,7 +394,6 @@ impl Sidebar { let profile = persons.read(cx).get(current_user, cx); let avatar = profile.avatar(); let avatar_seed = profile.avatar_seed(); - let name = profile.name(); h_flex() .id("sidebar-user") @@ -419,47 +418,19 @@ impl Sidebar { .compact() .transparent() .dropdown_menu(move |this, _window, _cx| { - let avatar = avatar.clone(); - let avatar_seed = avatar_seed.clone(); - let name = name.clone(); - this.min_w(px(256.)) - .item(PopupMenuItem::element(move |_window, cx| { - h_flex() - .gap_1p5() - .text_xs() - .text_color(cx.theme().text_muted) - .child( - Avatar::new(avatar.clone()) - .seed(avatar_seed.clone()) - .xsmall(), - ) - .child(name.clone()) - })) - .separator() - .menu_with_icon("Inbox", IconName::Inbox, Box::new(Command::ShowInbox)) - .menu_with_icon( - "Search", - IconName::Search, - Box::new(Command::ShowSearch), - ) .menu_with_icon( "Profile", IconName::Profile, Box::new(Command::ShowProfile), ) .menu_with_icon( - "Contact List", - IconName::Book, - Box::new(Command::ShowContactList), + "Relays", + IconName::Relay, + Box::new(Command::ShowRelayList), ) - .menu_with_icon( - "Backup", - IconName::UserKey, - Box::new(Command::ShowBackup), - ) - .menu_with_icon("Themes", IconName::Sun, Box::new(Command::ToggleTheme)) .separator() + .menu_with_icon("Themes", IconName::Sun, Box::new(Command::ToggleTheme)) .menu_with_icon( "Settings", IconName::Settings, @@ -467,28 +438,29 @@ impl Sidebar { ) }), ) + .child(div().flex_1()) .when_some(updater, |this, updater| { this.child(self.render_updater(updater, cx)) }) .child( Button::new("sidebar-new") - .icon(IconName::PlusCircle) + .icon(IconName::PlusChat) .tooltip("New") .ghost() .small() .dropdown_menu(|menu, _window, _cx| { menu.menu_with_icon( + "New Group", + IconName::Group, + Box::new(Command::NewGroup), + ) + .menu_with_icon("Join Group", IconName::Door, Box::new(Command::JoinGroup)) + .separator() + .menu_with_icon( "New Chat", IconName::Message, Box::new(Command::NewChat), ) - .menu_with_icon("New Group", IconName::Group, Box::new(Command::NewGroup)) - .separator() - .menu_with_icon( - "Join Group", - IconName::Door, - Box::new(Command::JoinGroup), - ) }), ) .when(self.group_open, |this| { @@ -841,16 +813,19 @@ impl Sidebar { .h_10() .w_full() .px_1p5() - .py_1() - .justify_center() - .border_1() - .border_dashed() - .border_color(cx.theme().border) - .rounded(cx.theme().radius) - .justify_center() - .text_xs() - .text_color(cx.theme().text_placeholder) - .child(*text) + .child( + h_flex() + .h_9() + .w_full() + .justify_center() + .border_1() + .border_dashed() + .border_color(cx.theme().border) + .rounded(cx.theme().radius) + .text_xs() + .text_color(cx.theme().text_placeholder) + .child(*text), + ) .into_any_element(), SidebarRow::Room { room } => { let name = room.read(cx).display_name(cx);