feat(calls): history filters and Copy meeting link
- All, Missed, Incoming, Outgoing pills under Recent - right-click a meeting row: Copy meeting link Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -5,6 +5,7 @@ use chrono::{DateTime, Local, Offset, Utc};
5
5
use gpui_kit::Context;
6
6
7
7
use super::agenda::{AgendaRow, demo_events};
8
use super::list::HistoryFilter;
8
9
use crate::app_state::{AppEvent, AppState, Selection, selection_for};
9
10
10
11
const NO_MEETING_CHAT_NOTICE: &str = "This meeting chat is not available";
@@ -45,6 +46,11 @@ impl AppState {
45
46
cx.notify();
46
47
}
47
48
49
pub fn set_call_history_filter(&mut self, filter: HistoryFilter, cx: &mut Context<Self>) {
50
self.calls_list.set_filter(filter);
51
self.rebuild_calls_list(cx);
52
}
53
48
54
pub fn join_agenda_row(&mut self, row: &AgendaRow, cx: &mut Context<Self>) {
49
55
if let Some(url) = &row.join_url {
50
56
self.join_meeting_link(url, cx);
@@ -5,6 +5,7 @@ use chrono::{DateTime, Local, Offset, Utc};5
use gpui_kit::Context;5
use gpui_kit::Context;6
6
7
use super::agenda::{AgendaRow, demo_events};7
use super::agenda::{AgendaRow, demo_events};8
use super::list::HistoryFilter;8
use crate::app_state::{AppEvent, AppState, Selection, selection_for};9
use crate::app_state::{AppEvent, AppState, Selection, selection_for};9
10
10
const NO_MEETING_CHAT_NOTICE: &str = "This meeting chat is not available";11
const NO_MEETING_CHAT_NOTICE: &str = "This meeting chat is not available";@@ -45,6 +46,11 @@ impl AppState {45
cx.notify();46
cx.notify();46
}47
}47
48
49
pub fn set_call_history_filter(&mut self, filter: HistoryFilter, cx: &mut Context<Self>) {50
self.calls_list.set_filter(filter);51
self.rebuild_calls_list(cx);52
}53
48
pub fn join_agenda_row(&mut self, row: &AgendaRow, cx: &mut Context<Self>) {54
pub fn join_agenda_row(&mut self, row: &AgendaRow, cx: &mut Context<Self>) {49
if let Some(url) = &row.join_url {55
if let Some(url) = &row.join_url {50
self.join_meeting_link(url, cx);56
self.join_meeting_link(url, cx);@@ -3,7 +3,7 @@ use std::ops::Range;
3
3
use chatsvc::CalendarEvent;
4
4
use chrono::{DateTime, Duration, FixedOffset, NaiveDate, Utc};
5
5
use store::ChatRecord;
6
use teams_core::CallLogEntry;
6
use teams_core::{CallDirection, CallLogEntry};
7
7
8
8
use super::agenda::{AgendaRow, group_by_day};
9
9
use super::history::{CallRow, call_rows};
@@ -13,15 +13,62 @@ pub const DAY_HEIGHT: f32 = 26.;
13
13
pub const AGENDA_ROW_HEIGHT: f32 = 58.;
14
14
pub const CALL_ROW_HEIGHT: f32 = 54.;
15
15
pub const EMPTY_HEIGHT: f32 = 56.;
16
pub const FILTERS_HEIGHT: f32 = 36.;
16
17
const MAX_AGE_SECONDS: i64 = 60;
17
18
const UPCOMING_TITLE: &str = "Upcoming";
18
19
const RECENT_TITLE: &str = "Recent";
19
20
const NO_MEETINGS_TEXT: &str = "No meetings in the next 7 days";
20
21
const NO_CALLS_TEXT: &str = "No calls yet";
21
22
23
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
24
pub enum HistoryFilter {
25
#[default]
26
All,
27
Missed,
28
Incoming,
29
Outgoing,
30
}
31
32
impl HistoryFilter {
33
pub const ALL: [HistoryFilter; 4] = [
34
HistoryFilter::All,
35
HistoryFilter::Missed,
36
HistoryFilter::Incoming,
37
HistoryFilter::Outgoing,
38
];
39
40
pub fn label(self) -> &'static str {
41
match self {
42
HistoryFilter::All => "All",
43
HistoryFilter::Missed => "Missed",
44
HistoryFilter::Incoming => "Incoming",
45
HistoryFilter::Outgoing => "Outgoing",
46
}
47
}
48
49
fn empty_text(self) -> &'static str {
50
match self {
51
HistoryFilter::All => NO_CALLS_TEXT,
52
HistoryFilter::Missed => "No missed calls",
53
HistoryFilter::Incoming => "No incoming calls",
54
HistoryFilter::Outgoing => "No outgoing calls",
55
}
56
}
57
58
fn admits(self, entry: &CallLogEntry) -> bool {
59
match self {
60
HistoryFilter::All => true,
61
HistoryFilter::Missed => entry.missed(),
62
HistoryFilter::Incoming => entry.direction == CallDirection::Incoming && !entry.missed(),
63
HistoryFilter::Outgoing => entry.direction == CallDirection::Outgoing,
64
}
65
}
66
}
67
22
68
#[derive(Debug, Clone, PartialEq, Eq)]
23
69
pub enum ListEntry {
24
70
Section(&'static str),
71
Filters(HistoryFilter),
25
72
Day(String),
26
73
Agenda(AgendaRow),
27
74
Call(CallRow),
@@ -32,6 +79,7 @@ impl ListEntry {
32
79
pub fn height(&self) -> f32 {
33
80
match self {
34
81
ListEntry::Section(_) => SECTION_HEIGHT,
82
ListEntry::Filters(_) => FILTERS_HEIGHT,
35
83
ListEntry::Day(_) => DAY_HEIGHT,
36
84
ListEntry::Agenda(_) => AGENDA_ROW_HEIGHT,
37
85
ListEntry::Call(_) => CALL_ROW_HEIGHT,
@@ -60,6 +108,7 @@ pub struct CallsList {
60
108
ends: Vec<f32>,
61
109
built_at: Option<BuiltAt>,
62
110
invalidated: bool,
111
filter: HistoryFilter,
63
112
}
64
113
65
114
impl CallsList {
@@ -67,6 +116,17 @@ impl CallsList {
67
116
self.invalidated = true;
68
117
}
69
118
119
pub fn filter(&self) -> HistoryFilter {
120
self.filter
121
}
122
123
pub fn set_filter(&mut self, filter: HistoryFilter) {
124
if self.filter != filter {
125
self.filter = filter;
126
self.invalidated = true;
127
}
128
}
129
70
130
pub fn needs_rebuild(&self, now: DateTime<Utc>, offset: FixedOffset) -> bool {
71
131
let Some(built_at) = &self.built_at else {
72
132
return true;
@@ -98,9 +158,15 @@ impl CallsList {
98
158
entries.extend(day.rows.into_iter().map(ListEntry::Agenda));
99
159
}
100
160
entries.push(ListEntry::Section(RECENT_TITLE));
101
let calls = call_rows(history, chats, now, offset);
161
entries.push(ListEntry::Filters(self.filter));
162
let filtered: Vec<CallLogEntry> = history
163
.iter()
164
.filter(|entry| self.filter.admits(entry))
165
.cloned()
166
.collect();
167
let calls = call_rows(&filtered, chats, now, offset);
102
168
if calls.is_empty() {
103
entries.push(ListEntry::Empty(NO_CALLS_TEXT));
169
entries.push(ListEntry::Empty(self.filter.empty_text()));
104
170
}
105
171
entries.extend(calls.into_iter().map(ListEntry::Call));
106
172
self.set_entries(entries);
@@ -213,11 +279,48 @@ mod tests {
213
279
ListEntry::Section("Upcoming"),
214
280
ListEntry::Empty("No meetings in the next 7 days"),
215
281
ListEntry::Section("Recent"),
282
ListEntry::Filters(HistoryFilter::All),
216
283
ListEntry::Empty("No calls yet"),
217
284
]
218
285
);
219
286
}
220
287
288
#[test]
289
fn the_history_filter_keeps_only_matching_calls() {
290
let missed = CallLogEntry {
291
direction: CallDirection::Incoming,
292
outcome: CallOutcome::Missed,
293
..call("missed")
294
};
295
let incoming = CallLogEntry {
296
direction: CallDirection::Incoming,
297
..call("incoming")
298
};
299
let history = [missed, incoming, call("outgoing")];
300
let keys = |filter: HistoryFilter| -> Vec<String> {
301
let mut list = CallsList::default();
302
list.set_filter(filter);
303
list.rebuild(&history, &[], &[], now(), zero());
304
list.entries()
305
.iter()
306
.filter_map(|entry| match entry {
307
ListEntry::Call(row) => Some(row.key.clone()),
308
ListEntry::Empty(text) => Some((*text).to_owned()),
309
_ => None,
310
})
311
.skip(1)
312
.collect()
313
};
314
assert_eq!(keys(HistoryFilter::All), ["missed", "incoming", "outgoing"]);
315
assert_eq!(keys(HistoryFilter::Missed), ["missed"]);
316
assert_eq!(keys(HistoryFilter::Incoming), ["incoming"]);
317
assert_eq!(keys(HistoryFilter::Outgoing), ["outgoing"]);
318
let mut list = CallsList::default();
319
list.set_filter(HistoryFilter::Missed);
320
list.rebuild(&[call("outgoing")], &[], &[], now(), zero());
321
assert_eq!(list.entries().last(), Some(&ListEntry::Empty("No missed calls")));
322
}
323
221
324
#[test]
222
325
fn upcoming_comes_before_recent_with_day_headers() {
223
326
let list = built(2, 2);
@@ -226,6 +329,7 @@ mod tests {
226
329
.iter()
227
330
.map(|entry| match entry {
228
331
ListEntry::Section(_) => "section",
332
ListEntry::Filters(_) => "filters",
229
333
ListEntry::Day(_) => "day",
230
334
ListEntry::Agenda(_) => "agenda",
231
335
ListEntry::Call(_) => "call",
@@ -235,7 +339,7 @@ mod tests {
235
339
assert_eq!(
236
340
kinds,
237
341
[
238
"section", "day", "agenda", "agenda", "section", "call", "call"
342
"section", "day", "agenda", "agenda", "section", "filters", "call", "call"
239
343
]
240
344
);
241
345
}
@@ -3,7 +3,7 @@ use std::ops::Range;3
use chatsvc::CalendarEvent;3
use chatsvc::CalendarEvent;4
use chrono::{DateTime, Duration, FixedOffset, NaiveDate, Utc};4
use chrono::{DateTime, Duration, FixedOffset, NaiveDate, Utc};5
use store::ChatRecord;5
use store::ChatRecord;6
use teams_core::CallLogEntry;6
use teams_core::{CallDirection, CallLogEntry};7
7
8
use super::agenda::{AgendaRow, group_by_day};8
use super::agenda::{AgendaRow, group_by_day};9
use super::history::{CallRow, call_rows};9
use super::history::{CallRow, call_rows};@@ -13,15 +13,62 @@ pub const DAY_HEIGHT: f32 = 26.;13
pub const AGENDA_ROW_HEIGHT: f32 = 58.;13
pub const AGENDA_ROW_HEIGHT: f32 = 58.;14
pub const CALL_ROW_HEIGHT: f32 = 54.;14
pub const CALL_ROW_HEIGHT: f32 = 54.;15
pub const EMPTY_HEIGHT: f32 = 56.;15
pub const EMPTY_HEIGHT: f32 = 56.;16
pub const FILTERS_HEIGHT: f32 = 36.;16
const MAX_AGE_SECONDS: i64 = 60;17
const MAX_AGE_SECONDS: i64 = 60;17
const UPCOMING_TITLE: &str = "Upcoming";18
const UPCOMING_TITLE: &str = "Upcoming";18
const RECENT_TITLE: &str = "Recent";19
const RECENT_TITLE: &str = "Recent";19
const NO_MEETINGS_TEXT: &str = "No meetings in the next 7 days";20
const NO_MEETINGS_TEXT: &str = "No meetings in the next 7 days";20
const NO_CALLS_TEXT: &str = "No calls yet";21
const NO_CALLS_TEXT: &str = "No calls yet";21
22
23
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]24
pub enum HistoryFilter {25
#[default]26
All,27
Missed,28
Incoming,29
Outgoing,30
}31
32
impl HistoryFilter {33
pub const ALL: [HistoryFilter; 4] = [34
HistoryFilter::All,35
HistoryFilter::Missed,36
HistoryFilter::Incoming,37
HistoryFilter::Outgoing,38
];39
40
pub fn label(self) -> &'static str {41
match self {42
HistoryFilter::All => "All",43
HistoryFilter::Missed => "Missed",44
HistoryFilter::Incoming => "Incoming",45
HistoryFilter::Outgoing => "Outgoing",46
}47
}48
49
fn empty_text(self) -> &'static str {50
match self {51
HistoryFilter::All => NO_CALLS_TEXT,52
HistoryFilter::Missed => "No missed calls",53
HistoryFilter::Incoming => "No incoming calls",54
HistoryFilter::Outgoing => "No outgoing calls",55
}56
}57
58
fn admits(self, entry: &CallLogEntry) -> bool {59
match self {60
HistoryFilter::All => true,61
HistoryFilter::Missed => entry.missed(),62
HistoryFilter::Incoming => entry.direction == CallDirection::Incoming && !entry.missed(),63
HistoryFilter::Outgoing => entry.direction == CallDirection::Outgoing,64
}65
}66
}67
22
#[derive(Debug, Clone, PartialEq, Eq)]68
#[derive(Debug, Clone, PartialEq, Eq)]23
pub enum ListEntry {69
pub enum ListEntry {24
Section(&'static str),70
Section(&'static str),71
Filters(HistoryFilter),25
Day(String),72
Day(String),26
Agenda(AgendaRow),73
Agenda(AgendaRow),27
Call(CallRow),74
Call(CallRow),@@ -32,6 +79,7 @@ impl ListEntry {32
pub fn height(&self) -> f32 {79
pub fn height(&self) -> f32 {33
match self {80
match self {34
ListEntry::Section(_) => SECTION_HEIGHT,81
ListEntry::Section(_) => SECTION_HEIGHT,82
ListEntry::Filters(_) => FILTERS_HEIGHT,35
ListEntry::Day(_) => DAY_HEIGHT,83
ListEntry::Day(_) => DAY_HEIGHT,36
ListEntry::Agenda(_) => AGENDA_ROW_HEIGHT,84
ListEntry::Agenda(_) => AGENDA_ROW_HEIGHT,37
ListEntry::Call(_) => CALL_ROW_HEIGHT,85
ListEntry::Call(_) => CALL_ROW_HEIGHT,@@ -60,6 +108,7 @@ pub struct CallsList {60
ends: Vec<f32>,108
ends: Vec<f32>,61
built_at: Option<BuiltAt>,109
built_at: Option<BuiltAt>,62
invalidated: bool,110
invalidated: bool,111
filter: HistoryFilter,63
}112
}64
113
65
impl CallsList {114
impl CallsList {@@ -67,6 +116,17 @@ impl CallsList {67
self.invalidated = true;116
self.invalidated = true;68
}117
}69
118
119
pub fn filter(&self) -> HistoryFilter {120
self.filter121
}122
123
pub fn set_filter(&mut self, filter: HistoryFilter) {124
if self.filter != filter {125
self.filter = filter;126
self.invalidated = true;127
}128
}129
70
pub fn needs_rebuild(&self, now: DateTime<Utc>, offset: FixedOffset) -> bool {130
pub fn needs_rebuild(&self, now: DateTime<Utc>, offset: FixedOffset) -> bool {71
let Some(built_at) = &self.built_at else {131
let Some(built_at) = &self.built_at else {72
return true;132
return true;@@ -98,9 +158,15 @@ impl CallsList {98
entries.extend(day.rows.into_iter().map(ListEntry::Agenda));158
entries.extend(day.rows.into_iter().map(ListEntry::Agenda));99
}159
}100
entries.push(ListEntry::Section(RECENT_TITLE));160
entries.push(ListEntry::Section(RECENT_TITLE));101
let calls = call_rows(history, chats, now, offset);161
entries.push(ListEntry::Filters(self.filter));162
let filtered: Vec<CallLogEntry> = history163
.iter()164
.filter(|entry| self.filter.admits(entry))165
.cloned()166
.collect();167
let calls = call_rows(&filtered, chats, now, offset);102
if calls.is_empty() {168
if calls.is_empty() {103
entries.push(ListEntry::Empty(NO_CALLS_TEXT));169
entries.push(ListEntry::Empty(self.filter.empty_text()));104
}170
}105
entries.extend(calls.into_iter().map(ListEntry::Call));171
entries.extend(calls.into_iter().map(ListEntry::Call));106
self.set_entries(entries);172
self.set_entries(entries);@@ -213,11 +279,48 @@ mod tests {213
ListEntry::Section("Upcoming"),279
ListEntry::Section("Upcoming"),214
ListEntry::Empty("No meetings in the next 7 days"),280
ListEntry::Empty("No meetings in the next 7 days"),215
ListEntry::Section("Recent"),281
ListEntry::Section("Recent"),282
ListEntry::Filters(HistoryFilter::All),216
ListEntry::Empty("No calls yet"),283
ListEntry::Empty("No calls yet"),217
]284
]218
);285
);219
}286
}220
287
288
#[test]289
fn the_history_filter_keeps_only_matching_calls() {290
let missed = CallLogEntry {291
direction: CallDirection::Incoming,292
outcome: CallOutcome::Missed,293
..call("missed")294
};295
let incoming = CallLogEntry {296
direction: CallDirection::Incoming,297
..call("incoming")298
};299
let history = [missed, incoming, call("outgoing")];300
let keys = |filter: HistoryFilter| -> Vec<String> {301
let mut list = CallsList::default();302
list.set_filter(filter);303
list.rebuild(&history, &[], &[], now(), zero());304
list.entries()305
.iter()306
.filter_map(|entry| match entry {307
ListEntry::Call(row) => Some(row.key.clone()),308
ListEntry::Empty(text) => Some((*text).to_owned()),309
_ => None,310
})311
.skip(1)312
.collect()313
};314
assert_eq!(keys(HistoryFilter::All), ["missed", "incoming", "outgoing"]);315
assert_eq!(keys(HistoryFilter::Missed), ["missed"]);316
assert_eq!(keys(HistoryFilter::Incoming), ["incoming"]);317
assert_eq!(keys(HistoryFilter::Outgoing), ["outgoing"]);318
let mut list = CallsList::default();319
list.set_filter(HistoryFilter::Missed);320
list.rebuild(&[call("outgoing")], &[], &[], now(), zero());321
assert_eq!(list.entries().last(), Some(&ListEntry::Empty("No missed calls")));322
}323
221
#[test]324
#[test]222
fn upcoming_comes_before_recent_with_day_headers() {325
fn upcoming_comes_before_recent_with_day_headers() {223
let list = built(2, 2);326
let list = built(2, 2);@@ -226,6 +329,7 @@ mod tests {226
.iter()329
.iter()227
.map(|entry| match entry {330
.map(|entry| match entry {228
ListEntry::Section(_) => "section",331
ListEntry::Section(_) => "section",332
ListEntry::Filters(_) => "filters",229
ListEntry::Day(_) => "day",333
ListEntry::Day(_) => "day",230
ListEntry::Agenda(_) => "agenda",334
ListEntry::Agenda(_) => "agenda",231
ListEntry::Call(_) => "call",335
ListEntry::Call(_) => "call",@@ -235,7 +339,7 @@ mod tests {235
assert_eq!(339
assert_eq!(236
kinds,340
kinds,237
[341
[238
"section", "day", "agenda", "agenda", "section", "call", "call"342
"section", "day", "agenda", "agenda", "section", "filters", "call", "call"239
]343
]240
);344
);241
}345
}@@ -40,8 +40,8 @@ pub use health::{HealthBanner, level_text, media_text, network_rows, transport_t
40
40
pub use history::CallRow;
41
41
pub use launcher::CallLauncher;
42
42
pub use list::{
43
AGENDA_ROW_HEIGHT, CALL_ROW_HEIGHT, CallsList, DAY_HEIGHT, EMPTY_HEIGHT, ListEntry,
44
SECTION_HEIGHT,
43
AGENDA_ROW_HEIGHT, CALL_ROW_HEIGHT, CallsList, DAY_HEIGHT, EMPTY_HEIGHT, FILTERS_HEIGHT,
44
HistoryFilter, ListEntry, SECTION_HEIGHT,
45
45
};
46
46
pub use media::CallMedia;
47
47
pub use model::{
@@ -40,8 +40,8 @@ pub use health::{HealthBanner, level_text, media_text, network_rows, transport_t40
pub use history::CallRow;40
pub use history::CallRow;41
pub use launcher::CallLauncher;41
pub use launcher::CallLauncher;42
pub use list::{42
pub use list::{43
AGENDA_ROW_HEIGHT, CALL_ROW_HEIGHT, CallsList, DAY_HEIGHT, EMPTY_HEIGHT, ListEntry,43
AGENDA_ROW_HEIGHT, CALL_ROW_HEIGHT, CallsList, DAY_HEIGHT, EMPTY_HEIGHT, FILTERS_HEIGHT,44
SECTION_HEIGHT,44
HistoryFilter, ListEntry, SECTION_HEIGHT,45
};45
};46
pub use media::CallMedia;46
pub use media::CallMedia;47
pub use model::{47
pub use model::{@@ -16,8 +16,8 @@ use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
16
16
use super::widgets::{icon, menu_icon};
17
17
use crate::app_state::AppState;
18
18
use crate::call::{
19
AGENDA_ROW_HEIGHT, AgendaRow, CALL_ROW_HEIGHT, CallRow, DAY_HEIGHT, EMPTY_HEIGHT, ListEntry,
20
SECTION_HEIGHT, join_available, response_label,
19
AGENDA_ROW_HEIGHT, AgendaRow, CALL_ROW_HEIGHT, CallRow, DAY_HEIGHT, EMPTY_HEIGHT,
20
FILTERS_HEIGHT, HistoryFilter, ListEntry, SECTION_HEIGHT, join_available, response_label,
21
21
};
22
22
use crate::theme;
23
23
@@ -224,6 +224,42 @@ fn section_header(title: &'static str) -> AnyElement {
224
224
.into_any_element()
225
225
}
226
226
227
fn history_filters(state: &Entity<AppState>, current: HistoryFilter) -> AnyElement {
228
let pills = HistoryFilter::ALL.into_iter().map(|filter| {
229
let selected = filter == current;
230
let state = state.clone();
231
div()
232
.id(SharedString::from(format!("calls-filter-{}", filter.label())))
233
.h(px(24.))
234
.px(px(10.))
235
.flex()
236
.flex_none()
237
.items_center()
238
.rounded_full()
239
.cursor_pointer()
240
.text_size(px(12.))
241
.when(selected, |pill| {
242
pill.bg(theme::accent()).text_color(theme::on_accent())
243
})
244
.when(!selected, |pill| {
245
pill.bg(theme::surface_raised())
246
.text_color(theme::text_soft())
247
.hover(|pill| pill.bg(theme::border_strong()))
248
})
249
.child(filter.label())
250
.on_click(move |_, _, cx| {
251
state.update(cx, |state, cx| state.set_call_history_filter(filter, cx))
252
})
253
});
254
h_flex()
255
.h(px(FILTERS_HEIGHT))
256
.px(px(16.))
257
.gap(px(6.))
258
.items_center()
259
.children(pills)
260
.into_any_element()
261
}
262
227
263
fn day_header(label: &str) -> AnyElement {
228
264
div()
229
265
.h(px(DAY_HEIGHT))
@@ -330,6 +366,7 @@ fn agenda_row(
330
366
let click_row = row.clone();
331
367
let join_state = state.clone();
332
368
let join_row = row.clone();
369
let menu_join_url = row.join_url.clone();
333
370
h_flex()
334
371
.id(SharedString::from(format!("agenda-{}", row.key)))
335
372
.mx(px(6.))
@@ -396,6 +433,17 @@ fn agenda_row(
396
433
.on_click(move |_, _, cx| {
397
434
click_state.update(cx, |state, cx| state.open_agenda_chat(&click_row, cx));
398
435
})
436
.context_menu(move |popup, _, _| {
437
popup.when_some(menu_join_url.clone(), |popup, join_url| {
438
popup.item(
439
PopupMenuItem::new("Copy meeting link")
440
.icon(menu_icon(IconName::Link))
441
.on_click(move |_, _, cx| {
442
cx.write_to_clipboard(ClipboardItem::new_string(join_url.clone()));
443
}),
444
)
445
})
446
})
399
447
.into_any_element()
400
448
}
401
449
@@ -430,6 +478,7 @@ pub fn calls_body(
430
478
for entry in entries {
431
479
list = list.child(match entry {
432
480
ListEntry::Section(title) => section_header(title),
481
ListEntry::Filters(filter) => history_filters(state, *filter),
433
482
ListEntry::Day(label) => day_header(label),
434
483
ListEntry::Empty(text) => empty_row(text),
435
484
ListEntry::Agenda(row) => agenda_row(
@@ -16,8 +16,8 @@ use super::sidebar::SIDEBAR_SCROLL_DIVIDER;16
use super::widgets::{icon, menu_icon};16
use super::widgets::{icon, menu_icon};17
use crate::app_state::AppState;17
use crate::app_state::AppState;18
use crate::call::{18
use crate::call::{19
AGENDA_ROW_HEIGHT, AgendaRow, CALL_ROW_HEIGHT, CallRow, DAY_HEIGHT, EMPTY_HEIGHT, ListEntry,19
AGENDA_ROW_HEIGHT, AgendaRow, CALL_ROW_HEIGHT, CallRow, DAY_HEIGHT, EMPTY_HEIGHT,20
SECTION_HEIGHT, join_available, response_label,20
FILTERS_HEIGHT, HistoryFilter, ListEntry, SECTION_HEIGHT, join_available, response_label,21
};21
};22
use crate::theme;22
use crate::theme;23
23
@@ -224,6 +224,42 @@ fn section_header(title: &'static str) -> AnyElement {224
.into_any_element()224
.into_any_element()225
}225
}226
226
227
fn history_filters(state: &Entity<AppState>, current: HistoryFilter) -> AnyElement {228
let pills = HistoryFilter::ALL.into_iter().map(|filter| {229
let selected = filter == current;230
let state = state.clone();231
div()232
.id(SharedString::from(format!("calls-filter-{}", filter.label())))233
.h(px(24.))234
.px(px(10.))235
.flex()236
.flex_none()237
.items_center()238
.rounded_full()239
.cursor_pointer()240
.text_size(px(12.))241
.when(selected, |pill| {242
pill.bg(theme::accent()).text_color(theme::on_accent())243
})244
.when(!selected, |pill| {245
pill.bg(theme::surface_raised())246
.text_color(theme::text_soft())247
.hover(|pill| pill.bg(theme::border_strong()))248
})249
.child(filter.label())250
.on_click(move |_, _, cx| {251
state.update(cx, |state, cx| state.set_call_history_filter(filter, cx))252
})253
});254
h_flex()255
.h(px(FILTERS_HEIGHT))256
.px(px(16.))257
.gap(px(6.))258
.items_center()259
.children(pills)260
.into_any_element()261
}262
227
fn day_header(label: &str) -> AnyElement {263
fn day_header(label: &str) -> AnyElement {228
div()264
div()229
.h(px(DAY_HEIGHT))265
.h(px(DAY_HEIGHT))@@ -330,6 +366,7 @@ fn agenda_row(330
let click_row = row.clone();366
let click_row = row.clone();331
let join_state = state.clone();367
let join_state = state.clone();332
let join_row = row.clone();368
let join_row = row.clone();369
let menu_join_url = row.join_url.clone();333
h_flex()370
h_flex()334
.id(SharedString::from(format!("agenda-{}", row.key)))371
.id(SharedString::from(format!("agenda-{}", row.key)))335
.mx(px(6.))372
.mx(px(6.))@@ -396,6 +433,17 @@ fn agenda_row(396
.on_click(move |_, _, cx| {433
.on_click(move |_, _, cx| {397
click_state.update(cx, |state, cx| state.open_agenda_chat(&click_row, cx));434
click_state.update(cx, |state, cx| state.open_agenda_chat(&click_row, cx));398
})435
})436
.context_menu(move |popup, _, _| {437
popup.when_some(menu_join_url.clone(), |popup, join_url| {438
popup.item(439
PopupMenuItem::new("Copy meeting link")440
.icon(menu_icon(IconName::Link))441
.on_click(move |_, _, cx| {442
cx.write_to_clipboard(ClipboardItem::new_string(join_url.clone()));443
}),444
)445
})446
})399
.into_any_element()447
.into_any_element()400
}448
}401
449
@@ -430,6 +478,7 @@ pub fn calls_body(430
for entry in entries {478
for entry in entries {431
list = list.child(match entry {479
list = list.child(match entry {432
ListEntry::Section(title) => section_header(title),480
ListEntry::Section(title) => section_header(title),481
ListEntry::Filters(filter) => history_filters(state, *filter),433
ListEntry::Day(label) => day_header(label),482
ListEntry::Day(label) => day_header(label),434
ListEntry::Empty(text) => empty_row(text),483
ListEntry::Empty(text) => empty_row(text),435
ListEntry::Agenda(row) => agenda_row(484
ListEntry::Agenda(row) => agenda_row(