diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 7251149..e478e1b 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -275,7 +275,6 @@ pub struct Chat { pub(super) followed: Option<(Id, common::stats::Stats)>, pub(super) share_loss: HashMap<(Id, Kind), VecDeque<(u64, f32)>>, pub(super) stats_at: Option, - pub(super) offline_open: bool, pub(super) usage_monitor: crate::usage::Monitor, pub(super) ringing: HashSet, pub(super) ring_task: Option>, @@ -571,7 +570,6 @@ impl Chat { followed: None, share_loss: HashMap::new(), stats_at: None, - offline_open: false, usage_monitor: { let monitor = crate::usage::Monitor::default(); if let Some(dir) = crate::config_dir() { @@ -3290,39 +3288,16 @@ fn members_column( .children(watch(Kind::Camera)) .children(watch(Kind::Screen)) }; - let section = |title: &'static str, rows: Vec<&MemberRow>, cap: usize| { + let section = |title: &'static str, rows: Vec<&MemberRow>| { (!rows.is_empty()).then(|| { - let total = rows.len(); - let more = total.saturating_sub(cap); div() .flex() .flex_col() .child( - super::parts::caption_head(format!("{title} · {total}"), palette.tokens) + super::parts::caption_head(format!("{title} · {}", rows.len()), palette.tokens) .pb(px(space::XS)), ) - .children(rows.into_iter().take(cap).map(row)) - .when(more > 0, |this| { - this.child( - clickable( - "offline_more", - palette, - entity_action(&entity, |yumush, _, cx| { - yumush.chat.offline_open = true; - cx.notify(); - }), - ) - .h(px(size::CONTROL)) - .px(px(space::SM)) - .pl(px(space::SM + size::ICON + space::SM)) - .flex() - .items_center() - .rounded(px(radius::MD)) - .text_size(text(text::CAPTION)) - .text_color(palette.muted) - .child(w().common.more(more)), - ) - }) + .children(rows.into_iter().map(row)) }) }; let in_call: Vec<&MemberRow> = members.iter().filter(|row| row.in_voice).collect(); @@ -3344,7 +3319,7 @@ fn members_column( .flex_col() .gap(px(space::SM)) .children(join) - .children(section(w().chat.in_voice, in_call, usize::MAX)) + .children(section(w().chat.in_voice, in_call)) }); let online = members .iter() @@ -3366,20 +3341,11 @@ fn members_column( .gap(px(space::LG)) .child(room_head(yumush, palette)) .children(call) - .children(section(w().common.presence_online, online, usize::MAX)) - .children(section( - w().common.presence_offline, - offline, - if chat.offline_open { - usize::MAX - } else { - OFFLINE - }, - )), + .children(section(w().common.presence_online, online)) + .children(section(w().common.presence_offline, offline)), ) } -const OFFLINE: usize = 5; const GLIDE: Duration = Duration::from_millis(240); const GLIDE_SLACK: Duration = Duration::from_millis(100); @@ -3736,9 +3702,11 @@ fn render_message( message, builder, entity, palette, ) })) - .children( - message.deleted.then(|| w().chat.deleted), - ), + .children(message.deleted.then(|| { + message_actions::collapse_deleted( + message.id, entity, + ) + })), ) }), ) diff --git a/crates/client/src/gui/message_actions.rs b/crates/client/src/gui/message_actions.rs index 2ec16ac..a8b7a80 100644 --- a/crates/client/src/gui/message_actions.rs +++ b/crates/client/src/gui/message_actions.rs @@ -236,6 +236,20 @@ pub fn reveal_deleted(message_id: Id, entity: &Entity, palette: Palette) ) } +pub fn collapse_deleted(message_id: Id, entity: &Entity) -> Stateful
{ + let entity = entity.clone(); + div() + .id(format!("collapse_{message_id}")) + .cursor_pointer() + .on_click(move |_, _, cx| { + entity.update(cx, |yumush, cx| { + yumush.chat.revealed.remove(&message_id); + cx.notify(); + }) + }) + .child(w().chat.deleted) +} + pub fn edited_mark( message: &Message, builder: bool,