chore: simplify import dialog & sidebar menu

This commit is contained in:
2026-10-26 19:59:48 +07:00
parent bfa34959cf
commit b0121f8df2
4 changed files with 24 additions and 27 deletions
+1
View File
@@ -24,3 +24,4 @@ dist/
vendor/ vendor/
wasm/ wasm/
node_modules/ node_modules/
.wrangler/
Generated
+4 -4
View File
@@ -1653,9 +1653,9 @@ dependencies = [
[[package]] [[package]]
name = "ctutils" name = "ctutils"
version = "0.4.5" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38d28fb6aa7dd680b3ffd1a3e64e115c177bdba63c0ae7f9cd48129ff05c4fa0" checksum = "fe3e9d21d39e6f39ff46e03d5b621424f88ee23d8a1672c6bfc9ccc7f2da4f6a"
dependencies = [ dependencies = [
"cmov", "cmov",
] ]
@@ -5818,9 +5818,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]] [[package]]
name = "ordered-float" name = "ordered-float"
version = "5.5.0" version = "5.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab"
dependencies = [ dependencies = [
"num-traits", "num-traits",
] ]
+4 -5
View File
@@ -29,8 +29,7 @@ pub fn open_unlock(window: &mut Window, cx: &mut App) {
let import = cx.new(|cx| ImportIdentity::new_unlock(window, cx)); let import = cx.new(|cx| ImportIdentity::new_unlock(window, cx));
window.open_dialog(cx, move |this, _window, _cx| { window.open_dialog(cx, move |this, _window, _cx| {
this.width(px(450.)) this.close_button(false)
.close_button(false)
.overlay_closable(false) .overlay_closable(false)
.keyboard(false) .keyboard(false)
.title("Unlock your identity") .title("Unlock your identity")
@@ -322,7 +321,7 @@ impl Render for ImportIdentity {
}), }),
) )
.child({ .child({
let content = v_flex().child( let content = v_flex().gap_1().child(
Button::new("login") Button::new("login")
.label(if is_unlock { "Unlock" } else { "Continue" }) .label(if is_unlock { "Unlock" } else { "Continue" })
.primary() .primary()
@@ -337,7 +336,7 @@ impl Render for ImportIdentity {
let content = content.when(!is_unlock, |this| { let content = content.when(!is_unlock, |this| {
this.child( this.child(
Button::new("proxy") Button::new("proxy")
.label("Connect via Web Extension (Experimental)") .label("Connect via Web Extension")
.ghost() .ghost()
.disabled(self.loading) .disabled(self.loading)
.on_click(cx.listener(move |this, _ev, _window, cx| { .on_click(cx.listener(move |this, _ev, _window, cx| {
@@ -350,7 +349,7 @@ impl Render for ImportIdentity {
let content = content.when(!is_unlock, |this| { let content = content.when(!is_unlock, |this| {
this.child( this.child(
Button::new("extension") Button::new("extension")
.label("Continue with Browser Extension (NIP-07)") .label("Continue with Browser Extension")
.ghost() .ghost()
.disabled(self.loading) .disabled(self.loading)
.on_click(cx.listener(move |this, _ev, _window, cx| { .on_click(cx.listener(move |this, _ev, _window, cx| {
+15 -18
View File
@@ -13,7 +13,7 @@ use gpui_kit::component::dialog::DialogButtonProps;
use gpui_kit::component::menu::{DropdownMenu, PopupMenuItem}; use gpui_kit::component::menu::{DropdownMenu, PopupMenuItem};
use gpui_kit::component::{ActiveTheme, Icon, Selectable, Sizable, WindowExt, h_flex, v_flex}; use gpui_kit::component::{ActiveTheme, Icon, Selectable, Sizable, WindowExt, h_flex, v_flex};
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use state::NostrRegistry; use state::{CLIENT_NAME, NostrRegistry};
use ui::{Avatar, IconName}; use ui::{Avatar, IconName};
use super::Sidebar; use super::Sidebar;
@@ -38,31 +38,28 @@ impl Sidebar {
.h(TAB_BAR_HEIGHT) .h(TAB_BAR_HEIGHT)
.flex_shrink_0() .flex_shrink_0()
.justify_between() .justify_between()
.px_2() .px_2p5()
.when(cfg!(target_os = "macos"), |this| this.pl(px(80.))) .when(cfg!(target_os = "macos"), |this| this.pl(px(80.)))
.child( .child(
Button::new("current-user") Button::new("user")
.text() .text()
.dropdown_caret(true) .dropdown_caret(true)
.min_w_0() .min_w_0()
.flex_shrink_1() .flex_shrink_1()
.child(Avatar::new(avatar).seed(profile.avatar_seed()).small()) .child(Avatar::new(avatar).seed(profile.avatar_seed()).small())
.dropdown_menu(move |this, _window, _cx| { .dropdown_menu(move |this, _window, _cx| {
this.menu_with_icon( this.menu("Profile", Box::new(Command::ShowProfile))
"Profile", .menu("Relays", Box::new(Command::ShowRelayList))
IconName::Profile, .separator()
Box::new(Command::ShowProfile), .label(format!("{CLIENT_NAME} {}", env!("CARGO_PKG_VERSION")))
) .item(
.menu_with_icon("Relays", IconName::Relay, Box::new(Command::ShowRelayList)) PopupMenuItem::element(|_, cx| {
.separator() div().text_color(cx.theme().danger).child("Log out")
.item( })
PopupMenuItem::element(|_, cx| { .on_click(|_, window, cx| {
div().text_color(cx.theme().danger).child("Log out") open_logout_dialog(window, cx);
}) }),
.on_click(|_, window, cx| { )
open_logout_dialog(window, cx);
}),
)
}), }),
) )
.child({ .child({