From 60fc310a4ddb9a976cc504866ac9b96db0fb18c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 28 Nov 2026 19:35:14 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20builder=20user=20friend?= =?UTF-8?q?s=20are=20a=20searchable=20scroll=20list=20instead=20of=20an=20?= =?UTF-8?q?endless=20row?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/builder/users.rs | 47 ++++++++++++++++++++++---- crates/client/src/gui/chat.rs | 10 +++++- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/crates/client/src/gui/builder/users.rs b/crates/client/src/gui/builder/users.rs index 24fe1e4..9e0b8ea 100644 --- a/crates/client/src/gui/builder/users.rs +++ b/crates/client/src/gui/builder/users.rs @@ -13,7 +13,8 @@ use common::{ time::{DAY_MILLIS, HOUR_MILLIS, MINUTE_MILLIS, now_ms}, }; use gpui_kit::{ - AnyElement, App, Context, Div, Entity, FontWeight, IntoElement, ParentElement, Styled, Window, + AnyElement, App, Context, Div, Entity, FontWeight, InteractiveElement as _, IntoElement, + ParentElement, StatefulInteractiveElement as _, Styled, Window, assets::IconName, component::{Icon, input::Input}, div, @@ -36,6 +37,7 @@ use crate::{ net::{Fail, NetworkHandle}, }; +const FRIENDS_MAX_H: f32 = 200.; const MINUTES_PER_HOUR: u64 = HOUR_MILLIS / MINUTE_MILLIS; const MINUTES_PER_DAY: u64 = DAY_MILLIS / MINUTE_MILLIS; @@ -576,11 +578,46 @@ impl Yumush { )) } + fn builder_friend_list(&self, palette: Palette, cx: &App) -> Vec { + if self.chat.builder_friends.is_empty() { + return Vec::new(); + } + let query = crate::gui::widget::search_text(&self.chat.builder_friend_search, cx); + vec![ + div() + .w_full() + .flex() + .flex_col() + .gap(px(space::XS)) + .child(crate::gui::sidebar::input_box( + &self.chat.builder_friend_search, + palette, + )) + .child( + div() + .id("builder_friends") + .max_h(px(FRIENDS_MAX_H)) + .overflow_y_scroll() + .flex() + .flex_col() + .children( + self.chat + .builder_friends + .iter() + .filter(|friend| friend.username.to_lowercase().contains(&query)) + .map(|friend| self.builder_friend_chip(friend, palette)), + ), + ) + .into_any_element(), + ] + } + fn builder_friend_chip(&self, friend: &User, palette: Palette) -> AnyElement { div() + .h(px(size::CONTROL_SM)) .flex() .items_center() - .gap(px(space::XS)) + .gap(px(space::SM)) .child(crate::gui::avatar( palette, friend, @@ -1103,11 +1140,7 @@ impl Yumush { .children(action_group( w().builder_users.group_friends, palette, - self.chat - .builder_friends - .iter() - .map(|friend| self.builder_friend_chip(friend, palette)) - .collect(), + self.builder_friend_list(palette, cx), )) .children(stats_open.map(|stats| { super::super::voice_stats::stats_panel( diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 27a591a..8885d22 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -235,6 +235,7 @@ pub struct Chat { pub(super) builder_log_from: Entity, pub(super) builder_log_to: Entity, pub(super) builder_search: Entity, + pub(super) builder_friend_search: Entity, pub(super) builder_communities: Vec, pub(super) builder_reports: Vec, pub(super) report_filter: Option, @@ -375,11 +376,17 @@ impl Chat { let ban_search = new_input(w().chat.search, window, cx); let log_search = new_input(w().chat.search, window, cx); let builder_search = new_input(w().chat.search, window, cx); + let builder_friend_search = new_input(w().chat.search, window, cx); let builder_password = new_input(w().chat.new_password, window, cx); builder_password.update(cx, |input, cx| input.set_masked(true, window, cx)); let new_password = new_input(w().chat.password, window, cx); new_password.update(cx, |input, cx| input.set_masked(true, window, cx)); - for search in [&ban_search, &log_search, &builder_search] { + for search in [ + &ban_search, + &log_search, + &builder_search, + &builder_friend_search, + ] { cx.subscribe_in(search, window, |_, _, event, window, cx| { if matches!(event, InputEvent::Change) { window.refresh(); @@ -484,6 +491,7 @@ impl Chat { builder_log_from: new_input(w().chat.date_from, window, cx), builder_log_to: new_input(w().chat.date_to, window, cx), builder_search, + builder_friend_search, builder_communities: vec![], pending_community_delete: None, builder_message_text: new_input(w().chat.text, window, cx),