From 153c8a91cf5febcd3953e4d8ed3954bc94e4f2ba 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 20:47:11 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20call=20people=20live=20?= =?UTF-8?q?in=20the=20room=20margin=20(In=20call=20with=20voice=20lines=20?= =?UTF-8?q?and=20watch=20buttons);=20sidebar=20room=20row=20keeps=20only?= =?UTF-8?q?=20the=20line=20and=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/lang/en/chat.txt | 1 + crates/client/lang/tr/chat.txt | 1 + crates/client/src/gui/chat.rs | 54 +++++++++-- crates/client/src/gui/sidebar.rs | 155 +------------------------------ 4 files changed, 52 insertions(+), 159 deletions(-) diff --git a/crates/client/lang/en/chat.txt b/crates/client/lang/en/chat.txt index e76fe2e..def63b9 100644 --- a/crates/client/lang/en/chat.txt +++ b/crates/client/lang/en/chat.txt @@ -60,3 +60,4 @@ call_declined = {name} declined the call call_missed_mine = You called, no answer call_missed = Missed call from {name} call_ended = Call ended · {duration} +in_call = In call diff --git a/crates/client/lang/tr/chat.txt b/crates/client/lang/tr/chat.txt index 1513c79..b1e3fe3 100644 --- a/crates/client/lang/tr/chat.txt +++ b/crates/client/lang/tr/chat.txt @@ -60,3 +60,4 @@ call_declined = {name} aramayı reddetti call_missed_mine = Aradın, cevap yok call_missed = Cevapsız arama: {name} call_ended = Arama bitti · {duration} +in_call = Aramada diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 6a47348..ead6dc6 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -134,7 +134,6 @@ pub struct Chat { pub(super) selected_community_id: Option, pub(super) opened: Option, pub(super) ghost: bool, - pub(super) call_folded: bool, pub(super) members: Vec, pub(super) messages: Vec, pub(super) pins: Vec, @@ -395,7 +394,6 @@ impl Chat { selected_community_id: None, opened: None, ghost: false, - call_folded: false, members: vec![], bans: vec![], ban_search, @@ -3012,6 +3010,7 @@ impl Yumush { struct MemberRow { user: User, + in_voice: bool, muted: bool, presence: Presence, } @@ -3022,18 +3021,20 @@ fn members_column( palette: Palette, ) -> Option> { let chat = &yumush.chat; - chat.selected_community_id?; + let community_id = chat.selected_community_id?; let group = chat .selected_community() .is_some_and(|community| matches!(community.kind, CommunityKind::Group)); if !chat.members_open || !group { return None; } + let voice = chat.voice_ids(community_id); let members: Vec = chat .members .iter() .map(|member| MemberRow { user: member.user.clone(), + in_voice: voice.contains(&member.user.id), muted: chat.server_muted.contains(&member.user.id), presence: yumush.presence_of(member.user.id), }) @@ -3042,10 +3043,42 @@ fn members_column( let entity = entity.clone(); let row = |MemberRow { user, + in_voice, muted, presence, }: &MemberRow| { - profile_popover( + let watch = |kind: Kind| { + (*in_voice && chat.share_of(community_id, user.id, kind).is_some()).then(|| { + super::sidebar::watch_pill( + &entity, + user.id, + kind, + yumush.is_watching(user.id, kind), + palette, + ) + }) + }; + let line = in_voice.then(|| { + let speaking = chat.waves.speaking.contains(&user.id); + div() + .w(px(size::CONTROL * 1.5)) + .h(px(space::LG)) + .flex_none() + .child(super::parts::voice_line( + chat.waves.voice(user.id), + if speaking { + super::parts::Voice::Live(palette.tokens.person(user.id)) + } else { + super::parts::Voice::Quiet + }, + palette.tokens, + )) + }); + div() + .flex() + .items_center() + .gap(px(space::XS)) + .child(div().flex_1().min_w_0().child(profile_popover( format!("member_{}", user.id), Anchor::RightCenter, user, @@ -3083,7 +3116,7 @@ fn members_column( .text_color(palette.danger) })), ) - .children((!user.status.is_empty()).then(|| { + .children((!user.status.is_empty() && !in_voice).then(|| { div() .text_size(text(text::CAPTION)) .text_color(palette.muted) @@ -3096,7 +3129,10 @@ fn members_column( ), palette, ), - ) + ))) + .children(watch(Kind::Camera)) + .children(watch(Kind::Screen)) + .children(line) }; let section = |title: &'static str, rows: Vec<&MemberRow>, cap: usize| { (!rows.is_empty()).then(|| { @@ -3137,13 +3173,14 @@ fn members_column( }) }) }; + let in_call = members.iter().filter(|row| row.in_voice).collect(); let online = members .iter() - .filter(|row| row.presence != Presence::Offline) + .filter(|row| !row.in_voice && row.presence != Presence::Offline) .collect(); let offline = members .iter() - .filter(|row| row.presence == Presence::Offline) + .filter(|row| !row.in_voice && row.presence == Presence::Offline) .collect(); Some( @@ -3161,6 +3198,7 @@ fn members_column( .border_l_1() .border_color(palette.border) .child(room_head(yumush, palette)) + .children(section(w().chat.in_call, in_call, usize::MAX)) .children(section(w().chat.online, online, usize::MAX)) .children(section( w().chat.offline, diff --git a/crates/client/src/gui/sidebar.rs b/crates/client/src/gui/sidebar.rs index f79c95e..8dd53a1 100644 --- a/crates/client/src/gui/sidebar.rs +++ b/crates/client/src/gui/sidebar.rs @@ -222,7 +222,7 @@ impl Yumush { .into_any_element() } - fn voice_chip(&self, entity: &Entity, community_id: Id, palette: Palette) -> AnyElement { + fn voice_chip(&self, community_id: Id, palette: Palette) -> AnyElement { let ids = self.chat.voice_ids(community_id); let t = palette.tokens; let direct = self.is_direct(community_id); @@ -240,9 +240,6 @@ impl Yumush { _ => super::parts::Voice::Quiet, }; let total = self.chat.waves.total(&heard); - let own = self.chat.voice_community() == Some(community_id); - let folded = self.chat.call_folded; - let fold = entity.clone(); div() .id(format!("voice_chip_{community_id}")) .tip(w().sidebar.in_call) @@ -265,146 +262,9 @@ impl Yumush { .child(ids.len().to_string()), ) }) - .when(own && !direct, |this| { - this.child( - div() - .id(format!("call_fold_{community_id}")) - .flex_none() - .cursor_pointer() - .text_color(t.faint()) - .hover(|style| style.text_color(t.paper())) - .on_click(move |_, _, cx| { - cx.stop_propagation(); - fold.update(cx, |yumush, cx| { - yumush.chat.call_folded = !yumush.chat.call_folded; - cx.notify(); - }); - }) - .child( - Icon::new(if folded { - IconName::ChevronRight - } else { - IconName::ChevronDown - }) - .size(px(size::ICON_SM)), - ), - ) - }) .into_any_element() } - fn call_tree(&self, entity: &Entity, community_id: Id, palette: Palette) -> Option
{ - if self.chat.voice_community() != Some(community_id) || self.chat.call_folded { - return None; - } - let members = self - .chat - .voice_ids(community_id) - .iter() - .filter_map(|id| self.chat.author(*id)) - .map(|user| self.call_member(entity, community_id, user, palette)); - - Some( - div() - .ml(px(space::LG)) - .pl(px(space::MD)) - .border_l_1() - .border_color(palette.border) - .flex() - .flex_col() - .gap(px(space::XXS)) - .mt(px(space::XXS)) - .mb(px(space::XS)) - .children(members), - ) - } - - fn call_member( - &self, - entity: &Entity, - community_id: Id, - user: &User, - palette: Palette, - ) -> impl IntoElement { - let user_id = user.id; - let me = self.is_me(user_id); - let muted = (me && self.chat.voice_flags().is_some_and(|(muted, _)| muted)) - || self.chat.server_muted.contains(&user_id); - let speaking = self.chat.waves.speaking.contains(&user_id); - let shown = speaking || (me && !muted); - let wave = shown.then(|| self.chat.waves.voice(user_id)).flatten(); - let camera = self - .chat - .share_of(community_id, user_id, Kind::Camera) - .is_some(); - let screen = self - .chat - .share_of(community_id, user_id, Kind::Screen) - .is_some(); - let ghost = self.chat.ghost && self.is_me(user_id); - - let identity = div() - .flex() - .items_center() - .gap(px(space::SM)) - .flex_1() - .min_w_0() - .cursor_pointer() - .child( - div() - .min_w_0() - .truncate() - .text_size(text(text::LABEL)) - .text_color(if speaking { - palette.text - } else { - palette.muted - }) - .when(speaking, |name| name.font_weight(FontWeight::SEMIBOLD)) - .child(user.username.clone()), - ) - .children((muted && wave.is_none()).then(|| { - Icon::new(IconName::MicOff) - .size(px(size::ICON_SM)) - .text_color(palette.danger) - })); - - div() - .h(px(size::CONTROL_SM)) - .px(px(space::SM)) - .rounded(px(radius::MD)) - .flex() - .items_center() - .gap(px(space::SM)) - .hover(move |style| style.bg(palette.hover)) - .when(ghost, |row| row.text_color(palette.tokens.faint())) - .child(div().flex_1().min_w_0().child(profile_popover( - format!("call_member_{user_id}"), - Anchor::BottomLeft, - user, - entity, - identity, - ))) - .children(camera.then(|| { - watch_pill( - entity, - user_id, - Kind::Camera, - self.is_watching(user_id, Kind::Camera), - palette, - ) - })) - .children(screen.then(|| { - watch_pill( - entity, - user_id, - Kind::Screen, - self.is_watching(user_id, Kind::Screen), - palette, - ) - })) - } - fn voice_dot(&self, entity: &Entity, palette: Palette) -> Option { let community = self.chat.voice_room()?; @@ -722,14 +582,7 @@ impl Yumush { self.chat.pinned.contains(&community.id), ); let row = self.sidebar_community_row(entity, community, palette, "room", menu); - div() - .flex() - .flex_col() - .child(row) - .when(group, |this| { - this.children(self.call_tree(entity, community.id, palette)) - }) - .into_any_element() + row.into_any_element() } fn sidebar_community_row( @@ -757,7 +610,7 @@ impl Yumush { }) }) } else { - Some(self.voice_chip(entity, community_id, palette)) + Some(self.voice_chip(community_id, palette)) }; let face = match &community.kind { CommunityKind::Direct { peer } => Some( @@ -1157,7 +1010,7 @@ fn go_to_call( }) } -fn watch_pill( +pub(super) fn watch_pill( entity: &Entity, user_id: Id, kind: Kind,