Places vs people: DM rows carry the person's face (Notes sits in that column as your own), no call count on 1:1 (sidebar and header), People column in a community (In call / Online / Offline) replacing the hidden '2 people' popover, Ctrl+K finds people (friends, members) and opens the DM
Browse files at this commit9866985f35ad3f89eecb24b8a874626b586beed6Parent: cf604c4- feat
- places vs people: DM rows carry the person's face (Notes sits in that column as your own), no call count on 1:1 (sidebar and header), People column in a community (In call / Online / Offline) replacing the hidden '2 people' popover, Ctrl+K finds people (friends, members) and opens the DM
3 changed files +230 -170
- crates/client/src/gui/chat.rs +164 -158
- crates/client/src/gui/jump.rs +31 -2
- crates/client/src/gui/sidebar.rs +35 -10
crates/client/src/gui/chat.rsmodified+164 -158
| @@ -27,7 +27,7 @@ use crate::gui::{ | ||
| 27 | 27 | sidebar::unread_badge, |
| 28 | 28 | snippet, |
| 29 | 29 | voice_note::{self, VoiceNote}, |
| 30 | - widget::{ok_or_notify, search_text, spawn_done}, | |
| 30 | + widget::{icon_button, ok_or_notify, search_text, spawn_done}, | |
| 31 | 31 | }; |
| 32 | 32 | use crate::net::Levels; |
| 33 | 33 | use crate::settings::VOLUME; |
| @@ -51,14 +51,12 @@ use common::{ | ||
| 51 | 51 | }; |
| 52 | 52 | use gpui_kit::{ |
| 53 | 53 | Anchor, AnyElement, App, AppContext, Context, Div, Entity, FontWeight, Image, |
| 54 | - InteractiveElement, IntoElement, ParentElement, RenderOnce, ScrollHandle, | |
| 55 | - StatefulInteractiveElement, Styled, Subscription, Task, Window, | |
| 54 | + InteractiveElement, IntoElement, ParentElement, ScrollHandle, StatefulInteractiveElement, | |
| 55 | + Styled, Subscription, Task, Window, | |
| 56 | 56 | assets::IconName, |
| 57 | - base::Selectable, | |
| 58 | 57 | component::{ |
| 59 | 58 | Icon, IndexPath, WindowExt, |
| 60 | 59 | input::{InputEvent, InputState, Textarea, TextareaState}, |
| 61 | - popover::Popover, | |
| 62 | 60 | searchable_list::SearchableVec, |
| 63 | 61 | select::SelectState, |
| 64 | 62 | slider::{SliderEvent, SliderState}, |
| @@ -136,7 +134,7 @@ pub struct Chat { | ||
| 136 | 134 | pub(super) selected_community_id: Option<Id>, |
| 137 | 135 | pub(super) opened: Option<Community>, |
| 138 | 136 | pub(super) ghost: bool, |
| 139 | - members: Vec<Member>, | |
| 137 | + pub(super) members: Vec<Member>, | |
| 140 | 138 | pub(super) messages: Vec<Message>, |
| 141 | 139 | pub(super) pins: Vec<Message>, |
| 142 | 140 | history: History, |
| @@ -269,6 +267,7 @@ pub struct Chat { | ||
| 269 | 267 | pub(super) followed: Option<(Id, common::stats::Stats)>, |
| 270 | 268 | pub(super) share_loss: HashMap<(Id, Kind), VecDeque<f32>>, |
| 271 | 269 | pub(super) stats_at: Option<StatsAt>, |
| 270 | + pub(super) members_open: bool, | |
| 272 | 271 | pub(super) usage_monitor: crate::usage::Monitor, |
| 273 | 272 | pub(super) ringing: HashSet<Id>, |
| 274 | 273 | pub(super) ring_task: Option<Task<()>>, |
| @@ -536,6 +535,7 @@ impl Chat { | ||
| 536 | 535 | followed: None, |
| 537 | 536 | share_loss: HashMap::new(), |
| 538 | 537 | stats_at: None, |
| 538 | + members_open: false, | |
| 539 | 539 | usage_monitor: { |
| 540 | 540 | let monitor = crate::usage::Monitor::default(); |
| 541 | 541 | if let Some(dir) = crate::config_dir() { |
| @@ -1320,46 +1320,6 @@ pub(super) fn create_community( | ||
| 1320 | 1320 | .detach(); |
| 1321 | 1321 | } |
| 1322 | 1322 | |
| 1323 | -#[derive(IntoElement)] | |
| 1324 | -struct MembersTrigger { | |
| 1325 | - palette: Palette, | |
| 1326 | - members: Vec<User>, | |
| 1327 | -} | |
| 1328 | - | |
| 1329 | -impl Selectable for MembersTrigger { | |
| 1330 | - fn selected(self, _: bool) -> Self { | |
| 1331 | - self | |
| 1332 | - } | |
| 1333 | - | |
| 1334 | - fn is_selected(&self) -> bool { | |
| 1335 | - false | |
| 1336 | - } | |
| 1337 | -} | |
| 1338 | - | |
| 1339 | -impl RenderOnce for MembersTrigger { | |
| 1340 | - fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement { | |
| 1341 | - let palette = self.palette; | |
| 1342 | - | |
| 1343 | - hoverable( | |
| 1344 | - "members_trigger", | |
| 1345 | - div() | |
| 1346 | - .h(px(size::CONTROL_SM)) | |
| 1347 | - .px(px(space::SM)) | |
| 1348 | - .flex() | |
| 1349 | - .items_center() | |
| 1350 | - .gap(px(space::SM)) | |
| 1351 | - .rounded(px(radius::MD)) | |
| 1352 | - .text_size(text(text::LABEL)) | |
| 1353 | - .text_color(palette.muted) | |
| 1354 | - .child(match self.members.len() { | |
| 1355 | - 1 => "1 person".to_string(), | |
| 1356 | - count => format!("{count} people"), | |
| 1357 | - }), | |
| 1358 | - palette, | |
| 1359 | - ) | |
| 1360 | - } | |
| 1361 | -} | |
| 1362 | - | |
| 1363 | 1323 | impl Yumush { |
| 1364 | 1324 | pub(super) fn toggle_stats(&mut self, at: StatsAt) { |
| 1365 | 1325 | self.chat.stats_at = (self.chat.stats_at != Some(at)).then_some(at); |
| @@ -1419,19 +1379,24 @@ impl Yumush { | ||
| 1419 | 1379 | .children(self.stage_strip(entity, themed)) |
| 1420 | 1380 | .children(self.unread_bar(entity, themed)) |
| 1421 | 1381 | .children(self.poll_banner(entity, themed)) |
| 1422 | - .child(div().flex_1().min_h_0().flex().child( | |
| 1423 | - div().flex_1().min_w_0().flex().flex_col().map(|panel| { | |
| 1424 | - match self.inline_viewer(entity, themed) { | |
| 1425 | - Some(viewer) => panel.child(viewer), | |
| 1426 | - None => match self.stage_grid(entity, themed) { | |
| 1427 | - Some(grid) => panel.child(grid), | |
| 1428 | - None => panel | |
| 1429 | - .child(self.message_area(entity, themed)) | |
| 1430 | - .child(self.composer(entity, themed, cx)), | |
| 1431 | - }, | |
| 1432 | - } | |
| 1433 | - }), | |
| 1434 | - )), | |
| 1382 | + .child( | |
| 1383 | + div() | |
| 1384 | + .flex_1() | |
| 1385 | + .min_h_0() | |
| 1386 | + .flex() | |
| 1387 | + .child(div().flex_1().min_w_0().flex().flex_col().map(|panel| { | |
| 1388 | + match self.inline_viewer(entity, themed) { | |
| 1389 | + Some(viewer) => panel.child(viewer), | |
| 1390 | + None => match self.stage_grid(entity, themed) { | |
| 1391 | + Some(grid) => panel.child(grid), | |
| 1392 | + None => panel | |
| 1393 | + .child(self.message_area(entity, themed)) | |
| 1394 | + .child(self.composer(entity, themed, cx)), | |
| 1395 | + }, | |
| 1396 | + } | |
| 1397 | + })) | |
| 1398 | + .children(members_column(entity, self, themed)), | |
| 1399 | + ), | |
| 1435 | 1400 | None => panel.child(empty_state(palette)), |
| 1436 | 1401 | }, |
| 1437 | 1402 | }) |
| @@ -1503,7 +1468,6 @@ impl Yumush { | ||
| 1503 | 1468 | super::parts::Ink::Paper, |
| 1504 | 1469 | palette.tokens, |
| 1505 | 1470 | )) |
| 1506 | - .children(group.then(|| members_popover(entity, self, palette))) | |
| 1507 | 1471 | .child(div().flex_1()) |
| 1508 | 1472 | .children( |
| 1509 | 1473 | community |
| @@ -1522,6 +1486,21 @@ impl Yumush { | ||
| 1522 | 1486 | (community.is_some() && !self.chat.pins.is_empty()) |
| 1523 | 1487 | .then(|| message_actions::pins_popover(&self.chat, entity, palette)), |
| 1524 | 1488 | ) |
| 1489 | + .children(group.then(|| { | |
| 1490 | + icon_button( | |
| 1491 | + "members_button", | |
| 1492 | + palette, | |
| 1493 | + IconName::Users, | |
| 1494 | + "People", | |
| 1495 | + entity_action(entity, |yumush, _, cx| { | |
| 1496 | + yumush.chat.members_open = !yumush.chat.members_open; | |
| 1497 | + cx.notify(); | |
| 1498 | + }), | |
| 1499 | + ) | |
| 1500 | + .when(self.chat.members_open, |button| { | |
| 1501 | + button.text_color(palette.text) | |
| 1502 | + }) | |
| 1503 | + })) | |
| 1525 | 1504 | } |
| 1526 | 1505 | |
| 1527 | 1506 | fn message_area(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { |
| @@ -2734,12 +2713,14 @@ impl Yumush { | ||
| 2734 | 2713 | .flex() |
| 2735 | 2714 | .items_center() |
| 2736 | 2715 | .gap(px(space::SM)) |
| 2737 | - .child( | |
| 2738 | - div() | |
| 2739 | - .text_size(text(text::LABEL)) | |
| 2740 | - .text_color(palette.muted) | |
| 2741 | - .child(format!("{} in call", users.len())), | |
| 2742 | - ) | |
| 2716 | + .when(!self.is_direct(community_id), |stack| { | |
| 2717 | + stack.child( | |
| 2718 | + div() | |
| 2719 | + .text_size(text(text::LABEL)) | |
| 2720 | + .text_color(palette.muted) | |
| 2721 | + .child(format!("{} in call", users.len())), | |
| 2722 | + ) | |
| 2723 | + }) | |
| 2743 | 2724 | .children(self.in_stage_chat().then(|| { |
| 2744 | 2725 | div() |
| 2745 | 2726 | .ml(px(space::SM)) |
| @@ -2780,13 +2761,20 @@ struct MemberRow { | ||
| 2780 | 2761 | presence: Presence, |
| 2781 | 2762 | } |
| 2782 | 2763 | |
| 2783 | -fn members_popover(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> impl IntoElement { | |
| 2764 | +fn members_column( | |
| 2765 | + entity: &Entity<Yumush>, | |
| 2766 | + yumush: &Yumush, | |
| 2767 | + palette: Palette, | |
| 2768 | +) -> Option<gpui_kit::Stateful<Div>> { | |
| 2784 | 2769 | let chat = &yumush.chat; |
| 2785 | - let entity = entity.clone(); | |
| 2786 | - let voice = chat | |
| 2787 | - .selected_community_id | |
| 2788 | - .map(|community_id| chat.voice_ids(community_id)) | |
| 2789 | - .unwrap_or_default(); | |
| 2770 | + let community_id = chat.selected_community_id?; | |
| 2771 | + let group = chat | |
| 2772 | + .selected_community() | |
| 2773 | + .is_some_and(|community| matches!(community.kind, CommunityKind::Group)); | |
| 2774 | + if !chat.members_open || !group { | |
| 2775 | + return None; | |
| 2776 | + } | |
| 2777 | + let voice = chat.voice_ids(community_id); | |
| 2790 | 2778 | let members: Vec<MemberRow> = chat |
| 2791 | 2779 | .members |
| 2792 | 2780 | .iter() |
| @@ -2798,97 +2786,115 @@ fn members_popover(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) - | ||
| 2798 | 2786 | presence: yumush.presence_of(member.user.id), |
| 2799 | 2787 | }) |
| 2800 | 2788 | .collect(); |
| 2801 | - let avatars = chat.avatars.clone(); | |
| 2802 | - | |
| 2803 | - Popover::new("members_popover") | |
| 2804 | - .anchor(Anchor::TopRight) | |
| 2805 | - .appearance(false) | |
| 2806 | - .trigger(MembersTrigger { | |
| 2807 | - palette, | |
| 2808 | - members: members.iter().map(|row| row.user.clone()).collect(), | |
| 2809 | - }) | |
| 2810 | - .content(move |_, _, _| { | |
| 2811 | - let entity = entity.clone(); | |
| 2812 | - | |
| 2813 | - div() | |
| 2814 | - .w(px(size::SIDEBAR)) | |
| 2815 | - .p(px(space::XS)) | |
| 2816 | - .flex() | |
| 2817 | - .flex_col() | |
| 2818 | - .rounded(px(radius::LG)) | |
| 2819 | - .bg(palette.field) | |
| 2820 | - .children(members.iter().map( | |
| 2821 | - |MemberRow { | |
| 2822 | - user, | |
| 2823 | - rank, | |
| 2824 | - in_voice, | |
| 2825 | - muted, | |
| 2826 | - presence, | |
| 2827 | - }| { | |
| 2828 | - profile_popover( | |
| 2829 | - format!("member_{}", user.id), | |
| 2830 | - Anchor::TopRight, | |
| 2831 | - user, | |
| 2832 | - &entity, | |
| 2833 | - hoverable( | |
| 2834 | - format!("member_trigger_{}", user.id), | |
| 2789 | + let avatars = &chat.avatars; | |
| 2790 | + let entity = entity.clone(); | |
| 2791 | + let row = |MemberRow { | |
| 2792 | + user, | |
| 2793 | + rank, | |
| 2794 | + in_voice, | |
| 2795 | + muted, | |
| 2796 | + presence, | |
| 2797 | + }: &MemberRow| { | |
| 2798 | + profile_popover( | |
| 2799 | + format!("member_{}", user.id), | |
| 2800 | + Anchor::TopRight, | |
| 2801 | + user, | |
| 2802 | + &entity, | |
| 2803 | + hoverable( | |
| 2804 | + format!("member_trigger_{}", user.id), | |
| 2805 | + div() | |
| 2806 | + .h(px(size::CONTROL)) | |
| 2807 | + .px(px(space::SM)) | |
| 2808 | + .flex() | |
| 2809 | + .items_center() | |
| 2810 | + .gap(px(space::SM)) | |
| 2811 | + .rounded(px(radius::MD)) | |
| 2812 | + .child(presence_avatar( | |
| 2813 | + avatar(palette, user, px(size::ICON), text(text::CAPTION), &avatars), | |
| 2814 | + *presence, | |
| 2815 | + px(size::ICON), | |
| 2816 | + palette, | |
| 2817 | + )) | |
| 2818 | + .child( | |
| 2819 | + div() | |
| 2820 | + .flex_1() | |
| 2821 | + .min_w_0() | |
| 2822 | + .flex() | |
| 2823 | + .flex_col() | |
| 2824 | + .child( | |
| 2835 | 2825 | div() |
| 2836 | - .h(px(size::CONTROL)) | |
| 2837 | - .px(px(space::SM)) | |
| 2838 | 2826 | .flex() |
| 2839 | 2827 | .items_center() |
| 2840 | 2828 | .gap(px(space::SM)) |
| 2841 | - .rounded(px(radius::MD)) | |
| 2842 | - .child(presence_avatar( | |
| 2843 | - avatar( | |
| 2844 | - palette, | |
| 2845 | - user, | |
| 2846 | - px(size::ICON), | |
| 2847 | - text(text::CAPTION), | |
| 2848 | - &avatars, | |
| 2849 | - ), | |
| 2850 | - *presence, | |
| 2851 | - px(size::ICON), | |
| 2852 | - palette, | |
| 2853 | - )) | |
| 2854 | - .child( | |
| 2855 | - div() | |
| 2856 | - .flex_1() | |
| 2857 | - .min_w_0() | |
| 2858 | - .flex() | |
| 2859 | - .flex_col() | |
| 2860 | - .child( | |
| 2861 | - div() | |
| 2862 | - .flex() | |
| 2863 | - .items_center() | |
| 2864 | - .gap(px(space::SM)) | |
| 2865 | - .child(user.username.clone()) | |
| 2866 | - .children(rank_tag(*rank, palette)) | |
| 2867 | - .children(in_voice.then(|| { | |
| 2868 | - Icon::new(IconName::Headphones) | |
| 2869 | - .size(px(size::ICON_SM)) | |
| 2870 | - .text_color(palette.muted) | |
| 2871 | - })) | |
| 2872 | - .children(muted.then(|| { | |
| 2873 | - Icon::new(IconName::MicOff) | |
| 2874 | - .size(px(size::ICON_SM)) | |
| 2875 | - .text_color(palette.danger) | |
| 2876 | - })), | |
| 2877 | - ) | |
| 2878 | - .children((!user.status.is_empty()).then(|| { | |
| 2879 | - div() | |
| 2880 | - .text_size(text(text::CAPTION)) | |
| 2881 | - .text_color(palette.muted) | |
| 2882 | - .truncate() | |
| 2883 | - .child(user.status.clone()) | |
| 2884 | - })), | |
| 2885 | - ), | |
| 2886 | - palette, | |
| 2887 | - ), | |
| 2888 | - ) | |
| 2889 | - }, | |
| 2890 | - )) | |
| 2829 | + .child(user.username.clone()) | |
| 2830 | + .children(rank_tag(*rank, palette)) | |
| 2831 | + .children(in_voice.then(|| { | |
| 2832 | + Icon::new(IconName::Headphones) | |
| 2833 | + .size(px(size::ICON_SM)) | |
| 2834 | + .text_color(palette.muted) | |
| 2835 | + })) | |
| 2836 | + .children(muted.then(|| { | |
| 2837 | + Icon::new(IconName::MicOff) | |
| 2838 | + .size(px(size::ICON_SM)) | |
| 2839 | + .text_color(palette.danger) | |
| 2840 | + })), | |
| 2841 | + ) | |
| 2842 | + .children((!user.status.is_empty()).then(|| { | |
| 2843 | + div() | |
| 2844 | + .text_size(text(text::CAPTION)) | |
| 2845 | + .text_color(palette.muted) | |
| 2846 | + .truncate() | |
| 2847 | + .child(user.status.clone()) | |
| 2848 | + })), | |
| 2849 | + ), | |
| 2850 | + palette, | |
| 2851 | + ), | |
| 2852 | + ) | |
| 2853 | + }; | |
| 2854 | + let section = |title: &'static str, rows: Vec<&MemberRow>| { | |
| 2855 | + (!rows.is_empty()).then(|| { | |
| 2856 | + div() | |
| 2857 | + .flex() | |
| 2858 | + .flex_col() | |
| 2859 | + .child( | |
| 2860 | + div() | |
| 2861 | + .px(px(space::SM)) | |
| 2862 | + .pb(px(space::XS)) | |
| 2863 | + .text_size(text(text::CAPTION)) | |
| 2864 | + .text_color(palette.muted) | |
| 2865 | + .child(format!("{title} · {}", rows.len())), | |
| 2866 | + ) | |
| 2867 | + .children(rows.into_iter().map(row)) | |
| 2891 | 2868 | }) |
| 2869 | + }; | |
| 2870 | + let in_call = members.iter().filter(|row| row.in_voice).collect(); | |
| 2871 | + let online = members | |
| 2872 | + .iter() | |
| 2873 | + .filter(|row| !row.in_voice && row.presence != Presence::Offline) | |
| 2874 | + .collect(); | |
| 2875 | + let offline = members | |
| 2876 | + .iter() | |
| 2877 | + .filter(|row| !row.in_voice && row.presence == Presence::Offline) | |
| 2878 | + .collect(); | |
| 2879 | + | |
| 2880 | + Some( | |
| 2881 | + div() | |
| 2882 | + .id("members_column") | |
| 2883 | + .w(px(size::SIDEBAR)) | |
| 2884 | + .flex_none() | |
| 2885 | + .h_full() | |
| 2886 | + .overflow_y_scroll() | |
| 2887 | + .px(px(space::SM)) | |
| 2888 | + .py(px(space::MD)) | |
| 2889 | + .flex() | |
| 2890 | + .flex_col() | |
| 2891 | + .gap(px(space::LG)) | |
| 2892 | + .border_l_1() | |
| 2893 | + .border_color(palette.border) | |
| 2894 | + .children(section("In call", in_call)) | |
| 2895 | + .children(section("Online", online)) | |
| 2896 | + .children(section("Offline", offline)), | |
| 2897 | + ) | |
| 2892 | 2898 | } |
| 2893 | 2899 | |
| 2894 | 2900 | fn accent_bar(palette: Palette) -> Div { |
crates/client/src/gui/jump.rsmodified+31 -2
| @@ -21,6 +21,7 @@ const SHOWN: usize = 8; | ||
| 21 | 21 | #[derive(Clone, Copy, PartialEq)] |
| 22 | 22 | pub(super) enum Place { |
| 23 | 23 | Room(Id), |
| 24 | + Person(Id), | |
| 24 | 25 | Notes, |
| 25 | 26 | Friends, |
| 26 | 27 | Settings(usize), |
| @@ -52,9 +53,9 @@ impl Yumush { | ||
| 52 | 53 | rooms.sort_by_key(|community| (Some(community.id) != call, !unread(community.id))); |
| 53 | 54 | let rooms = rooms.into_iter().map(|community| { |
| 54 | 55 | let hint = if community.kind.is_direct() { |
| 55 | - "direct" | |
| 56 | + "person" | |
| 56 | 57 | } else { |
| 57 | - "room" | |
| 58 | + "community" | |
| 58 | 59 | }; |
| 59 | 60 | ( |
| 60 | 61 | Place::Room(community.id), |
| @@ -62,6 +63,29 @@ impl Yumush { | ||
| 62 | 63 | hint, |
| 63 | 64 | ) |
| 64 | 65 | }); |
| 66 | + let directs: Vec<Id> = self | |
| 67 | + .chat | |
| 68 | + .communities | |
| 69 | + .iter() | |
| 70 | + .filter_map(|community| match &community.kind { | |
| 71 | + CommunityKind::Direct { peer } => Some(peer.id), | |
| 72 | + _ => None, | |
| 73 | + }) | |
| 74 | + .collect(); | |
| 75 | + let mut seen = std::collections::HashSet::new(); | |
| 76 | + let people = self | |
| 77 | + .chat | |
| 78 | + .friends | |
| 79 | + .friends | |
| 80 | + .iter() | |
| 81 | + .chain(self.chat.members.iter().map(|member| &member.user)) | |
| 82 | + .filter(|user| { | |
| 83 | + !directs.contains(&user.id) | |
| 84 | + && self.user.as_ref().is_none_or(|me| me.id != user.id) | |
| 85 | + && seen.insert(user.id) | |
| 86 | + }) | |
| 87 | + .map(|user| (Place::Person(user.id), user.username.to_string(), "person")) | |
| 88 | + .collect::<Vec<_>>(); | |
| 65 | 89 | let pages = [ |
| 66 | 90 | (Place::Notes, "Notes".to_string(), "page"), |
| 67 | 91 | (Place::Friends, "Friends".to_string(), "page"), |
| @@ -80,6 +104,7 @@ impl Yumush { | ||
| 80 | 104 | .map(|tab| (Place::Builder(tab), tab.label().to_string(), "builder")), |
| 81 | 105 | ); |
| 82 | 106 | rooms |
| 107 | + .chain(people) | |
| 83 | 108 | .chain(pages) |
| 84 | 109 | .filter(|(_, label, _)| label.to_lowercase().contains(&query)) |
| 85 | 110 | .take(SHOWN) |
| @@ -128,6 +153,10 @@ impl Yumush { | ||
| 128 | 153 | self.show_view(View::Chat, window, cx); |
| 129 | 154 | self.select_community(id, window, cx); |
| 130 | 155 | } |
| 156 | + Place::Person(id) => { | |
| 157 | + self.show_view(View::Chat, window, cx); | |
| 158 | + self.open_direct(id, window, cx); | |
| 159 | + } | |
| 131 | 160 | Place::Notes => self.open_notes(window, cx), |
| 132 | 161 | Place::Friends => self.show_view(View::Friends, window, cx), |
| 133 | 162 | Place::Settings(index) => { |
crates/client/src/gui/sidebar.rsmodified+35 -10
| @@ -194,12 +194,14 @@ impl Yumush { | ||
| 194 | 194 | .child(super::parts::voice_line(wave, voice, palette.tokens)), |
| 195 | 195 | ) |
| 196 | 196 | }) |
| 197 | - .child( | |
| 198 | - div() | |
| 199 | - .text_size(text(text::CAPTION)) | |
| 200 | - .text_color(palette.muted) | |
| 201 | - .child(ids.len().to_string()), | |
| 202 | - ) | |
| 197 | + .when(!self.is_direct(community_id), |this| { | |
| 198 | + this.child( | |
| 199 | + div() | |
| 200 | + .text_size(text(text::CAPTION)) | |
| 201 | + .text_color(palette.muted) | |
| 202 | + .child(ids.len().to_string()), | |
| 203 | + ) | |
| 204 | + }) | |
| 203 | 205 | .into_any_element() |
| 204 | 206 | } |
| 205 | 207 | |
| @@ -449,9 +451,16 @@ impl Yumush { | ||
| 449 | 451 | entry( |
| 450 | 452 | palette, |
| 451 | 453 | active, |
| 452 | - Icon::new(IconName::Bookmark) | |
| 453 | - .size(px(size::ICON)) | |
| 454 | - .text_color(palette.accent), | |
| 454 | + div() | |
| 455 | + .size(px(size::AVATAR)) | |
| 456 | + .flex() | |
| 457 | + .items_center() | |
| 458 | + .justify_center() | |
| 459 | + .child( | |
| 460 | + Icon::new(IconName::Bookmark) | |
| 461 | + .size(px(size::ICON_SM)) | |
| 462 | + .text_color(palette.accent), | |
| 463 | + ), | |
| 455 | 464 | "Notes", |
| 456 | 465 | unread_badge(palette, false, unread), |
| 457 | 466 | ), |
| @@ -527,6 +536,21 @@ impl Yumush { | ||
| 527 | 536 | } else { |
| 528 | 537 | Some(self.voice_chip(community_id, palette)) |
| 529 | 538 | }; |
| 539 | + let face = match &community.kind { | |
| 540 | + CommunityKind::Direct { peer } => Some(presence_avatar( | |
| 541 | + avatar( | |
| 542 | + palette, | |
| 543 | + peer, | |
| 544 | + px(size::AVATAR), | |
| 545 | + text(text::CAPTION), | |
| 546 | + &self.chat.avatars, | |
| 547 | + ), | |
| 548 | + self.presence_of(peer.id), | |
| 549 | + px(size::AVATAR), | |
| 550 | + palette, | |
| 551 | + )), | |
| 552 | + CommunityKind::Group | CommunityKind::Notes => None, | |
| 553 | + }; | |
| 530 | 554 | hoverable( |
| 531 | 555 | format!("{key}_{}", community.id), |
| 532 | 556 | div() |
| @@ -535,9 +559,10 @@ impl Yumush { | ||
| 535 | 559 | .rounded(px(radius::MD)) |
| 536 | 560 | .flex() |
| 537 | 561 | .items_center() |
| 538 | - .gap(px(space::XS)) | |
| 562 | + .gap(px(space::SM)) | |
| 539 | 563 | .text_color(if active { palette.text } else { palette.muted }) |
| 540 | 564 | .when(active, |row| row.font_weight(FontWeight::MEDIUM)) |
| 565 | + .children(face) | |
| 541 | 566 | .child( |
| 542 | 567 | div() |
| 543 | 568 | .min_w_0() |