Sidebar is the room list (wordmark, rooms, then people, your name and line at the bottom)
Browse files at this commit06e6d995ef8673ddd4d0a92b320cd1d11fb55970Parent: 86d0fa0- feat
- sidebar is the room list (wordmark, rooms, then people, your name and line at the bottom)
- friends, requests and search move to a Friends page (Ctrl K)
- people count beside the title
- stage lines full width
6 changed files +164 -178
- crates/client/src/gui.rs +1 -3
- crates/client/src/gui/builder/communities.rs +1 -2
- crates/client/src/gui/camera_view.rs +1 -1
- crates/client/src/gui/chat.rs +13 -16
- crates/client/src/gui/dock.rs +2 -2
- crates/client/src/gui/sidebar.rs +146 -154
crates/client/src/gui.rsmodified+1 -3
| @@ -1302,9 +1302,7 @@ impl Render for Yumush { | |||
| 1302 | .text_color(palette.text) | 1302 | .text_color(palette.text) |
| 1303 | .text_size(text(style::text::UI)) | 1303 | .text_size(text(style::text::UI)) |
| 1304 | .track_focus(&self.focus) | 1304 | .track_focus(&self.focus) |
| 1305 | - .on_action( | 1305 | + .on_action(cx.listener(|this, _: &FocusFind, window, cx| this.open_friends(window, cx))) |
| 1306 | - cx.listener(|this, _: &FocusFind, window, cx| this.chat.focus_find(window, cx)), | ||
| 1307 | - ) | ||
| 1308 | .on_action(cx.listener(|this, _: &CloseSettings, window, cx| { | 1306 | .on_action(cx.listener(|this, _: &CloseSettings, window, cx| { |
| 1309 | if this.fullscreen { | 1307 | if this.fullscreen { |
| 1310 | this.toggle_fullscreen(cx); | 1308 | this.toggle_fullscreen(cx); |
crates/client/src/gui/builder/communities.rsmodified+1 -2
| @@ -249,8 +249,7 @@ impl Yumush { | |||
| 249 | ) { | 249 | ) { |
| 250 | let community_id = community.id; | 250 | let community_id = community.id; |
| 251 | if self.chat.joined(community_id) { | 251 | if self.chat.joined(community_id) { |
| 252 | - let direct = community.kind.is_direct(); | 252 | + self.go_to_community(community_id, window, cx); |
| 253 | - self.go_to_community(community_id, direct, window, cx); | ||
| 254 | } else { | 253 | } else { |
| 255 | self.open_builder_community(community, window, cx); | 254 | self.open_builder_community(community, window, cx); |
| 256 | } | 255 | } |
crates/client/src/gui/camera_view.rsmodified+1 -1
| @@ -268,7 +268,7 @@ impl Yumush { | |||
| 268 | voice_line(self.chat.waves.voice(user.id), voice, t), | 268 | voice_line(self.chat.waves.voice(user.id), voice, t), |
| 269 | t, | 269 | t, |
| 270 | ) | 270 | ) |
| 271 | - .w(px(size::TALK)) | 271 | + .w_full() |
| 272 | }); | 272 | }); |
| 273 | div() | 273 | div() |
| 274 | .flex() | 274 | .flex() |
crates/client/src/gui/chat.rsmodified+13 -16
| @@ -24,7 +24,7 @@ use crate::gui::{ | |||
| 24 | profile::profile_popover, | 24 | profile::profile_popover, |
| 25 | rank_tag, | 25 | rank_tag, |
| 26 | share_view::Viewer, | 26 | share_view::Viewer, |
| 27 | - sidebar::{SidebarTab, unread_badge}, | 27 | + sidebar::unread_badge, |
| 28 | snippet, | 28 | snippet, |
| 29 | voice_note::{self, VoiceNote}, | 29 | voice_note::{self, VoiceNote}, |
| 30 | widget::{ok_or_notify, search_text, spawn_done}, | 30 | widget::{ok_or_notify, search_text, spawn_done}, |
| @@ -76,6 +76,7 @@ pub enum View { | |||
| 76 | Settings, | 76 | Settings, |
| 77 | CommunitySettings, | 77 | CommunitySettings, |
| 78 | Builder, | 78 | Builder, |
| 79 | + Friends, | ||
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 82 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| @@ -143,7 +144,6 @@ pub struct Chat { | |||
| 143 | pub(super) community_hits: Vec<MessageHit>, | 144 | pub(super) community_hits: Vec<MessageHit>, |
| 144 | pub(super) found: Option<User>, | 145 | pub(super) found: Option<User>, |
| 145 | pub(super) invite: InviteLookup, | 146 | pub(super) invite: InviteLookup, |
| 146 | - pub(super) tab: SidebarTab, | ||
| 147 | pub(super) sidebar_collapsed: bool, | 147 | pub(super) sidebar_collapsed: bool, |
| 148 | pub(super) composer: Composer, | 148 | pub(super) composer: Composer, |
| 149 | pub(super) drafts: HashMap<Id, String>, | 149 | pub(super) drafts: HashMap<Id, String>, |
| @@ -389,7 +389,6 @@ impl Chat { | |||
| 389 | community_hits: vec![], | 389 | community_hits: vec![], |
| 390 | found: None, | 390 | found: None, |
| 391 | invite: InviteLookup::Idle, | 391 | invite: InviteLookup::Idle, |
| 392 | - tab: SidebarTab::Communities, | ||
| 393 | sidebar_collapsed: false, | 392 | sidebar_collapsed: false, |
| 394 | view: View::Chat, | 393 | view: View::Chat, |
| 395 | section: 0, | 394 | section: 0, |
| @@ -550,12 +549,6 @@ impl Chat { | |||
| 550 | } | 549 | } |
| 551 | } | 550 | } |
| 552 | 551 | ||
| 553 | - pub fn focus_find(&mut self, window: &mut Window, cx: &mut Context<Yumush>) { | ||
| 554 | - self.tab = SidebarTab::Messages; | ||
| 555 | - self.search_input | ||
| 556 | - .update(cx, |input, cx| input.focus(window, cx)); | ||
| 557 | - } | ||
| 558 | - | ||
| 559 | pub fn slow_seconds(&self) -> Option<u64> { | 552 | pub fn slow_seconds(&self) -> Option<u64> { |
| 560 | let remaining = self.slowed_until?.saturating_sub(common::time::now_ms()); | 553 | let remaining = self.slowed_until?.saturating_sub(common::time::now_ms()); |
| 561 | (remaining > 0).then(|| remaining.div_ceil(1000)) | 554 | (remaining > 0).then(|| remaining.div_ceil(1000)) |
| @@ -1296,7 +1289,10 @@ impl RenderOnce for MembersTrigger { | |||
| 1296 | .rounded(px(radius::MD)) | 1289 | .rounded(px(radius::MD)) |
| 1297 | .text_size(text(text::LABEL)) | 1290 | .text_size(text(text::LABEL)) |
| 1298 | .text_color(palette.muted) | 1291 | .text_color(palette.muted) |
| 1299 | - .child(format!("{} people", self.members.len())), | 1292 | + .child(match self.members.len() { |
| 1293 | + 1 => "1 person".to_string(), | ||
| 1294 | + count => format!("{count} people"), | ||
| 1295 | + }), | ||
| 1300 | palette, | 1296 | palette, |
| 1301 | ) | 1297 | ) |
| 1302 | } | 1298 | } |
| @@ -1312,11 +1308,7 @@ impl Yumush { | |||
| 1312 | .flex_row() | 1308 | .flex_row() |
| 1313 | .size_full() | 1309 | .size_full() |
| 1314 | .when(self.chat.view == View::Chat, |page| { | 1310 | .when(self.chat.view == View::Chat, |page| { |
| 1315 | - page.child(self.sidebar( | 1311 | + page.child(self.sidebar(&entity, palette)) |
| 1316 | - &entity, | ||
| 1317 | - &search_text(&self.chat.search_input, cx), | ||
| 1318 | - palette, | ||
| 1319 | - )) | ||
| 1320 | }) | 1312 | }) |
| 1321 | .child(self.main_panel(&entity, palette, cx)) | 1313 | .child(self.main_panel(&entity, palette, cx)) |
| 1322 | .children(self.fullscreen_viewer(&entity, palette)) | 1314 | .children(self.fullscreen_viewer(&entity, palette)) |
| @@ -1337,6 +1329,11 @@ impl Yumush { | |||
| 1337 | .map(|panel| match self.chat.view { | 1329 | .map(|panel| match self.chat.view { |
| 1338 | View::Settings => panel.child(self.settings_page(entity, palette, cx)), | 1330 | View::Settings => panel.child(self.settings_page(entity, palette, cx)), |
| 1339 | View::Builder => panel.child(self.builder_page(entity, palette, cx)), | 1331 | View::Builder => panel.child(self.builder_page(entity, palette, cx)), |
| 1332 | + View::Friends => panel.child(self.friends_page( | ||
| 1333 | + entity, | ||
| 1334 | + &search_text(&self.chat.search_input, cx), | ||
| 1335 | + palette, | ||
| 1336 | + )), | ||
| 1340 | View::CommunitySettings => { | 1337 | View::CommunitySettings => { |
| 1341 | panel.child(self.community_settings_page(entity, palette, cx)) | 1338 | panel.child(self.community_settings_page(entity, palette, cx)) |
| 1342 | } | 1339 | } |
| @@ -1417,6 +1414,7 @@ impl Yumush { | |||
| 1417 | super::parts::Ink::Paper, | 1414 | super::parts::Ink::Paper, |
| 1418 | palette.tokens, | 1415 | palette.tokens, |
| 1419 | )) | 1416 | )) |
| 1417 | + .children(group.then(|| members_popover(entity, self, palette))) | ||
| 1420 | .child(div().flex_1()) | 1418 | .child(div().flex_1()) |
| 1421 | .children( | 1419 | .children( |
| 1422 | community | 1420 | community |
| @@ -1435,7 +1433,6 @@ impl Yumush { | |||
| 1435 | (community.is_some() && !self.chat.pins.is_empty()) | 1433 | (community.is_some() && !self.chat.pins.is_empty()) |
| 1436 | .then(|| message_actions::pins_popover(&self.chat, entity, palette)), | 1434 | .then(|| message_actions::pins_popover(&self.chat, entity, palette)), |
| 1437 | ) | 1435 | ) |
| 1438 | - .children(group.then(|| members_popover(entity, self, palette))) | ||
| 1439 | } | 1436 | } |
| 1440 | 1437 | ||
| 1441 | fn message_area(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { | 1438 | fn message_area(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { |
crates/client/src/gui/dock.rsmodified+2 -2
| @@ -46,7 +46,7 @@ impl Yumush { | |||
| 46 | camera: self.network.share_source(Kind::Camera).is_some(), | 46 | camera: self.network.share_source(Kind::Camera).is_some(), |
| 47 | screen: self.network.share_source(Kind::Screen).is_some(), | 47 | screen: self.network.share_source(Kind::Screen).is_some(), |
| 48 | }; | 48 | }; |
| 49 | - let (go_id, direct) = (community.id, community.kind.is_direct()); | 49 | + let go_id = community.id; |
| 50 | let actions = CallActions { | 50 | let actions = CallActions { |
| 51 | mute: Rc::new(entity_action(entity, |yumush, window, cx| { | 51 | mute: Rc::new(entity_action(entity, |yumush, window, cx| { |
| 52 | yumush.toggle_mute(window, cx) | 52 | yumush.toggle_mute(window, cx) |
| @@ -65,7 +65,7 @@ impl Yumush { | |||
| 65 | cx.notify(); | 65 | cx.notify(); |
| 66 | })), | 66 | })), |
| 67 | stats: Rc::new(entity_action(entity, move |yumush, window, cx| { | 67 | stats: Rc::new(entity_action(entity, move |yumush, window, cx| { |
| 68 | - yumush.go_to_community(go_id, direct, window, cx); | 68 | + yumush.go_to_community(go_id, window, cx); |
| 69 | yumush.chat.stats_open = !yumush.chat.stats_open; | 69 | yumush.chat.stats_open = !yumush.chat.stats_open; |
| 70 | cx.notify(); | 70 | cx.notify(); |
| 71 | })), | 71 | })), |
crates/client/src/gui/sidebar.rsmodified+146 -154
| @@ -29,24 +29,13 @@ use super::{ | |||
| 29 | presence_avatar, | 29 | presence_avatar, |
| 30 | profile::profile_popover, | 30 | profile::profile_popover, |
| 31 | social::Relation, | 31 | social::Relation, |
| 32 | - style::{radius, size, space, stroke, text}, | 32 | + style::{radius, size, space, text}, |
| 33 | wave::mini_wave, | 33 | wave::mini_wave, |
| 34 | widget::{bare_input, compact_frame, icon_button}, | 34 | widget::{bare_input, compact_frame, icon_button}, |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | -#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| 38 | -pub enum SidebarTab { | ||
| 39 | - Messages, | ||
| 40 | - Communities, | ||
| 41 | -} | ||
| 42 | - | ||
| 43 | impl Yumush { | 37 | impl Yumush { |
| 44 | - pub(super) fn sidebar( | 38 | + pub(super) fn sidebar(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { |
| 45 | - &self, | ||
| 46 | - entity: &Entity<Self>, | ||
| 47 | - query: &str, | ||
| 48 | - palette: Palette, | ||
| 49 | - ) -> impl IntoElement { | ||
| 50 | let collapsed = self.chat.sidebar_collapsed; | 39 | let collapsed = self.chat.sidebar_collapsed; |
| 51 | let (from, to, id) = if collapsed { | 40 | let (from, to, id) = if collapsed { |
| 52 | (size::SIDEBAR, size::ROW, "sidebar_collapsing") | 41 | (size::SIDEBAR, size::ROW, "sidebar_collapsing") |
| @@ -56,7 +45,7 @@ impl Yumush { | |||
| 56 | let content = if collapsed { | 45 | let content = if collapsed { |
| 57 | self.collapsed_sidebar(entity, palette).into_any_element() | 46 | self.collapsed_sidebar(entity, palette).into_any_element() |
| 58 | } else { | 47 | } else { |
| 59 | - self.expanded_sidebar(entity, query, palette) | 48 | + self.expanded_sidebar(entity, palette) |
| 60 | }; | 49 | }; |
| 61 | 50 | ||
| 62 | div() | 51 | div() |
| @@ -94,43 +83,77 @@ impl Yumush { | |||
| 94 | ) | 83 | ) |
| 95 | } | 84 | } |
| 96 | 85 | ||
| 97 | - fn expanded_sidebar(&self, entity: &Entity<Self>, query: &str, palette: Palette) -> AnyElement { | 86 | + fn expanded_sidebar(&self, entity: &Entity<Self>, palette: Palette) -> AnyElement { |
| 98 | - let (top, list) = match self.chat.tab { | 87 | + let friends_alert = |
| 99 | - SidebarTab::Messages => ( | 88 | + !self.chat.friends.incoming.is_empty() || !self.chat.invitations.is_empty(); |
| 100 | - Some(input_box(&self.chat.search_input, palette)), | ||
| 101 | - self.messages_list(entity, query, palette) | ||
| 102 | - .into_any_element(), | ||
| 103 | - ), | ||
| 104 | - SidebarTab::Communities => ( | ||
| 105 | - None, | ||
| 106 | - self.communities_list(entity, palette).into_any_element(), | ||
| 107 | - ), | ||
| 108 | - }; | ||
| 109 | 89 | ||
| 110 | div() | 90 | div() |
| 111 | .h_full() | 91 | .h_full() |
| 112 | .w(px(size::SIDEBAR)) | 92 | .w(px(size::SIDEBAR)) |
| 113 | .flex() | 93 | .flex() |
| 114 | .flex_col() | 94 | .flex_col() |
| 115 | - .py(px(space::MD)) | 95 | + .py(px(space::LG)) |
| 116 | - .px(px(space::MD)) | 96 | + .px(px(space::LG)) |
| 117 | - .gap(px(space::LG)) | 97 | + .gap(px(space::XL)) |
| 118 | .child( | 98 | .child( |
| 119 | div() | 99 | div() |
| 100 | + .h(px(size::CONTROL)) | ||
| 120 | .flex() | 101 | .flex() |
| 121 | .items_center() | 102 | .items_center() |
| 122 | - .gap(px(space::SM)) | 103 | + .gap(px(space::XXS)) |
| 123 | - .child(self.tab_bar(entity, palette)) | 104 | + .child( |
| 105 | + div() | ||
| 106 | + .id("wordmark") | ||
| 107 | + .flex_1() | ||
| 108 | + .px(px(space::SM)) | ||
| 109 | + .text_size(text(text::TITLE)) | ||
| 110 | + .font_weight(FontWeight::SEMIBOLD) | ||
| 111 | + .text_color(palette.text) | ||
| 112 | + .context_menu(new_community_menu(entity)) | ||
| 113 | + .child("yumuş"), | ||
| 114 | + ) | ||
| 115 | + .child( | ||
| 116 | + div() | ||
| 117 | + .relative() | ||
| 118 | + .child(icon_button( | ||
| 119 | + "friends_button", | ||
| 120 | + palette, | ||
| 121 | + IconName::Users, | ||
| 122 | + "Friends", | ||
| 123 | + entity_action(entity, |yumush, window, cx| { | ||
| 124 | + yumush.open_friends(window, cx) | ||
| 125 | + }), | ||
| 126 | + )) | ||
| 127 | + .children(friends_alert.then(|| { | ||
| 128 | + div() | ||
| 129 | + .absolute() | ||
| 130 | + .top(px(space::XS)) | ||
| 131 | + .right(px(space::XS)) | ||
| 132 | + .size(px(space::XS + space::XXS)) | ||
| 133 | + .rounded_full() | ||
| 134 | + .bg(palette.text) | ||
| 135 | + })), | ||
| 136 | + ) | ||
| 124 | .child(self.collapse_button(entity, palette)), | 137 | .child(self.collapse_button(entity, palette)), |
| 125 | ) | 138 | ) |
| 126 | - .children(top) | ||
| 127 | .child( | 139 | .child( |
| 128 | div() | 140 | div() |
| 129 | .id("sidebar_list") | 141 | .id("sidebar_list") |
| 130 | .flex_1() | 142 | .flex_1() |
| 131 | .min_h_0() | 143 | .min_h_0() |
| 132 | .overflow_y_scroll() | 144 | .overflow_y_scroll() |
| 133 | - .child(list), | 145 | + .flex() |
| 146 | + .flex_col() | ||
| 147 | + .gap(px(space::XL)) | ||
| 148 | + .child(self.communities_list(entity, palette)) | ||
| 149 | + .child( | ||
| 150 | + div() | ||
| 151 | + .flex() | ||
| 152 | + .flex_col() | ||
| 153 | + .gap(px(space::XXS)) | ||
| 154 | + .child(self.notes_row(entity, palette)) | ||
| 155 | + .children(self.direct_rows(entity, "", palette)), | ||
| 156 | + ), | ||
| 134 | ) | 157 | ) |
| 135 | .children(self.account_row(entity, palette)) | 158 | .children(self.account_row(entity, palette)) |
| 136 | .into_any_element() | 159 | .into_any_element() |
| @@ -138,14 +161,14 @@ impl Yumush { | |||
| 138 | 161 | ||
| 139 | fn voice_chip(&self, community_id: Id, palette: Palette) -> AnyElement { | 162 | fn voice_chip(&self, community_id: Id, palette: Palette) -> AnyElement { |
| 140 | let ids = self.chat.voice_ids(community_id); | 163 | let ids = self.chat.voice_ids(community_id); |
| 141 | - let wave = ids | 164 | + let speaker = ids |
| 142 | .iter() | 165 | .iter() |
| 143 | - .filter(|id| self.chat.waves.speaking.contains(id)) | 166 | + .find(|id| self.chat.waves.speaking.contains(id)) |
| 144 | - .find_map(|id| self.chat.waves.voice(*id)); | 167 | + .copied(); |
| 145 | - let voice = if wave.is_some() { | 168 | + let wave = speaker.and_then(|id| self.chat.waves.voice(id)); |
| 146 | - super::parts::Voice::Live(palette.ok) | 169 | + let voice = match speaker { |
| 147 | - } else { | 170 | + Some(id) => super::parts::Voice::Live(palette.tokens.person(id)), |
| 148 | - super::parts::Voice::Quiet | 171 | + None => super::parts::Voice::Quiet, |
| 149 | }; | 172 | }; |
| 150 | div() | 173 | div() |
| 151 | .id(format!("voice_chip_{community_id}")) | 174 | .id(format!("voice_chip_{community_id}")) |
| @@ -320,18 +343,12 @@ impl Yumush { | |||
| 320 | pub(super) fn go_to_community( | 343 | pub(super) fn go_to_community( |
| 321 | &mut self, | 344 | &mut self, |
| 322 | community_id: Id, | 345 | community_id: Id, |
| 323 | - direct: bool, | ||
| 324 | window: &mut Window, | 346 | window: &mut Window, |
| 325 | cx: &mut Context<Self>, | 347 | cx: &mut Context<Self>, |
| 326 | ) { | 348 | ) { |
| 327 | if self.chat.view == View::Chat && self.chat.is_selected(community_id) { | 349 | if self.chat.view == View::Chat && self.chat.is_selected(community_id) { |
| 328 | return; | 350 | return; |
| 329 | } | 351 | } |
| 330 | - self.chat.tab = if direct { | ||
| 331 | - SidebarTab::Messages | ||
| 332 | - } else { | ||
| 333 | - SidebarTab::Communities | ||
| 334 | - }; | ||
| 335 | self.show_view(View::Chat, window, cx); | 352 | self.show_view(View::Chat, window, cx); |
| 336 | self.select_community(community_id, window, cx); | 353 | self.select_community(community_id, window, cx); |
| 337 | } | 354 | } |
| @@ -360,66 +377,12 @@ impl Yumush { | |||
| 360 | .into_any_element() | 377 | .into_any_element() |
| 361 | } | 378 | } |
| 362 | 379 | ||
| 363 | - fn tab_bar(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { | 380 | + pub(super) fn friends_page( |
| 364 | - let requests = (self.chat.friends.incoming.len() + self.chat.invitations.len()) as u32; | 381 | + &self, |
| 365 | - let direct = self.chat.unread_direct(); | 382 | + entity: &Entity<Self>, |
| 366 | - let tabs = [ | 383 | + query: &str, |
| 367 | - ( | 384 | + palette: Palette, |
| 368 | - SidebarTab::Communities, | 385 | + ) -> impl IntoElement { |
| 369 | - "Communities", | ||
| 370 | - self.chat.unread_groups(), | ||
| 371 | - ), | ||
| 372 | - ( | ||
| 373 | - SidebarTab::Messages, | ||
| 374 | - "Messages", | ||
| 375 | - Unread { | ||
| 376 | - messages: direct.messages + requests, | ||
| 377 | - mentions: direct.mentions + requests, | ||
| 378 | - ..direct | ||
| 379 | - }, | ||
| 380 | - ), | ||
| 381 | - ]; | ||
| 382 | - | ||
| 383 | - div() | ||
| 384 | - .flex_1() | ||
| 385 | - .flex() | ||
| 386 | - .items_center() | ||
| 387 | - .gap(px(space::LG)) | ||
| 388 | - .children(tabs.map(|(tab, label, alert)| { | ||
| 389 | - let active = self.chat.tab == tab; | ||
| 390 | - let item = clickable( | ||
| 391 | - label, | ||
| 392 | - palette, | ||
| 393 | - entity_action(entity, move |yumush, window, cx| { | ||
| 394 | - yumush.set_sidebar_tab(tab, window, cx) | ||
| 395 | - }), | ||
| 396 | - ) | ||
| 397 | - .flex() | ||
| 398 | - .flex_col() | ||
| 399 | - .gap(px(space::XXS)) | ||
| 400 | - .text_size(text(text::CAPTION)) | ||
| 401 | - .text_color(if active { palette.text } else { palette.muted }) | ||
| 402 | - .when(active, |item| item.font_weight(FontWeight::MEDIUM)) | ||
| 403 | - .child( | ||
| 404 | - div() | ||
| 405 | - .flex() | ||
| 406 | - .items_center() | ||
| 407 | - .gap(px(space::XS)) | ||
| 408 | - .child(label) | ||
| 409 | - .children(unread_badge(palette, false, Some(&alert))), | ||
| 410 | - ) | ||
| 411 | - .children(active.then(|| div().h(px(stroke::LINE)).bg(palette.text))); | ||
| 412 | - | ||
| 413 | - match tab { | ||
| 414 | - SidebarTab::Communities => item | ||
| 415 | - .context_menu(new_community_menu(entity)) | ||
| 416 | - .into_any_element(), | ||
| 417 | - SidebarTab::Messages => item.into_any_element(), | ||
| 418 | - } | ||
| 419 | - })) | ||
| 420 | - } | ||
| 421 | - | ||
| 422 | - fn messages_list(&self, entity: &Entity<Self>, query: &str, palette: Palette) -> Div { | ||
| 423 | let found = self | 386 | let found = self |
| 424 | .chat | 387 | .chat |
| 425 | .found | 388 | .found |
| @@ -427,29 +390,49 @@ impl Yumush { | |||
| 427 | .filter(|user| !self.is_listed(user.id)); | 390 | .filter(|user| !self.is_listed(user.id)); |
| 428 | 391 | ||
| 429 | div() | 392 | div() |
| 393 | + .flex_1() | ||
| 394 | + .min_h_0() | ||
| 430 | .flex() | 395 | .flex() |
| 431 | .flex_col() | 396 | .flex_col() |
| 432 | - .gap(px(space::LG)) | 397 | + .child(super::settings_page::header(entity, palette, "Friends")) |
| 433 | - .child(self.notes_row(entity, palette)) | ||
| 434 | - .children(found.map(|user| self.found_row(entity, user, palette))) | ||
| 435 | - .children( | ||
| 436 | - query | ||
| 437 | - .is_empty() | ||
| 438 | - .then(|| self.requests(entity, palette)) | ||
| 439 | - .flatten(), | ||
| 440 | - ) | ||
| 441 | .child( | 398 | .child( |
| 442 | div() | 399 | div() |
| 443 | - .flex() | 400 | + .id("friends_scroll") |
| 444 | - .flex_col() | 401 | + .flex_1() |
| 445 | - .gap(px(space::XXS)) | 402 | + .min_h_0() |
| 446 | - .children(self.direct_rows(entity, query, palette)), | 403 | + .overflow_y_scroll() |
| 404 | + .child( | ||
| 405 | + div() | ||
| 406 | + .w_full() | ||
| 407 | + .max_w(px(size::SIDEBAR + size::PAGE)) | ||
| 408 | + .pl(px(size::SIDEBAR + space::XL)) | ||
| 409 | + .pr(px(space::XL)) | ||
| 410 | + .py(px(space::LG)) | ||
| 411 | + .flex() | ||
| 412 | + .flex_col() | ||
| 413 | + .gap(px(space::XL)) | ||
| 414 | + .child(input_box(&self.chat.search_input, palette)) | ||
| 415 | + .children(found.map(|user| self.found_row(entity, user, palette))) | ||
| 416 | + .children( | ||
| 417 | + query | ||
| 418 | + .is_empty() | ||
| 419 | + .then(|| self.requests(entity, palette)) | ||
| 420 | + .flatten(), | ||
| 421 | + ) | ||
| 422 | + .children(group( | ||
| 423 | + "Friends", | ||
| 424 | + palette, | ||
| 425 | + self.friend_rows(entity, query, palette), | ||
| 426 | + )), | ||
| 427 | + ), | ||
| 447 | ) | 428 | ) |
| 448 | - .children(group( | 429 | + } |
| 449 | - "Friends", | 430 | + |
| 450 | - palette, | 431 | + pub(super) fn open_friends(&mut self, window: &mut Window, cx: &mut Context<Self>) { |
| 451 | - self.friend_rows(entity, query, palette), | 432 | + self.show_view(View::Friends, window, cx); |
| 452 | - )) | 433 | + self.chat |
| 434 | + .search_input | ||
| 435 | + .update(cx, |input, cx| input.focus(window, cx)); | ||
| 453 | } | 436 | } |
| 454 | 437 | ||
| 455 | fn notes_row(&self, entity: &Entity<Self>, palette: Palette) -> AnyElement { | 438 | fn notes_row(&self, entity: &Entity<Self>, palette: Palette) -> AnyElement { |
| @@ -830,6 +813,13 @@ impl Yumush { | |||
| 830 | named: bool, | 813 | named: bool, |
| 831 | palette: Palette, | 814 | palette: Palette, |
| 832 | ) -> impl IntoElement { | 815 | ) -> impl IntoElement { |
| 816 | + let speaking = self.chat.waves.speaking.contains(&user.id); | ||
| 817 | + let own_wave = self.chat.waves.voice(user.id); | ||
| 818 | + let own_voice = if speaking { | ||
| 819 | + super::parts::Voice::Live(palette.tokens.person(user.id)) | ||
| 820 | + } else { | ||
| 821 | + super::parts::Voice::Quiet | ||
| 822 | + }; | ||
| 833 | profile_popover( | 823 | profile_popover( |
| 834 | "account_profile", | 824 | "account_profile", |
| 835 | Anchor::BottomLeft, | 825 | Anchor::BottomLeft, |
| @@ -844,26 +834,39 @@ impl Yumush { | |||
| 844 | .gap(px(space::SM)) | 834 | .gap(px(space::SM)) |
| 845 | .px(px(space::SM)) | 835 | .px(px(space::SM)) |
| 846 | .rounded(px(radius::MD)) | 836 | .rounded(px(radius::MD)) |
| 847 | - .child(presence_avatar( | 837 | + .when(!named, |trigger| { |
| 848 | - avatar( | 838 | + trigger.child(presence_avatar( |
| 849 | - palette, | 839 | + avatar( |
| 850 | - user, | 840 | + palette, |
| 841 | + user, | ||
| 842 | + px(size::AVATAR), | ||
| 843 | + text(text::CAPTION), | ||
| 844 | + &self.chat.avatars, | ||
| 845 | + ), | ||
| 846 | + self.presence_of(user.id), | ||
| 851 | px(size::AVATAR), | 847 | px(size::AVATAR), |
| 852 | - text(text::CAPTION), | 848 | + palette, |
| 853 | - &self.chat.avatars, | 849 | + )) |
| 854 | - ), | 850 | + }) |
| 855 | - self.presence_of(user.id), | ||
| 856 | - px(size::AVATAR), | ||
| 857 | - palette, | ||
| 858 | - )) | ||
| 859 | .when(named, |trigger| { | 851 | .when(named, |trigger| { |
| 860 | - trigger.child( | 852 | + trigger |
| 861 | - div() | 853 | + .child( |
| 862 | - .flex_1() | 854 | + div() |
| 863 | - .min_w_0() | 855 | + .min_w_0() |
| 864 | - .font_weight(FontWeight::MEDIUM) | 856 | + .truncate() |
| 865 | - .child(user.username.clone()), | 857 | + .text_color(palette.muted) |
| 866 | - ) | 858 | + .child(user.username.clone()), |
| 859 | + ) | ||
| 860 | + .child( | ||
| 861 | + div() | ||
| 862 | + .w(px(size::CONTROL + space::LG)) | ||
| 863 | + .h(px(space::MD)) | ||
| 864 | + .child(super::parts::voice_line( | ||
| 865 | + own_wave, | ||
| 866 | + own_voice, | ||
| 867 | + palette.tokens, | ||
| 868 | + )), | ||
| 869 | + ) | ||
| 867 | }), | 870 | }), |
| 868 | palette, | 871 | palette, |
| 869 | ), | 872 | ), |
| @@ -871,16 +874,6 @@ impl Yumush { | |||
| 871 | .when(named, |trigger| trigger.flex_1().min_w_0()) | 874 | .when(named, |trigger| trigger.flex_1().min_w_0()) |
| 872 | } | 875 | } |
| 873 | 876 | ||
| 874 | - fn set_sidebar_tab(&mut self, tab: SidebarTab, window: &mut Window, cx: &mut Context<Self>) { | ||
| 875 | - self.chat.tab = tab; | ||
| 876 | - if tab == SidebarTab::Messages { | ||
| 877 | - self.chat | ||
| 878 | - .search_input | ||
| 879 | - .update(cx, |input, cx| input.focus(window, cx)); | ||
| 880 | - } | ||
| 881 | - cx.notify(); | ||
| 882 | - } | ||
| 883 | - | ||
| 884 | pub(super) fn open_community_settings( | 877 | pub(super) fn open_community_settings( |
| 885 | &mut self, | 878 | &mut self, |
| 886 | community_id: Id, | 879 | community_id: Id, |
| @@ -896,11 +889,10 @@ fn go_to_call( | |||
| 896 | entity: &Entity<Yumush>, | 889 | entity: &Entity<Yumush>, |
| 897 | community: &Community, | 890 | community: &Community, |
| 898 | ) -> impl Fn(&mut Window, &mut App) + 'static { | 891 | ) -> impl Fn(&mut Window, &mut App) + 'static { |
| 899 | - let direct = community.kind.is_direct(); | ||
| 900 | let go_id = community.id; | 892 | let go_id = community.id; |
| 901 | 893 | ||
| 902 | entity_action(entity, move |yumush, window, cx| { | 894 | entity_action(entity, move |yumush, window, cx| { |
| 903 | - yumush.go_to_community(go_id, direct, window, cx) | 895 | + yumush.go_to_community(go_id, window, cx) |
| 904 | }) | 896 | }) |
| 905 | } | 897 | } |
| 906 | 898 | ||