From 1c00bc79568a3093a59fdfcaae9ac8f778a9df57 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Fri, 23 Oct 2026 09:09:19 +0700 Subject: [PATCH] wip --- crates/ui/src/message.rs | 4 ++-- crates/workspace/src/nav.rs | 15 +++++++-------- crates/workspace/src/panels/greeter.rs | 20 ++++++++------------ crates/workspace/src/sidebar/header.rs | 1 + crates/workspace/src/sidebar/inbox.rs | 9 +++++---- crates/workspace/src/sidebar/list.rs | 21 ++++++++------------- crates/workspace/src/sidebar/mod.rs | 5 ++++- crates/workspace/src/sidebar/rows.rs | 6 ++++-- 8 files changed, 39 insertions(+), 42 deletions(-) diff --git a/crates/ui/src/message.rs b/crates/ui/src/message.rs index f8d80a18..6c61bc98 100644 --- a/crates/ui/src/message.rs +++ b/crates/ui/src/message.rs @@ -184,7 +184,7 @@ impl RenderOnce for MessageRow { .group("") .relative() .w_full() - .py_1() + .py_0p5() .when(show_author, |this| this.pt_2()) .px_3() .refine_style(&style) @@ -209,7 +209,7 @@ impl RenderOnce for MessageRow { .min_w_0() .flex_initial() .overflow_hidden() - .text_sm() + .text_size(px(15.)) .when(show_author, |this| { this.child( h_flex() diff --git a/crates/workspace/src/nav.rs b/crates/workspace/src/nav.rs index 45c14b8c..05d99a47 100644 --- a/crates/workspace/src/nav.rs +++ b/crates/workspace/src/nav.rs @@ -19,7 +19,7 @@ pub struct Nav { suffix: Option, selected: bool, clickable: bool, - gap: bool, + center_prefix: bool, #[allow(clippy::type_complexity)] on_click: Option>, } @@ -39,7 +39,7 @@ impl Nav { suffix: None, selected: false, clickable: false, - gap: true, + center_prefix: false, on_click: None, } } @@ -50,9 +50,9 @@ impl Nav { self } - /// Whether to space the row's contents apart. - pub fn gap(mut self, gap: bool) -> Self { - self.gap = gap; + /// Whether to center the prefix in the avatar-width column. + pub fn center_prefix(mut self, center: bool) -> Self { + self.center_prefix = center; self } @@ -115,14 +115,13 @@ impl RenderOnce for Nav { .h_8() .w_full() .px_2() - .when(self.gap, |this| this.gap_2()) + .gap_2() .rounded(cx.theme().radius) .when_some(self.prefix, |this, prefix| { this.child( h_flex() - .w_6() .flex_shrink_0() - .justify_center() + .when(self.center_prefix, |this| this.w_6().justify_center()) .child(prefix), ) }) diff --git a/crates/workspace/src/panels/greeter.rs b/crates/workspace/src/panels/greeter.rs index 6ca19362..5807094a 100644 --- a/crates/workspace/src/panels/greeter.rs +++ b/crates/workspace/src/panels/greeter.rs @@ -244,13 +244,13 @@ impl GreeterPanel { .seed(seed) .small(), ) - .child(div().min_w_0().truncate().text_xs().child(name)) + .child(div().min_w_0().truncate().text_sm().child(name)) .child( div() .flex_1() .min_w_0() .truncate() - .text_xs() + .text_sm() .text_color(cx.theme().muted_foreground) .italic() .child(preview), @@ -363,13 +363,13 @@ impl GreeterPanel { .seed(seed) .small(), ) - .child(div().min_w_0().truncate().text_xs().child(name)) + .child(div().min_w_0().truncate().text_sm().child(name)) .child( div() .flex_1() .min_w_0() .truncate() - .text_xs() + .text_sm() .text_color(cx.theme().muted_foreground) .italic() .child(preview), @@ -458,13 +458,9 @@ impl GreeterPanel { .w_full() .child( Nav::new("browse-group") - .prefix( - Icon::new(IconName::Compass) - .small() - .text_color(cx.theme().muted_foreground), - ) + .prefix(Icon::new(IconName::Compass)) .label("Browse Public Groups") - .text_xs() + .text_sm() .on_click(cx.listener(|this, _, window, cx| { let panel = browse::init(this.dock.clone(), window, cx); add_panel_to( @@ -478,9 +474,9 @@ impl GreeterPanel { ) .child( Nav::new("browse-posts") - .prefix(Icon::new(IconName::Link).small()) + .prefix(Icon::new(IconName::Link)) .label("Browse Nostr via Jumble") - .text_xs() + .text_sm() .on_click(|_, _, cx| { cx.open_url(JUMBLE_URL); }), diff --git a/crates/workspace/src/sidebar/header.rs b/crates/workspace/src/sidebar/header.rs index c6b6b186..c6be5ca7 100644 --- a/crates/workspace/src/sidebar/header.rs +++ b/crates/workspace/src/sidebar/header.rs @@ -131,6 +131,7 @@ impl Sidebar { .child( Nav::new("sidebar-settings") .prefix(Icon::new(IconName::Settings).small()) + .center_prefix(true) .label("Settings") .text_sm() .on_click(|_, window, cx| { diff --git a/crates/workspace/src/sidebar/inbox.rs b/crates/workspace/src/sidebar/inbox.rs index 4a3b6241..1e878e51 100644 --- a/crates/workspace/src/sidebar/inbox.rs +++ b/crates/workspace/src/sidebar/inbox.rs @@ -193,9 +193,8 @@ impl Sidebar { .h_20() .w_full() .px_4() - .border_t_1() - .border_color(cx.theme().border) - .bg(cx.theme().background) + .bg(cx.theme().sidebar) + .text_color(cx.theme().sidebar_foreground) .child( Button::new("create-chat") .label(if self.selected_contacts.len() > 1 { @@ -213,7 +212,9 @@ impl Sidebar { .gap_1() .text_xs() .text_color(cx.theme().muted_foreground) - .child("Selected") + .text_center() + .justify_center() + .child("Selected:") .child( div() .font_semibold() diff --git a/crates/workspace/src/sidebar/list.rs b/crates/workspace/src/sidebar/list.rs index fa87c310..094e03b5 100644 --- a/crates/workspace/src/sidebar/list.rs +++ b/crates/workspace/src/sidebar/list.rs @@ -44,9 +44,9 @@ impl Sidebar { let create_button = contacts_open && !self.selected_contacts.is_empty(); let (list_id, title) = if contacts_open { - ("sidebar-contacts", Some(("Contacts", IconName::Book))) + ("sidebar-contacts", Some("Contacts")) } else if requests_open { - ("sidebar-requests", Some(("Requests", IconName::Invite))) + ("sidebar-requests", Some("Requests")) } else { ("sidebar-list", None) }; @@ -119,7 +119,6 @@ impl Sidebar { Nav::new("contacts") .prefix(Icon::new(IconName::Book).small()) .label("Contacts") - .gap(false) .text_sm() .when(contacts_open, |this| this.bg(cx.theme().list_active)) .on_click(cx.listener(|this, _event, window, cx| { @@ -127,21 +126,17 @@ impl Sidebar { })), ), ) - .when_some(title, |this, (title, title_icon)| { + .when_some(title, |this, title| { this.child( h_flex() + .px_4() .h_10() .w_full() .flex_shrink_0() - .items_center() - .child( - h_flex() - .px_2() - .gap_2() - .text_color(cx.theme().muted_foreground) - .child(Icon::new(title_icon).small()) - .child(div().text_xs().font_semibold().child(title)), - ), + .text_color(cx.theme().muted_foreground) + .text_xs() + .font_semibold() + .child(title), ) }) .child( diff --git a/crates/workspace/src/sidebar/mod.rs b/crates/workspace/src/sidebar/mod.rs index 2efff0ea..1e21b3d1 100644 --- a/crates/workspace/src/sidebar/mod.rs +++ b/crates/workspace/src/sidebar/mod.rs @@ -292,6 +292,7 @@ impl Render for Sidebar { let group = self.group.clone().and_then(|group| group.upgrade()); let searching = self.search_open && !self.find_input.read(cx).value().is_empty(); + let picking_contacts = self.contacts_open && !self.requests_open; v_flex() .image_cache(retain_all("sidebar")) @@ -341,7 +342,9 @@ impl Render for Sidebar { _ => this.child(self.render_list(cx)), }), ) - .when(logged_in, |this| this.child(self.render_footer(cx))) + .when(logged_in && !picking_contacts, |this| { + this.child(self.render_footer(cx)) + }) .when(loading && logged_in, |this| { this.child( div() diff --git a/crates/workspace/src/sidebar/rows.rs b/crates/workspace/src/sidebar/rows.rs index 67c2002c..753028d5 100644 --- a/crates/workspace/src/sidebar/rows.rs +++ b/crates/workspace/src/sidebar/rows.rs @@ -99,7 +99,7 @@ impl Sidebar { .map(|(offset, row)| { let index = range.start + offset; - match row { + let element = match row { SidebarRow::Section(section) => { let section = *section; let label = section.label(); @@ -394,7 +394,9 @@ impl Sidebar { }) .into_any_element() } - } + }; + // Keep a small gap between rows so selected rows read as pills. + div().pb_0p5().child(element).into_any_element() }) .collect() }