BlueGit

ict rusty-teams

feat(parity): call events as Teams system lines, rail labels Chat/Teams

- 1:1 and group call events render as one muted line like Teams ("Call ended 12m 3s", red "Call missed")
- call notices are always present; the chat bubble card and "Call back" link are gone
- rail and sidebar titles read "Chat" and "Teams"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-08 · 3 weeks ago

Hash
7f0f3b90a1de87658998e734389c8717938a4834
Parent
8677cb1a
8 files changed +70 −159
crates/app-state/src/call_rows.rs +40 −29
@@ -14,6 +14,7 @@ const AUTO_STOP_SECONDS: i64 = 5;
14 14 const WEEKDAY_STAMP_DAYS: i64 = 6;
15 15 const OWN_NAME: &str = "You";
16 16 const UNKNOWN_USER: &str = "Unknown User";
17 const MISSED_CALL_NOTICE: &str = "Call missed";
17 18
18 19 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
19 20 pub enum CallIcon {
@@ -67,7 +68,7 @@ pub struct CallCard {
67 68 pub started: bool,
68 69 pub participants: Vec<CallParticipant>,
69 70 pub extra_participants: usize,
70 pub notice: Option<CallNotice>,
71 pub notice: CallNotice,
71 72 pub recap: Option<RecapCard>,
72 73 }
73 74
@@ -123,11 +124,11 @@ pub fn roster_card(
123 124 started: false,
124 125 participants: Vec::new(),
125 126 extra_participants: 0,
126 notice: Some(CallNotice {
127 notice: CallNotice {
127 128 stamp: notice_stamp(created_at, clock),
128 129 text: event.text(|user_id, given| names.roster_name(user_id, given)),
129 130 emphasis: None,
130 }),
131 },
131 132 recap: None,
132 133 }
133 134 }
@@ -397,6 +398,7 @@ fn day_count(days: i64) -> String {
397 398 struct NoticeSource<'a> {
398 399 event: &'a CallEvent,
399 400 message_id: &'a str,
401 missed: bool,
400 402 stopped_by_meeting_end: bool,
401 403 }
402 404
@@ -404,6 +406,7 @@ fn notice_text(source: NoticeSource, names: &CallNames, meeting: &MeetingInfo) -
404 406 let NoticeSource {
405 407 event,
406 408 message_id,
409 missed,
407 410 stopped_by_meeting_end,
408 411 } = source;
409 412 let initiator = || {
@@ -412,17 +415,19 @@ fn notice_text(source: NoticeSource, names: &CallNames, meeting: &MeetingInfo) -
412 415 event.initiator_name.as_deref(),
413 416 )
414 417 };
415 match event.phase {
416 CallPhase::Ended => format!("{}:", event.title(false)),
417 CallPhase::RecordingStarted => match initiator() {
418 match (event.phase, event.call_type) {
419 _ if missed => MISSED_CALL_NOTICE.to_owned(),
420 (CallPhase::Ended, CallType::Meeting) => format!("{}:", event.title(false)),
421 (CallPhase::Ended, CallType::Call) => event.title(false).to_owned(),
422 (CallPhase::RecordingStarted, _) => match initiator() {
418 423 Some(name) => format!("{name} started recording."),
419 424 None => event.title(false).to_owned(),
420 425 },
421 CallPhase::RecordingStopped => match initiator().filter(|_| !stopped_by_meeting_end) {
426 (CallPhase::RecordingStopped, _) => match initiator().filter(|_| !stopped_by_meeting_end) {
422 427 Some(name) => format!("{name} stopped recording."),
423 428 None => format!("{}.", event.title(false)),
424 429 },
425 CallPhase::RecordingSaved => {
430 (CallPhase::RecordingSaved, _) => {
426 431 let saved = saved_to(event, names);
427 432 match meeting.expiry_days.get(message_id) {
428 433 Some(days) => format!("{saved} and will expire in {}.", day_count(*days)),
@@ -463,11 +468,6 @@ fn title(event: &CallEvent, missed: bool, names: &CallNames) -> String {
463 468 }
464 469 }
465 470
466 /// Teams draws meeting and recording events as one-line notices; 1:1 and group calls keep the card.
467 pub fn is_notice(event: &CallEvent) -> bool {
468 event.call_type == CallType::Meeting || event.is_recording()
469 }
470
471 471 pub struct CallSource<'a> {
472 472 pub event: &'a CallEvent,
473 473 pub message_id: &'a str,
@@ -501,12 +501,13 @@ pub fn call_card(
501 501 };
502 502 let extra_participants = people.len().saturating_sub(MAX_AVATARS);
503 503 people.truncate(MAX_AVATARS);
504 let notice = is_notice(event).then(|| CallNotice {
504 let notice = CallNotice {
505 505 stamp: notice_stamp(created_at, clock),
506 506 text: notice_text(
507 507 NoticeSource {
508 508 event,
509 509 message_id,
510 missed,
510 511 stopped_by_meeting_end: timeline.stopped_by_meeting_end(event, created_at),
511 512 },
512 513 names,
@@ -514,9 +515,9 @@ pub fn call_card(
514 515 ),
515 516 emphasis: event
516 517 .duration_seconds
517 .filter(|_| event.phase == CallPhase::Ended)
518 .filter(|_| event.phase == CallPhase::Ended && !missed)
518 519 .map(format_duration),
519 });
520 };
520 521 CallCard {
521 522 title: title(event, missed, names),
522 523 detail,
@@ -627,7 +628,7 @@ mod tests {
627 628 }
628 629
629 630 fn notice_line(card: &CallCard) -> String {
630 let notice = card.notice.as_ref().unwrap();
631 let notice = &card.notice;
631 632 match &notice.emphasis {
632 633 Some(emphasis) => format!("{} {emphasis}", notice.text),
633 634 None => notice.text.clone(),
@@ -805,29 +806,39 @@ mod tests {
805 806 }
806 807
807 808 #[test]
808 fn calls_keep_their_card_and_my_recording_is_in_my_onedrive() {
809 assert!(!is_notice(&event(CallPhase::Ended, CallType::Call, "c")));
810 let mut saved = event(CallPhase::RecordingSaved, CallType::Call, "c");
811 saved.recording = Some(Recording {
812 name: None,
813 url: Some("https://contoso.example/rec.mp4".to_owned()),
814 organizer_id: Some("me".to_owned()),
815 });
809 fn calls_read_like_teams_and_my_recording_is_in_my_onedrive() {
816 810 let names = HashMap::new();
817 811 let lookup = CallNames {
818 812 my_user_id: Some("me"),
819 813 names: &names,
820 814 };
821 assert_eq!(
815 let line = |event: &CallEvent, missed: bool| {
822 816 notice_text(
823 817 NoticeSource {
824 event: &saved,
818 event,
825 819 message_id: "m",
820 missed,
826 821 stopped_by_meeting_end: false,
827 822 },
828 823 &lookup,
829 &MeetingInfo::default()
830 ),
824 &MeetingInfo::default(),
825 )
826 };
827 let ended = event(CallPhase::Ended, CallType::Call, "c");
828 assert_eq!(line(&ended, false), "Call ended");
829 assert_eq!(line(&ended, true), "Call missed");
830 assert_eq!(
831 line(&event(CallPhase::Ended, CallType::Meeting, "c"), false),
832 "Meeting ended:"
833 );
834 let mut saved = event(CallPhase::RecordingSaved, CallType::Call, "c");
835 saved.recording = Some(Recording {
836 name: None,
837 url: Some("https://contoso.example/rec.mp4".to_owned()),
838 organizer_id: Some("me".to_owned()),
839 });
840 assert_eq!(
841 line(&saved, false),
831 842 "Recording has been saved to your OneDrive."
832 843 );
833 844 }
@@ -14,6 +14,7 @@ const AUTO_STOP_SECONDS: i64 = 5;
14const WEEKDAY_STAMP_DAYS: i64 = 6;
14const WEEKDAY_STAMP_DAYS: i64 = 6;
15const OWN_NAME: &str = "You";
15const OWN_NAME: &str = "You";
16const UNKNOWN_USER: &str = "Unknown User";
16const UNKNOWN_USER: &str = "Unknown User";
17const MISSED_CALL_NOTICE: &str = "Call missed";
17
18
18#[derive(Debug, Clone, Copy, PartialEq, Eq)]
19#[derive(Debug, Clone, Copy, PartialEq, Eq)]
19pub enum CallIcon {
20pub enum CallIcon {
@@ -67,7 +68,7 @@ pub struct CallCard {
67 pub started: bool,
68 pub started: bool,
68 pub participants: Vec<CallParticipant>,
69 pub participants: Vec<CallParticipant>,
69 pub extra_participants: usize,
70 pub extra_participants: usize,
70 pub notice: Option<CallNotice>,
71 pub notice: CallNotice,
71 pub recap: Option<RecapCard>,
72 pub recap: Option<RecapCard>,
72}
73}
73
74
@@ -123,11 +124,11 @@ pub fn roster_card(
123 started: false,
124 started: false,
124 participants: Vec::new(),
125 participants: Vec::new(),
125 extra_participants: 0,
126 extra_participants: 0,
126 notice: Some(CallNotice {
127 notice: CallNotice {
127 stamp: notice_stamp(created_at, clock),
128 stamp: notice_stamp(created_at, clock),
128 text: event.text(|user_id, given| names.roster_name(user_id, given)),
129 text: event.text(|user_id, given| names.roster_name(user_id, given)),
129 emphasis: None,
130 emphasis: None,
130 }),
131 },
131 recap: None,
132 recap: None,
132 }
133 }
133}
134}
@@ -397,6 +398,7 @@ fn day_count(days: i64) -> String {
397struct NoticeSource<'a> {
398struct NoticeSource<'a> {
398 event: &'a CallEvent,
399 event: &'a CallEvent,
399 message_id: &'a str,
400 message_id: &'a str,
401 missed: bool,
400 stopped_by_meeting_end: bool,
402 stopped_by_meeting_end: bool,
401}
403}
402
404
@@ -404,6 +406,7 @@ fn notice_text(source: NoticeSource, names: &CallNames, meeting: &MeetingInfo) -
404 let NoticeSource {
406 let NoticeSource {
405 event,
407 event,
406 message_id,
408 message_id,
409 missed,
407 stopped_by_meeting_end,
410 stopped_by_meeting_end,
408 } = source;
411 } = source;
409 let initiator = || {
412 let initiator = || {
@@ -412,17 +415,19 @@ fn notice_text(source: NoticeSource, names: &CallNames, meeting: &MeetingInfo) -
412 event.initiator_name.as_deref(),
415 event.initiator_name.as_deref(),
413 )
416 )
414 };
417 };
415 match event.phase {
418 match (event.phase, event.call_type) {
416 CallPhase::Ended => format!("{}:", event.title(false)),
419 _ if missed => MISSED_CALL_NOTICE.to_owned(),
417 CallPhase::RecordingStarted => match initiator() {
420 (CallPhase::Ended, CallType::Meeting) => format!("{}:", event.title(false)),
421 (CallPhase::Ended, CallType::Call) => event.title(false).to_owned(),
422 (CallPhase::RecordingStarted, _) => match initiator() {
418 Some(name) => format!("{name} started recording."),
423 Some(name) => format!("{name} started recording."),
419 None => event.title(false).to_owned(),
424 None => event.title(false).to_owned(),
420 },
425 },
421 CallPhase::RecordingStopped => match initiator().filter(|_| !stopped_by_meeting_end) {
426 (CallPhase::RecordingStopped, _) => match initiator().filter(|_| !stopped_by_meeting_end) {
422 Some(name) => format!("{name} stopped recording."),
427 Some(name) => format!("{name} stopped recording."),
423 None => format!("{}.", event.title(false)),
428 None => format!("{}.", event.title(false)),
424 },
429 },
425 CallPhase::RecordingSaved => {
430 (CallPhase::RecordingSaved, _) => {
426 let saved = saved_to(event, names);
431 let saved = saved_to(event, names);
427 match meeting.expiry_days.get(message_id) {
432 match meeting.expiry_days.get(message_id) {
428 Some(days) => format!("{saved} and will expire in {}.", day_count(*days)),
433 Some(days) => format!("{saved} and will expire in {}.", day_count(*days)),
@@ -463,11 +468,6 @@ fn title(event: &CallEvent, missed: bool, names: &CallNames) -> String {
463 }
468 }
464}
469}
465
470
466/// Teams draws meeting and recording events as one-line notices; 1:1 and group calls keep the card.
467pub fn is_notice(event: &CallEvent) -> bool {
468 event.call_type == CallType::Meeting || event.is_recording()
469}
470
471pub struct CallSource<'a> {
471pub struct CallSource<'a> {
472 pub event: &'a CallEvent,
472 pub event: &'a CallEvent,
473 pub message_id: &'a str,
473 pub message_id: &'a str,
@@ -501,12 +501,13 @@ pub fn call_card(
501 };
501 };
502 let extra_participants = people.len().saturating_sub(MAX_AVATARS);
502 let extra_participants = people.len().saturating_sub(MAX_AVATARS);
503 people.truncate(MAX_AVATARS);
503 people.truncate(MAX_AVATARS);
504 let notice = is_notice(event).then(|| CallNotice {
504 let notice = CallNotice {
505 stamp: notice_stamp(created_at, clock),
505 stamp: notice_stamp(created_at, clock),
506 text: notice_text(
506 text: notice_text(
507 NoticeSource {
507 NoticeSource {
508 event,
508 event,
509 message_id,
509 message_id,
510 missed,
510 stopped_by_meeting_end: timeline.stopped_by_meeting_end(event, created_at),
511 stopped_by_meeting_end: timeline.stopped_by_meeting_end(event, created_at),
511 },
512 },
512 names,
513 names,
@@ -514,9 +515,9 @@ pub fn call_card(
514 ),
515 ),
515 emphasis: event
516 emphasis: event
516 .duration_seconds
517 .duration_seconds
517 .filter(|_| event.phase == CallPhase::Ended)
518 .filter(|_| event.phase == CallPhase::Ended && !missed)
518 .map(format_duration),
519 .map(format_duration),
519 });
520 };
520 CallCard {
521 CallCard {
521 title: title(event, missed, names),
522 title: title(event, missed, names),
522 detail,
523 detail,
@@ -627,7 +628,7 @@ mod tests {
627 }
628 }
628
629
629 fn notice_line(card: &CallCard) -> String {
630 fn notice_line(card: &CallCard) -> String {
630 let notice = card.notice.as_ref().unwrap();
631 let notice = &card.notice;
631 match &notice.emphasis {
632 match &notice.emphasis {
632 Some(emphasis) => format!("{} {emphasis}", notice.text),
633 Some(emphasis) => format!("{} {emphasis}", notice.text),
633 None => notice.text.clone(),
634 None => notice.text.clone(),
@@ -805,29 +806,39 @@ mod tests {
805 }
806 }
806
807
807 #[test]
808 #[test]
808 fn calls_keep_their_card_and_my_recording_is_in_my_onedrive() {
809 fn calls_read_like_teams_and_my_recording_is_in_my_onedrive() {
809 assert!(!is_notice(&event(CallPhase::Ended, CallType::Call, "c")));
810 let mut saved = event(CallPhase::RecordingSaved, CallType::Call, "c");
811 saved.recording = Some(Recording {
812 name: None,
813 url: Some("https://contoso.example/rec.mp4".to_owned()),
814 organizer_id: Some("me".to_owned()),
815 });
816 let names = HashMap::new();
810 let names = HashMap::new();
817 let lookup = CallNames {
811 let lookup = CallNames {
818 my_user_id: Some("me"),
812 my_user_id: Some("me"),
819 names: &names,
813 names: &names,
820 };
814 };
821 assert_eq!(
815 let line = |event: &CallEvent, missed: bool| {
822 notice_text(
816 notice_text(
823 NoticeSource {
817 NoticeSource {
824 event: &saved,
818 event,
825 message_id: "m",
819 message_id: "m",
820 missed,
826 stopped_by_meeting_end: false,
821 stopped_by_meeting_end: false,
827 },
822 },
828 &lookup,
823 &lookup,
829 &MeetingInfo::default()
824 &MeetingInfo::default(),
830 ),
825 )
826 };
827 let ended = event(CallPhase::Ended, CallType::Call, "c");
828 assert_eq!(line(&ended, false), "Call ended");
829 assert_eq!(line(&ended, true), "Call missed");
830 assert_eq!(
831 line(&event(CallPhase::Ended, CallType::Meeting, "c"), false),
832 "Meeting ended:"
833 );
834 let mut saved = event(CallPhase::RecordingSaved, CallType::Call, "c");
835 saved.recording = Some(Recording {
836 name: None,
837 url: Some("https://contoso.example/rec.mp4".to_owned()),
838 organizer_id: Some("me".to_owned()),
839 });
840 assert_eq!(
841 line(&saved, false),
831 "Recording has been saved to your OneDrive."
842 "Recording has been saved to your OneDrive."
832 );
843 );
833 }
844 }
crates/app-state/src/rows.rs +1 −1
@@ -2309,7 +2309,7 @@ mod tests {
2309 2309 let saved = post.replies[0].call.as_ref().unwrap();
2310 2310 assert_eq!(saved.icon, CallIcon::Saved);
2311 2311 assert_eq!(
2312 saved.notice.as_ref().unwrap().text,
2312 saved.notice.text,
2313 2313 "Recording has been saved to OneDrive."
2314 2314 );
2315 2315 let thread = thread_rows(&records, &root_id, &call_context());
@@ -2309,7 +2309,7 @@ mod tests {
2309 let saved = post.replies[0].call.as_ref().unwrap();
2309 let saved = post.replies[0].call.as_ref().unwrap();
2310 assert_eq!(saved.icon, CallIcon::Saved);
2310 assert_eq!(saved.icon, CallIcon::Saved);
2311 assert_eq!(
2311 assert_eq!(
2312 saved.notice.as_ref().unwrap().text,
2312 saved.notice.text,
2313 "Recording has been saved to OneDrive."
2313 "Recording has been saved to OneDrive."
2314 );
2314 );
2315 let thread = thread_rows(&records, &root_id, &call_context());
2315 let thread = thread_rows(&records, &root_id, &call_context());
crates/app/src/views/call_card.rs +18 −107
@@ -4,14 +4,12 @@ use gpui_kit::*;
4 4
5 5 use super::avatar::person_avatar;
6 6 use super::call_notice::{RecapActions, notice_row};
7 use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker};
8 use super::profile_card::opens_profile;
7 use super::message_row::RowAction;
9 8 use super::widgets::symbol;
10 9 use crate::data::Directory;
11 10 use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow};
12 11 use crate::theme;
13 12
14 const SERIES_START_GAP: f32 = 8.;
15 13 const CARD_RADIUS: f32 = 12.;
16 14 const CARD_MIN_WIDTH: f32 = 200.;
17 15 const ICON_CIRCLE: f32 = 30.;
@@ -23,7 +21,6 @@ const PARTICIPANT_AVATAR: f32 = 20.;
23 21 const PARTICIPANT_GAP: f32 = 2.;
24 22
25 23 pub struct CallActions {
26 pub call_back: RowAction,
27 24 pub join: RowAction,
28 25 pub recap: RecapActions,
29 26 }
@@ -31,7 +28,6 @@ pub struct CallActions {
31 28 impl CallActions {
32 29 pub fn none() -> Self {
33 30 CallActions {
34 call_back: None,
35 31 join: None,
36 32 recap: RecapActions {
37 33 view_recap: None,
@@ -43,18 +39,18 @@ impl CallActions {
43 39 }
44 40 }
45 41
46 fn icon_circle(call: &CallCard, own: bool) -> Div {
42 fn icon_circle(call: &CallCard) -> Div {
47 43 let (fill, glyph, tint) = match call.icon {
48 44 CallIcon::Missed => (theme::red().opacity(0.2), "call_missed", theme::red_soft()),
49 CallIcon::Call => (circle_fill(own), "call", theme::text()),
50 CallIcon::Video => (circle_fill(own), "videocam", theme::text()),
45 CallIcon::Call => (theme::popup(), "call", theme::text()),
46 CallIcon::Video => (theme::popup(), "videocam", theme::text()),
51 47 CallIcon::Record | CallIcon::Saved => (
52 circle_fill(own),
48 theme::popup(),
53 49 "fluent_record",
54 50 theme::accent_text(),
55 51 ),
56 CallIcon::RecordStop => (circle_fill(own), "fluent_record_stop", theme::text()),
57 CallIcon::Roster => (circle_fill(own), "group", theme::text()),
52 CallIcon::RecordStop => (theme::popup(), "fluent_record_stop", theme::text()),
53 CallIcon::Roster => (theme::popup(), "group", theme::text()),
58 54 };
59 55 h_flex()
60 56 .size(px(ICON_CIRCLE))
@@ -66,38 +62,11 @@ fn icon_circle(call: &CallCard, own: bool) -> Div {
66 62 .child(symbol(glyph, ICON_SIZE, tint))
67 63 }
68 64
69 fn circle_fill(own: bool) -> Hsla {
70 if own {
71 theme::reaction_on_own()
72 } else {
73 theme::popup()
74 }
75 }
76
77 fn detail_line(call: &CallCard, index: usize, own: bool, call_back: RowAction) -> Div {
78 let tint = if own {
79 theme::own_meta()
80 } else {
81 theme::text_muted()
82 };
83 h_flex()
84 .gap(px(4.))
85 .items_center()
65 fn detail_line(call: &CallCard) -> Div {
66 div()
86 67 .text_size(px(DETAIL_SIZE))
87 .text_color(tint)
68 .text_color(theme::text_muted())
88 69 .child(call.detail.clone())
89 .when(call.missed, |line| {
90 line.child("\u{b7}").child(
91 div()
92 .id(ElementId::Name(format!("call-back-{index}").into()))
93 .cursor_pointer()
94 .text_color(theme::accent_text())
95 .child("Call back")
96 .when_some(call_back, |link, call_back| {
97 link.on_click(move |_, _, cx| call_back(cx))
98 }),
99 )
100 })
101 70 }
102 71
103 72 fn join_button(index: usize, join: RowAction) -> Stateful<Div> {
@@ -124,16 +93,11 @@ fn participant_stack(
124 93 participants: &[CallParticipant],
125 94 extra: usize,
126 95 directory: &Directory,
127 own: bool,
128 96 ) -> Option<Div> {
129 97 if participants.is_empty() {
130 98 return None;
131 99 }
132 let tint = if own {
133 theme::own_meta()
134 } else {
135 theme::text_muted()
136 };
100 let tint = theme::text_muted();
137 101 Some(
138 102 h_flex()
139 103 .pt(px(4.))
@@ -159,19 +123,13 @@ fn participant_stack(
159 123 )
160 124 }
161 125
162 fn card(
163 call: &CallCard,
164 index: usize,
165 own: bool,
166 actions: CallActions,
167 directory: &Directory,
168 ) -> Div {
169 let CallActions { call_back, join, .. } = actions;
126 fn card(call: &CallCard, index: usize, actions: CallActions, directory: &Directory) -> Div {
127 let CallActions { join, .. } = actions;
170 128 let show_join = call.started && join.is_some();
171 129 let summary = h_flex()
172 130 .gap(px(8.))
173 131 .items_center()
174 .child(icon_circle(call, own))
132 .child(icon_circle(call))
175 133 .child(
176 134 v_flex()
177 135 .flex_1()
@@ -187,12 +145,11 @@ fn card(
187 145 })
188 146 .child(call.title.clone()),
189 147 )
190 .child(detail_line(call, index, own, call_back))
148 .child(detail_line(call))
191 149 .children(participant_stack(
192 150 &call.participants,
193 151 call.extra_participants,
194 152 directory,
195 own,
196 153 )),
197 154 )
198 155 .when(show_join, |card| card.child(join_button(index, join)));
@@ -204,11 +161,7 @@ fn card(
204 161 .pb(px(8.))
205 162 .pl(px(8.))
206 163 .rounded(px(CARD_RADIUS))
207 .bg(if own {
208 theme::bubble_own()
209 } else {
210 theme::bubble_other()
211 })
164 .bg(theme::bubble_other())
212 165 .child(summary)
213 166 }
214 167
@@ -218,7 +171,7 @@ pub(super) fn post_call_card(
218 171 actions: CallActions,
219 172 directory: &Directory,
220 173 ) -> Div {
221 h_flex().child(card(call, index, false, actions, directory))
174 h_flex().child(card(call, index, actions, directory))
222 175 }
223 176
224 177 pub(super) fn call_card_row(
@@ -228,47 +181,5 @@ pub(super) fn call_card_row(
228 181 directory: &Directory,
229 182 actions: CallActions,
230 183 ) -> AnyElement {
231 if let Some(notice) = &call.notice {
232 return notice_row(row, call, notice, index, directory, actions.recap);
233 }
234 let own = row.own;
235 let body = if own {
236 h_flex()
237 .w_full()
238 .justify_end()
239 .child(card(call, index, true, actions, directory))
240 } else {
241 h_flex()
242 .w_full()
243 .gap(px(AVATAR_GAP))
244 .items_start()
245 .child(
246 opens_profile(
247 div().id(ElementId::Name(format!("author-avatar-{index}").into())),
248 row.sender_id.as_deref(),
249 )
250 .w(px(AVATAR_SIZE))
251 .flex_none()
252 .child(person_avatar(
253 directory,
254 row.sender_id.as_deref(),
255 &row.author,
256 AVATAR_SIZE,
257 )),
258 )
259 .child(card(call, index, false, actions, directory))
260 };
261 v_flex()
262 .w_full()
263 .px(px(20.))
264 .children(row.day_header.as_deref().map(day_separator))
265 .when(row.new_marker, |column| column.child(new_marker()))
266 .child(
267 div()
268 .id(ElementId::Name(format!("row-{index}").into()))
269 .w_full()
270 .pt(px(SERIES_START_GAP))
271 .child(body),
272 )
273 .into_any_element()
184 notice_row(row, call, index, directory, actions.recap)
274 185 }
@@ -4,14 +4,12 @@ use gpui_kit::*;
4
4
5use super::avatar::person_avatar;
5use super::avatar::person_avatar;
6use super::call_notice::{RecapActions, notice_row};
6use super::call_notice::{RecapActions, notice_row};
7use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker};
7use super::message_row::RowAction;
8use super::profile_card::opens_profile;
9use super::widgets::symbol;
8use super::widgets::symbol;
10use crate::data::Directory;
9use crate::data::Directory;
11use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow};
10use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow};
12use crate::theme;
11use crate::theme;
13
12
14const SERIES_START_GAP: f32 = 8.;
15const CARD_RADIUS: f32 = 12.;
13const CARD_RADIUS: f32 = 12.;
16const CARD_MIN_WIDTH: f32 = 200.;
14const CARD_MIN_WIDTH: f32 = 200.;
17const ICON_CIRCLE: f32 = 30.;
15const ICON_CIRCLE: f32 = 30.;
@@ -23,7 +21,6 @@ const PARTICIPANT_AVATAR: f32 = 20.;
23const PARTICIPANT_GAP: f32 = 2.;
21const PARTICIPANT_GAP: f32 = 2.;
24
22
25pub struct CallActions {
23pub struct CallActions {
26 pub call_back: RowAction,
27 pub join: RowAction,
24 pub join: RowAction,
28 pub recap: RecapActions,
25 pub recap: RecapActions,
29}
26}
@@ -31,7 +28,6 @@ pub struct CallActions {
31impl CallActions {
28impl CallActions {
32 pub fn none() -> Self {
29 pub fn none() -> Self {
33 CallActions {
30 CallActions {
34 call_back: None,
35 join: None,
31 join: None,
36 recap: RecapActions {
32 recap: RecapActions {
37 view_recap: None,
33 view_recap: None,
@@ -43,18 +39,18 @@ impl CallActions {
43 }
39 }
44}
40}
45
41
46fn icon_circle(call: &CallCard, own: bool) -> Div {
42fn icon_circle(call: &CallCard) -> Div {
47 let (fill, glyph, tint) = match call.icon {
43 let (fill, glyph, tint) = match call.icon {
48 CallIcon::Missed => (theme::red().opacity(0.2), "call_missed", theme::red_soft()),
44 CallIcon::Missed => (theme::red().opacity(0.2), "call_missed", theme::red_soft()),
49 CallIcon::Call => (circle_fill(own), "call", theme::text()),
45 CallIcon::Call => (theme::popup(), "call", theme::text()),
50 CallIcon::Video => (circle_fill(own), "videocam", theme::text()),
46 CallIcon::Video => (theme::popup(), "videocam", theme::text()),
51 CallIcon::Record | CallIcon::Saved => (
47 CallIcon::Record | CallIcon::Saved => (
52 circle_fill(own),
48 theme::popup(),
53 "fluent_record",
49 "fluent_record",
54 theme::accent_text(),
50 theme::accent_text(),
55 ),
51 ),
56 CallIcon::RecordStop => (circle_fill(own), "fluent_record_stop", theme::text()),
52 CallIcon::RecordStop => (theme::popup(), "fluent_record_stop", theme::text()),
57 CallIcon::Roster => (circle_fill(own), "group", theme::text()),
53 CallIcon::Roster => (theme::popup(), "group", theme::text()),
58 };
54 };
59 h_flex()
55 h_flex()
60 .size(px(ICON_CIRCLE))
56 .size(px(ICON_CIRCLE))
@@ -66,38 +62,11 @@ fn icon_circle(call: &CallCard, own: bool) -> Div {
66 .child(symbol(glyph, ICON_SIZE, tint))
62 .child(symbol(glyph, ICON_SIZE, tint))
67}
63}
68
64
69fn circle_fill(own: bool) -> Hsla {
65fn detail_line(call: &CallCard) -> Div {
70 if own {
66 div()
71 theme::reaction_on_own()
72 } else {
73 theme::popup()
74 }
75}
76
77fn detail_line(call: &CallCard, index: usize, own: bool, call_back: RowAction) -> Div {
78 let tint = if own {
79 theme::own_meta()
80 } else {
81 theme::text_muted()
82 };
83 h_flex()
84 .gap(px(4.))
85 .items_center()
86 .text_size(px(DETAIL_SIZE))
67 .text_size(px(DETAIL_SIZE))
87 .text_color(tint)
68 .text_color(theme::text_muted())
88 .child(call.detail.clone())
69 .child(call.detail.clone())
89 .when(call.missed, |line| {
90 line.child("\u{b7}").child(
91 div()
92 .id(ElementId::Name(format!("call-back-{index}").into()))
93 .cursor_pointer()
94 .text_color(theme::accent_text())
95 .child("Call back")
96 .when_some(call_back, |link, call_back| {
97 link.on_click(move |_, _, cx| call_back(cx))
98 }),
99 )
100 })
101}
70}
102
71
103fn join_button(index: usize, join: RowAction) -> Stateful<Div> {
72fn join_button(index: usize, join: RowAction) -> Stateful<Div> {
@@ -124,16 +93,11 @@ fn participant_stack(
124 participants: &[CallParticipant],
93 participants: &[CallParticipant],
125 extra: usize,
94 extra: usize,
126 directory: &Directory,
95 directory: &Directory,
127 own: bool,
128) -> Option<Div> {
96) -> Option<Div> {
129 if participants.is_empty() {
97 if participants.is_empty() {
130 return None;
98 return None;
131 }
99 }
132 let tint = if own {
100 let tint = theme::text_muted();
133 theme::own_meta()
134 } else {
135 theme::text_muted()
136 };
137 Some(
101 Some(
138 h_flex()
102 h_flex()
139 .pt(px(4.))
103 .pt(px(4.))
@@ -159,19 +123,13 @@ fn participant_stack(
159 )
123 )
160}
124}
161
125
162fn card(
126fn card(call: &CallCard, index: usize, actions: CallActions, directory: &Directory) -> Div {
163 call: &CallCard,
127 let CallActions { join, .. } = actions;
164 index: usize,
165 own: bool,
166 actions: CallActions,
167 directory: &Directory,
168) -> Div {
169 let CallActions { call_back, join, .. } = actions;
170 let show_join = call.started && join.is_some();
128 let show_join = call.started && join.is_some();
171 let summary = h_flex()
129 let summary = h_flex()
172 .gap(px(8.))
130 .gap(px(8.))
173 .items_center()
131 .items_center()
174 .child(icon_circle(call, own))
132 .child(icon_circle(call))
175 .child(
133 .child(
176 v_flex()
134 v_flex()
177 .flex_1()
135 .flex_1()
@@ -187,12 +145,11 @@ fn card(
187 })
145 })
188 .child(call.title.clone()),
146 .child(call.title.clone()),
189 )
147 )
190 .child(detail_line(call, index, own, call_back))
148 .child(detail_line(call))
191 .children(participant_stack(
149 .children(participant_stack(
192 &call.participants,
150 &call.participants,
193 call.extra_participants,
151 call.extra_participants,
194 directory,
152 directory,
195 own,
196 )),
153 )),
197 )
154 )
198 .when(show_join, |card| card.child(join_button(index, join)));
155 .when(show_join, |card| card.child(join_button(index, join)));
@@ -204,11 +161,7 @@ fn card(
204 .pb(px(8.))
161 .pb(px(8.))
205 .pl(px(8.))
162 .pl(px(8.))
206 .rounded(px(CARD_RADIUS))
163 .rounded(px(CARD_RADIUS))
207 .bg(if own {
164 .bg(theme::bubble_other())
208 theme::bubble_own()
209 } else {
210 theme::bubble_other()
211 })
212 .child(summary)
165 .child(summary)
213}
166}
214
167
@@ -218,7 +171,7 @@ pub(super) fn post_call_card(
218 actions: CallActions,
171 actions: CallActions,
219 directory: &Directory,
172 directory: &Directory,
220) -> Div {
173) -> Div {
221 h_flex().child(card(call, index, false, actions, directory))
174 h_flex().child(card(call, index, actions, directory))
222}
175}
223
176
224pub(super) fn call_card_row(
177pub(super) fn call_card_row(
@@ -228,47 +181,5 @@ pub(super) fn call_card_row(
228 directory: &Directory,
181 directory: &Directory,
229 actions: CallActions,
182 actions: CallActions,
230) -> AnyElement {
183) -> AnyElement {
231 if let Some(notice) = &call.notice {
184 notice_row(row, call, index, directory, actions.recap)
232 return notice_row(row, call, notice, index, directory, actions.recap);
233 }
234 let own = row.own;
235 let body = if own {
236 h_flex()
237 .w_full()
238 .justify_end()
239 .child(card(call, index, true, actions, directory))
240 } else {
241 h_flex()
242 .w_full()
243 .gap(px(AVATAR_GAP))
244 .items_start()
245 .child(
246 opens_profile(
247 div().id(ElementId::Name(format!("author-avatar-{index}").into())),
248 row.sender_id.as_deref(),
249 )
250 .w(px(AVATAR_SIZE))
251 .flex_none()
252 .child(person_avatar(
253 directory,
254 row.sender_id.as_deref(),
255 &row.author,
256 AVATAR_SIZE,
257 )),
258 )
259 .child(card(call, index, false, actions, directory))
260 };
261 v_flex()
262 .w_full()
263 .px(px(20.))
264 .children(row.day_header.as_deref().map(day_separator))
265 .when(row.new_marker, |column| column.child(new_marker()))
266 .child(
267 div()
268 .id(ElementId::Name(format!("row-{index}").into()))
269 .w_full()
270 .pt(px(SERIES_START_GAP))
271 .child(body),
272 )
273 .into_any_element()
274}
185}
crates/app/src/views/call_notice.rs +5 −7
@@ -51,9 +51,9 @@ fn notice_icon(icon: CallIcon) -> (&'static str, Hsla) {
51 51 CallIcon::RecordStop => ("fluent_record_stop", theme::text_muted()),
52 52 CallIcon::Saved => ("fluent_cloud_arrow_up", theme::text_muted()),
53 53 CallIcon::Roster => ("group", theme::text_muted()),
54 CallIcon::Video | CallIcon::Call | CallIcon::Missed => {
55 ("fluent_video", theme::text_muted())
56 }
54 CallIcon::Missed => ("call_missed", theme::red_soft()),
55 CallIcon::Call => ("call", theme::text_muted()),
56 CallIcon::Video => ("fluent_video", theme::text_muted()),
57 57 }
58 58 }
59 59
@@ -318,7 +318,6 @@ fn card_shadow() -> Vec<BoxShadow> {
318 318
319 319 pub(super) fn notice_line(
320 320 call: &CallCard,
321 notice: &CallNotice,
322 321 index: usize,
323 322 directory: &Directory,
324 323 actions: RecapActions,
@@ -347,7 +346,7 @@ pub(super) fn notice_line(
347 346 .text_size(px(TEXT_SIZE))
348 347 .line_height(px(LINE_HEIGHT))
349 348 .text_color(theme::text_muted())
350 .child(notice_text(notice)),
349 .child(notice_text(&call.notice)),
351 350 )
352 351 .children(
353 352 call.recap
@@ -360,7 +359,6 @@ pub(super) fn notice_line(
360 359 pub(super) fn notice_row(
361 360 row: &MessageRow,
362 361 call: &CallCard,
363 notice: &CallNotice,
364 362 index: usize,
365 363 directory: &Directory,
366 364 actions: RecapActions,
@@ -374,7 +372,7 @@ pub(super) fn notice_row(
374 372 div()
375 373 .id(ElementId::Name(format!("row-{index}").into()))
376 374 .w_full()
377 .child(notice_line(call, notice, index, directory, actions)),
375 .child(notice_line(call, index, directory, actions)),
378 376 )
379 377 .into_any_element()
380 378 }
@@ -51,9 +51,9 @@ fn notice_icon(icon: CallIcon) -> (&'static str, Hsla) {
51 CallIcon::RecordStop => ("fluent_record_stop", theme::text_muted()),
51 CallIcon::RecordStop => ("fluent_record_stop", theme::text_muted()),
52 CallIcon::Saved => ("fluent_cloud_arrow_up", theme::text_muted()),
52 CallIcon::Saved => ("fluent_cloud_arrow_up", theme::text_muted()),
53 CallIcon::Roster => ("group", theme::text_muted()),
53 CallIcon::Roster => ("group", theme::text_muted()),
54 CallIcon::Video | CallIcon::Call | CallIcon::Missed => {
54 CallIcon::Missed => ("call_missed", theme::red_soft()),
55 ("fluent_video", theme::text_muted())
55 CallIcon::Call => ("call", theme::text_muted()),
56 }
56 CallIcon::Video => ("fluent_video", theme::text_muted()),
57 }
57 }
58}
58}
59
59
@@ -318,7 +318,6 @@ fn card_shadow() -> Vec<BoxShadow> {
318
318
319pub(super) fn notice_line(
319pub(super) fn notice_line(
320 call: &CallCard,
320 call: &CallCard,
321 notice: &CallNotice,
322 index: usize,
321 index: usize,
323 directory: &Directory,
322 directory: &Directory,
324 actions: RecapActions,
323 actions: RecapActions,
@@ -347,7 +346,7 @@ pub(super) fn notice_line(
347 .text_size(px(TEXT_SIZE))
346 .text_size(px(TEXT_SIZE))
348 .line_height(px(LINE_HEIGHT))
347 .line_height(px(LINE_HEIGHT))
349 .text_color(theme::text_muted())
348 .text_color(theme::text_muted())
350 .child(notice_text(notice)),
349 .child(notice_text(&call.notice)),
351 )
350 )
352 .children(
351 .children(
353 call.recap
352 call.recap
@@ -360,7 +359,6 @@ pub(super) fn notice_line(
360pub(super) fn notice_row(
359pub(super) fn notice_row(
361 row: &MessageRow,
360 row: &MessageRow,
362 call: &CallCard,
361 call: &CallCard,
363 notice: &CallNotice,
364 index: usize,
362 index: usize,
365 directory: &Directory,
363 directory: &Directory,
366 actions: RecapActions,
364 actions: RecapActions,
@@ -374,7 +372,7 @@ pub(super) fn notice_row(
374 div()
372 div()
375 .id(ElementId::Name(format!("row-{index}").into()))
373 .id(ElementId::Name(format!("row-{index}").into()))
376 .w_full()
374 .w_full()
377 .child(notice_line(call, notice, index, directory, actions)),
375 .child(notice_line(call, index, directory, actions)),
378 )
376 )
379 .into_any_element()
377 .into_any_element()
380}
378}
crates/app/src/views/conversation/render_env.rs +0 −7
@@ -383,12 +383,6 @@ impl RenderEnv {
383 383 };
384 384 let app = self.app.clone();
385 385 let conversation_id = message.conversation_id.clone();
386 let call_back = call.missed.then(|| {
387 let (app, conversation_id) = (app.clone(), conversation_id.clone());
388 boxed(move |cx| {
389 app.update(cx, |state, cx| state.start_chat_call(&conversation_id, cx));
390 })
391 });
392 386 let joinable = call.started && app.read(cx).running_meeting(&conversation_id).is_some();
393 387 let join = joinable.then(|| {
394 388 boxed(move |cx| {
@@ -417,7 +411,6 @@ impl RenderEnv {
417 411 boxed(move |cx| cx.write_to_clipboard(ClipboardItem::new_string(url.clone())))
418 412 });
419 413 CallActions {
420 call_back,
421 414 join,
422 415 recap: RecapActions {
423 416 view_recap: recording.map(open),
@@ -383,12 +383,6 @@ impl RenderEnv {
383 };
383 };
384 let app = self.app.clone();
384 let app = self.app.clone();
385 let conversation_id = message.conversation_id.clone();
385 let conversation_id = message.conversation_id.clone();
386 let call_back = call.missed.then(|| {
387 let (app, conversation_id) = (app.clone(), conversation_id.clone());
388 boxed(move |cx| {
389 app.update(cx, |state, cx| state.start_chat_call(&conversation_id, cx));
390 })
391 });
392 let joinable = call.started && app.read(cx).running_meeting(&conversation_id).is_some();
386 let joinable = call.started && app.read(cx).running_meeting(&conversation_id).is_some();
393 let join = joinable.then(|| {
387 let join = joinable.then(|| {
394 boxed(move |cx| {
388 boxed(move |cx| {
@@ -417,7 +411,6 @@ impl RenderEnv {
417 boxed(move |cx| cx.write_to_clipboard(ClipboardItem::new_string(url.clone())))
411 boxed(move |cx| cx.write_to_clipboard(ClipboardItem::new_string(url.clone())))
418 });
412 });
419 CallActions {
413 CallActions {
420 call_back,
421 join,
414 join,
422 recap: RecapActions {
415 recap: RecapActions {
423 view_recap: recording.map(open),
416 view_recap: recording.map(open),
crates/app/src/views/post_card.rs +2 −4
@@ -245,9 +245,7 @@ fn message_block(
245 245 .into_any_element(),
246 246 (None, sender_id) => person_avatar(directory, sender_id, &row.author, size),
247 247 };
248 if let (Role::Reply, Some(call)) = (role, &row.call)
249 && let Some(notice) = &call.notice
250 {
248 if let (Role::Reply, Some(call)) = (role, &row.call) {
251 249 let recap = std::mem::replace(&mut actions.call, CallActions::none()).recap;
252 250 return div()
253 251 .id(ElementId::Name(format!("post-message-{index}").into()))
@@ -255,7 +253,7 @@ fn message_block(
255 253 .px(px(CARD_PADDING))
256 254 .pb(px(CARD_PADDING))
257 255 .bg(theme::reply_surface())
258 .child(notice_line(call, notice, index, directory, recap));
256 .child(notice_line(call, index, directory, recap));
259 257 }
260 258 let profile_user = row.sender_id.as_deref().filter(|_| actions.bot.is_none());
261 259 let content = match &row.call {
@@ -245,9 +245,7 @@ fn message_block(
245 .into_any_element(),
245 .into_any_element(),
246 (None, sender_id) => person_avatar(directory, sender_id, &row.author, size),
246 (None, sender_id) => person_avatar(directory, sender_id, &row.author, size),
247 };
247 };
248 if let (Role::Reply, Some(call)) = (role, &row.call)
248 if let (Role::Reply, Some(call)) = (role, &row.call) {
249 && let Some(notice) = &call.notice
250 {
251 let recap = std::mem::replace(&mut actions.call, CallActions::none()).recap;
249 let recap = std::mem::replace(&mut actions.call, CallActions::none()).recap;
252 return div()
250 return div()
253 .id(ElementId::Name(format!("post-message-{index}").into()))
251 .id(ElementId::Name(format!("post-message-{index}").into()))
@@ -255,7 +253,7 @@ fn message_block(
255 .px(px(CARD_PADDING))
253 .px(px(CARD_PADDING))
256 .pb(px(CARD_PADDING))
254 .pb(px(CARD_PADDING))
257 .bg(theme::reply_surface())
255 .bg(theme::reply_surface())
258 .child(notice_line(call, notice, index, directory, recap));
256 .child(notice_line(call, index, directory, recap));
259 }
257 }
260 let profile_user = row.sender_id.as_deref().filter(|_| actions.bot.is_none());
258 let profile_user = row.sender_id.as_deref().filter(|_| actions.bot.is_none());
261 let content = match &row.call {
259 let content = match &row.call {
crates/app/src/views/rail.rs +2 −2
@@ -57,14 +57,14 @@ fn rail_items(
57 57 },
58 58 RailItem {
59 59 tab: SidebarTab::Chats,
60 label: "Chats",
60 label: "Chat",
61 61 shortcut_label: "Show Chats",
62 62 icon: IconName::MessageSquare,
63 63 badge: count_badge_for(unread_chats),
64 64 },
65 65 RailItem {
66 66 tab: SidebarTab::Channels,
67 label: "Channels",
67 label: "Teams",
68 68 shortcut_label: "Show Channels",
69 69 icon: IconName::Users,
70 70 badge: if channel_dot {
@@ -57,14 +57,14 @@ fn rail_items(
57 },
57 },
58 RailItem {
58 RailItem {
59 tab: SidebarTab::Chats,
59 tab: SidebarTab::Chats,
60 label: "Chats",
60 label: "Chat",
61 shortcut_label: "Show Chats",
61 shortcut_label: "Show Chats",
62 icon: IconName::MessageSquare,
62 icon: IconName::MessageSquare,
63 badge: count_badge_for(unread_chats),
63 badge: count_badge_for(unread_chats),
64 },
64 },
65 RailItem {
65 RailItem {
66 tab: SidebarTab::Channels,
66 tab: SidebarTab::Channels,
67 label: "Channels",
67 label: "Teams",
68 shortcut_label: "Show Channels",
68 shortcut_label: "Show Channels",
69 icon: IconName::Users,
69 icon: IconName::Users,
70 badge: if channel_dot {
70 badge: if channel_dot {
crates/app/src/views/sidebar.rs +2 −2
@@ -107,8 +107,8 @@ impl SidebarTab {
107 107 fn title(self) -> &'static str {
108 108 match self {
109 109 SidebarTab::Activity => "Activity",
110 SidebarTab::Chats => "Chats",
111 SidebarTab::Channels => "Channels",
110 SidebarTab::Chats => "Chat",
111 SidebarTab::Channels => "Teams",
112 112 SidebarTab::Calendar => "Calendar",
113 113 SidebarTab::Calls => "Calls",
114 114 SidebarTab::Saved => "Saved",
@@ -107,8 +107,8 @@ impl SidebarTab {
107 fn title(self) -> &'static str {
107 fn title(self) -> &'static str {
108 match self {
108 match self {
109 SidebarTab::Activity => "Activity",
109 SidebarTab::Activity => "Activity",
110 SidebarTab::Chats => "Chats",
110 SidebarTab::Chats => "Chat",
111 SidebarTab::Channels => "Channels",
111 SidebarTab::Channels => "Teams",
112 SidebarTab::Calendar => "Calendar",
112 SidebarTab::Calendar => "Calendar",
113 SidebarTab::Calls => "Calls",
113 SidebarTab::Calls => "Calls",
114 SidebarTab::Saved => "Saved",
114 SidebarTab::Saved => "Saved",