Merge remote-tracking branch 'origin/main' into feat/parity-batch-1
@@ -0,0 +1,133 @@
1
use std::collections::HashMap;
2
3
use app_ui_kit::layout::ISLAND_GAP;
4
use gpui_kit::component::v_flex;
5
use gpui_kit::*;
6
7
use super::conversation::ConversationView;
8
use super::shell::AppShell;
9
use crate::app_state::{AppState, Selection, selection_title};
10
use crate::theme;
11
12
pub const POP_OUT_CHAT_LABEL: &str = "Pop out chat";
13
pub const POP_IN_TOOLTIP: &str = "Pop in back to the main window";
14
const CHAT_WINDOW_SIZE: (f32, f32) = (760., 820.);
15
const CHAT_WINDOW_MIN_SIZE: (f32, f32) = (420., 480.);
16
17
#[derive(Default)]
18
struct ChatPopOuts {
19
windows: HashMap<String, AnyWindowHandle>,
20
opening: Vec<String>,
21
}
22
23
impl Global for ChatPopOuts {}
24
25
pub struct ChatPopOutView {
26
conversation: Entity<ConversationView>,
27
}
28
29
impl ChatPopOutView {
30
fn new(
31
app: Entity<AppState>,
32
chat_id: String,
33
window: &mut Window,
34
cx: &mut Context<Self>,
35
) -> Self {
36
let closing_chat_id = chat_id.clone();
37
window.on_window_should_close(cx, move |_, cx| {
38
forget(&closing_chat_id, cx);
39
true
40
});
41
let selection = Selection::Chat(chat_id);
42
let conversation =
43
cx.new(|cx| ConversationView::popped_out(app, selection, window, cx));
44
ChatPopOutView { conversation }
45
}
46
}
47
48
impl Render for ChatPopOutView {
49
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
50
v_flex()
51
.id("chat-pop-out")
52
.size_full()
53
.p(px(ISLAND_GAP))
54
.bg(theme::background())
55
.child(self.conversation.clone())
56
}
57
}
58
59
fn forget(chat_id: &str, cx: &mut App) {
60
if cx.has_global::<ChatPopOuts>() {
61
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);
62
}
63
}
64
65
pub fn pop_out_chat(app: &Entity<AppState>, chat_id: &str, cx: &mut App) {
66
let pop_outs = cx.default_global::<ChatPopOuts>();
67
if pop_outs.opening.iter().any(|opening| opening == chat_id) {
68
return;
69
}
70
if let Some(handle) = pop_outs.windows.get(chat_id).copied() {
71
if handle
72
.update(cx, |_, window, _| window.activate_window())
73
.is_ok()
74
{
75
return;
76
}
77
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);
78
}
79
cx.global_mut::<ChatPopOuts>()
80
.opening
81
.push(chat_id.to_owned());
82
let title = selection_title(&app.read(cx).sidebar, &Selection::Chat(chat_id.to_owned()));
83
let options = WindowOptions {
84
window_bounds: Some(WindowBounds::Windowed(Bounds::centered(
85
None,
86
size(px(CHAT_WINDOW_SIZE.0), px(CHAT_WINDOW_SIZE.1)),
87
cx,
88
))),
89
window_min_size: Some(size(
90
px(CHAT_WINDOW_MIN_SIZE.0),
91
px(CHAT_WINDOW_MIN_SIZE.1),
92
)),
93
titlebar: Some(TitlebarOptions {
94
title: Some(title.into()),
95
..Default::default()
96
}),
97
..Default::default()
98
};
99
let (app, chat_id) = (app.clone(), chat_id.to_owned());
100
// open_window draws right away, and the conversation view reads the app entity while rendering.
101
cx.defer(move |cx| {
102
let window_chat_id = chat_id.clone();
103
let opened = gpui_kit::open_window(options, cx, move |window, cx| {
104
cx.new(|cx| ChatPopOutView::new(app, window_chat_id, window, cx))
105
});
106
let pop_outs = cx.global_mut::<ChatPopOuts>();
107
pop_outs.opening.retain(|opening| opening != &chat_id);
108
if let Ok((handle, _)) = opened {
109
pop_outs.windows.insert(chat_id, handle);
110
}
111
});
112
}
113
114
pub fn return_to_main_window(
115
app: &Entity<AppState>,
116
chat_id: &str,
117
window: &mut Window,
118
cx: &mut App,
119
) {
120
forget(chat_id, cx);
121
let selection = Selection::Chat(chat_id.to_owned());
122
app.update(cx, |state, cx| state.select(selection, cx));
123
let main_window = cx
124
.windows()
125
.into_iter()
126
.find(|handle| handle.downcast::<AppShell>().is_some());
127
if let Some(main_window) = main_window {
128
main_window
129
.update(cx, |_, window, _| window.activate_window())
130
.ok();
131
}
132
window.remove_window();
133
}
@@ -0,0 +1,133 @@1
use std::collections::HashMap;2
3
use app_ui_kit::layout::ISLAND_GAP;4
use gpui_kit::component::v_flex;5
use gpui_kit::*;6
7
use super::conversation::ConversationView;8
use super::shell::AppShell;9
use crate::app_state::{AppState, Selection, selection_title};10
use crate::theme;11
12
pub const POP_OUT_CHAT_LABEL: &str = "Pop out chat";13
pub const POP_IN_TOOLTIP: &str = "Pop in back to the main window";14
const CHAT_WINDOW_SIZE: (f32, f32) = (760., 820.);15
const CHAT_WINDOW_MIN_SIZE: (f32, f32) = (420., 480.);16
17
#[derive(Default)]18
struct ChatPopOuts {19
windows: HashMap<String, AnyWindowHandle>,20
opening: Vec<String>,21
}22
23
impl Global for ChatPopOuts {}24
25
pub struct ChatPopOutView {26
conversation: Entity<ConversationView>,27
}28
29
impl ChatPopOutView {30
fn new(31
app: Entity<AppState>,32
chat_id: String,33
window: &mut Window,34
cx: &mut Context<Self>,35
) -> Self {36
let closing_chat_id = chat_id.clone();37
window.on_window_should_close(cx, move |_, cx| {38
forget(&closing_chat_id, cx);39
true40
});41
let selection = Selection::Chat(chat_id);42
let conversation =43
cx.new(|cx| ConversationView::popped_out(app, selection, window, cx));44
ChatPopOutView { conversation }45
}46
}47
48
impl Render for ChatPopOutView {49
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {50
v_flex()51
.id("chat-pop-out")52
.size_full()53
.p(px(ISLAND_GAP))54
.bg(theme::background())55
.child(self.conversation.clone())56
}57
}58
59
fn forget(chat_id: &str, cx: &mut App) {60
if cx.has_global::<ChatPopOuts>() {61
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);62
}63
}64
65
pub fn pop_out_chat(app: &Entity<AppState>, chat_id: &str, cx: &mut App) {66
let pop_outs = cx.default_global::<ChatPopOuts>();67
if pop_outs.opening.iter().any(|opening| opening == chat_id) {68
return;69
}70
if let Some(handle) = pop_outs.windows.get(chat_id).copied() {71
if handle72
.update(cx, |_, window, _| window.activate_window())73
.is_ok()74
{75
return;76
}77
cx.global_mut::<ChatPopOuts>().windows.remove(chat_id);78
}79
cx.global_mut::<ChatPopOuts>()80
.opening81
.push(chat_id.to_owned());82
let title = selection_title(&app.read(cx).sidebar, &Selection::Chat(chat_id.to_owned()));83
let options = WindowOptions {84
window_bounds: Some(WindowBounds::Windowed(Bounds::centered(85
None,86
size(px(CHAT_WINDOW_SIZE.0), px(CHAT_WINDOW_SIZE.1)),87
cx,88
))),89
window_min_size: Some(size(90
px(CHAT_WINDOW_MIN_SIZE.0),91
px(CHAT_WINDOW_MIN_SIZE.1),92
)),93
titlebar: Some(TitlebarOptions {94
title: Some(title.into()),95
..Default::default()96
}),97
..Default::default()98
};99
let (app, chat_id) = (app.clone(), chat_id.to_owned());100
// open_window draws right away, and the conversation view reads the app entity while rendering.101
cx.defer(move |cx| {102
let window_chat_id = chat_id.clone();103
let opened = gpui_kit::open_window(options, cx, move |window, cx| {104
cx.new(|cx| ChatPopOutView::new(app, window_chat_id, window, cx))105
});106
let pop_outs = cx.global_mut::<ChatPopOuts>();107
pop_outs.opening.retain(|opening| opening != &chat_id);108
if let Ok((handle, _)) = opened {109
pop_outs.windows.insert(chat_id, handle);110
}111
});112
}113
114
pub fn return_to_main_window(115
app: &Entity<AppState>,116
chat_id: &str,117
window: &mut Window,118
cx: &mut App,119
) {120
forget(chat_id, cx);121
let selection = Selection::Chat(chat_id.to_owned());122
app.update(cx, |state, cx| state.select(selection, cx));123
let main_window = cx124
.windows()125
.into_iter()126
.find(|handle| handle.downcast::<AppShell>().is_some());127
if let Some(main_window) = main_window {128
main_window129
.update(cx, |_, window, _| window.activate_window())130
.ok();131
}132
window.remove_window();133
}@@ -51,6 +51,7 @@ use super::avatar::{
51
51
use super::call_controls::header_call_controls;
52
52
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};
53
53
use super::chat_members::members_popover;
54
use super::chat_pop_out;
54
55
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};
55
56
use super::find_panel::{FIND_PANEL_WIDTH, FindPanel, FindPanelEvent};
56
57
use super::group_name::group_name_button;
@@ -110,6 +111,7 @@ pub const FEED_EDGE_TAG: &str = "shell/islands/main/timeline/divider-feed";
110
111
const HEADER_HEIGHT: f32 = 60.;
111
112
const HEADER_PADDING: f32 = 20.;
112
113
const HEADER_GAP: f32 = 12.;
114
const POP_IN_BUTTON_SIZE: f32 = 32.;
113
115
const HEADER_LEAD_SIZE: f32 = 36.;
114
116
const TABS_INLINE_MIN_WIDTH: f32 = 560.;
115
117
const FIND_MIN_TIMELINE_WIDTH: f32 = 360.;
@@ -198,6 +200,7 @@ enum ReactionAttempt {
198
200
pub struct ConversationView {
199
201
app: Entity<AppState>,
200
202
pinned: bool,
203
popped_out: bool,
201
204
scroller: Entity<MessageScrollerState>,
202
205
composer: Entity<Composer>,
203
206
subject: Entity<InputState>,
@@ -492,6 +495,17 @@ impl ConversationView {
492
495
Self::build(app, Some(selection), window, cx)
493
496
}
494
497
498
pub fn popped_out(
499
app: Entity<AppState>,
500
selection: Selection,
501
window: &mut Window,
502
cx: &mut Context<Self>,
503
) -> Self {
504
let mut view = Self::build(app, Some(selection), window, cx);
505
view.popped_out = true;
506
view
507
}
508
495
509
fn build(
496
510
app: Entity<AppState>,
497
511
pinned: Option<Selection>,
@@ -533,6 +547,7 @@ impl ConversationView {
533
547
let mut view = ConversationView {
534
548
app,
535
549
pinned: pinned.is_some(),
550
popped_out: false,
536
551
scroller,
537
552
composer,
538
553
subject,
@@ -3480,7 +3495,7 @@ impl ConversationView {
3480
3495
if let Some(note) = channel_note {
3481
3496
subline = note.to_owned();
3482
3497
}
3483
let call_controls = if self.pinned {
3498
let call_controls = if self.pinned && !self.popped_out {
3484
3499
Vec::new()
3485
3500
} else {
3486
3501
header_call_controls(&self.app, app, ¤t.selection)
@@ -3546,6 +3561,29 @@ impl ConversationView {
3546
3561
.children(stack)
3547
3562
.children(call_controls)
3548
3563
.children(self.channel_details_button(cx))
3564
.children(self.pop_in_button(current))
3565
}
3566
3567
fn pop_in_button(&self, current: &Current) -> Option<AnyElement> {
3568
let Selection::Chat(chat_id) = ¤t.selection else {
3569
return None;
3570
};
3571
if !self.popped_out {
3572
return None;
3573
}
3574
let (app, chat_id) = (self.app.clone(), chat_id.clone());
3575
Some(
3576
Button::new("chat-pop-in")
3577
.icon(IconName::SquareArrowDownLeft)
3578
.ghost()
3579
.size(px(POP_IN_BUTTON_SIZE))
3580
.rounded(px(8.))
3581
.tooltip(chat_pop_out::POP_IN_TOOLTIP)
3582
.on_click(move |_, window, cx| {
3583
chat_pop_out::return_to_main_window(&app, &chat_id, window, cx)
3584
})
3585
.into_any_element(),
3586
)
3549
3587
}
3550
3588
}
3551
3589
@@ -51,6 +51,7 @@ use super::avatar::{51
use super::call_controls::header_call_controls;51
use super::call_controls::header_call_controls;52
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};52
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};53
use super::chat_members::members_popover;53
use super::chat_members::members_popover;54
use super::chat_pop_out;54
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};55
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};55
use super::find_panel::{FIND_PANEL_WIDTH, FindPanel, FindPanelEvent};56
use super::find_panel::{FIND_PANEL_WIDTH, FindPanel, FindPanelEvent};56
use super::group_name::group_name_button;57
use super::group_name::group_name_button;@@ -110,6 +111,7 @@ pub const FEED_EDGE_TAG: &str = "shell/islands/main/timeline/divider-feed";110
const HEADER_HEIGHT: f32 = 60.;111
const HEADER_HEIGHT: f32 = 60.;111
const HEADER_PADDING: f32 = 20.;112
const HEADER_PADDING: f32 = 20.;112
const HEADER_GAP: f32 = 12.;113
const HEADER_GAP: f32 = 12.;114
const POP_IN_BUTTON_SIZE: f32 = 32.;113
const HEADER_LEAD_SIZE: f32 = 36.;115
const HEADER_LEAD_SIZE: f32 = 36.;114
const TABS_INLINE_MIN_WIDTH: f32 = 560.;116
const TABS_INLINE_MIN_WIDTH: f32 = 560.;115
const FIND_MIN_TIMELINE_WIDTH: f32 = 360.;117
const FIND_MIN_TIMELINE_WIDTH: f32 = 360.;@@ -198,6 +200,7 @@ enum ReactionAttempt {198
pub struct ConversationView {200
pub struct ConversationView {199
app: Entity<AppState>,201
app: Entity<AppState>,200
pinned: bool,202
pinned: bool,203
popped_out: bool,201
scroller: Entity<MessageScrollerState>,204
scroller: Entity<MessageScrollerState>,202
composer: Entity<Composer>,205
composer: Entity<Composer>,203
subject: Entity<InputState>,206
subject: Entity<InputState>,@@ -492,6 +495,17 @@ impl ConversationView {492
Self::build(app, Some(selection), window, cx)495
Self::build(app, Some(selection), window, cx)493
}496
}494
497
498
pub fn popped_out(499
app: Entity<AppState>,500
selection: Selection,501
window: &mut Window,502
cx: &mut Context<Self>,503
) -> Self {504
let mut view = Self::build(app, Some(selection), window, cx);505
view.popped_out = true;506
view507
}508
495
fn build(509
fn build(496
app: Entity<AppState>,510
app: Entity<AppState>,497
pinned: Option<Selection>,511
pinned: Option<Selection>,@@ -533,6 +547,7 @@ impl ConversationView {533
let mut view = ConversationView {547
let mut view = ConversationView {534
app,548
app,535
pinned: pinned.is_some(),549
pinned: pinned.is_some(),550
popped_out: false,536
scroller,551
scroller,537
composer,552
composer,538
subject,553
subject,@@ -3480,7 +3495,7 @@ impl ConversationView {3480
if let Some(note) = channel_note {3495
if let Some(note) = channel_note {3481
subline = note.to_owned();3496
subline = note.to_owned();3482
}3497
}3483
let call_controls = if self.pinned {3498
let call_controls = if self.pinned && !self.popped_out {3484
Vec::new()3499
Vec::new()3485
} else {3500
} else {3486
header_call_controls(&self.app, app, ¤t.selection)3501
header_call_controls(&self.app, app, ¤t.selection)@@ -3546,6 +3561,29 @@ impl ConversationView {3546
.children(stack)3561
.children(stack)3547
.children(call_controls)3562
.children(call_controls)3548
.children(self.channel_details_button(cx))3563
.children(self.channel_details_button(cx))3564
.children(self.pop_in_button(current))3565
}3566
3567
fn pop_in_button(&self, current: &Current) -> Option<AnyElement> {3568
let Selection::Chat(chat_id) = ¤t.selection else {3569
return None;3570
};3571
if !self.popped_out {3572
return None;3573
}3574
let (app, chat_id) = (self.app.clone(), chat_id.clone());3575
Some(3576
Button::new("chat-pop-in")3577
.icon(IconName::SquareArrowDownLeft)3578
.ghost()3579
.size(px(POP_IN_BUTTON_SIZE))3580
.rounded(px(8.))3581
.tooltip(chat_pop_out::POP_IN_TOOLTIP)3582
.on_click(move |_, window, cx| {3583
chat_pop_out::return_to_main_window(&app, &chat_id, window, cx)3584
})3585
.into_any_element(),3586
)3549
}3587
}3550
}3588
}3551
3589
@@ -35,6 +35,7 @@ pub mod card_media;
35
35
pub mod card_table;
36
36
pub mod card_widgets;
37
37
pub mod chat_members;
38
pub mod chat_pop_out;
38
39
pub mod composer;
39
40
pub mod connection_banner;
40
41
pub mod conversation;
@@ -35,6 +35,7 @@ pub mod card_media;35
pub mod card_table;35
pub mod card_table;36
pub mod card_widgets;36
pub mod card_widgets;37
pub mod chat_members;37
pub mod chat_members;38
pub mod chat_pop_out;38
pub mod composer;39
pub mod composer;39
pub mod connection_banner;40
pub mod connection_banner;40
pub mod conversation;41
pub mod conversation;@@ -24,13 +24,14 @@ use super::saved_panel::{SavedPanel, SavedPanelEvent};
24
24
use super::shortcuts::{
25
25
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,
26
26
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,
27
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
27
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
28
28
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
29
29
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,
30
30
ZoomShareReset,
31
31
};
32
32
use super::window_zoom::{WindowZoom, change_zoom};
33
33
use super::call_pop_out::zoom_listener;
34
use super::chat_pop_out;
34
35
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};
35
36
use super::sidebar::{SidebarEvent, SidebarView};
36
37
use app_ui_kit::render::hooks::RenderHooks;
@@ -996,6 +997,12 @@ impl Render for AppShell {
996
997
this.conversation
997
998
.update(cx, |conversation, cx| conversation.open_find(window, cx));
998
999
}))
1000
.on_action(cx.listener(|this, _: &PopOutSelectedChat, _, cx| {
1001
let selected = this.state.read(cx).selection.clone();
1002
if let Some(Selection::Chat(chat_id)) = selected {
1003
chat_pop_out::pop_out_chat(&this.state, &chat_id, cx);
1004
}
1005
}))
999
1006
.on_action(cx.listener(|this, _: &OpenChatFilter, window, cx| {
1000
1007
this.close_image_viewer(window, cx);
1001
1008
this.sidebar
@@ -24,13 +24,14 @@ use super::saved_panel::{SavedPanel, SavedPanelEvent};24
use super::shortcuts::{24
use super::shortcuts::{25
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,25
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,26
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,26
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,27
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,27
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,28
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,28
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,29
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,29
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,30
ZoomShareReset,30
ZoomShareReset,31
};31
};32
use super::window_zoom::{WindowZoom, change_zoom};32
use super::window_zoom::{WindowZoom, change_zoom};33
use super::call_pop_out::zoom_listener;33
use super::call_pop_out::zoom_listener;34
use super::chat_pop_out;34
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};35
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};35
use super::sidebar::{SidebarEvent, SidebarView};36
use super::sidebar::{SidebarEvent, SidebarView};36
use app_ui_kit::render::hooks::RenderHooks;37
use app_ui_kit::render::hooks::RenderHooks;@@ -996,6 +997,12 @@ impl Render for AppShell {996
this.conversation997
this.conversation997
.update(cx, |conversation, cx| conversation.open_find(window, cx));998
.update(cx, |conversation, cx| conversation.open_find(window, cx));998
}))999
}))1000
.on_action(cx.listener(|this, _: &PopOutSelectedChat, _, cx| {1001
let selected = this.state.read(cx).selection.clone();1002
if let Some(Selection::Chat(chat_id)) = selected {1003
chat_pop_out::pop_out_chat(&this.state, &chat_id, cx);1004
}1005
}))999
.on_action(cx.listener(|this, _: &OpenChatFilter, window, cx| {1006
.on_action(cx.listener(|this, _: &OpenChatFilter, window, cx| {1000
this.close_image_viewer(window, cx);1007
this.close_image_viewer(window, cx);1001
this.sidebar1008
this.sidebar@@ -33,6 +33,7 @@ actions!(
33
33
OpenCallsTab,
34
34
OpenAgents,
35
35
OpenChatFilter,
36
PopOutSelectedChat,
36
37
FindInChat,
37
38
FilterUnreadChats,
38
39
FilterNonMeetingChats,
@@ -138,6 +139,7 @@ macro_rules! shortcut {
138
139
pub const SHORTCUTS: &[Shortcut] = &[
139
140
shortcut!(General, OutsideComposer, "Search and switch chats", "ctrl-k", Some("cmd-k"), OpenSwitcher),
140
141
shortcut!(General, Global, "New chat", "ctrl-n", Some("cmd-n"), NewChat),
142
shortcut!(General, OutsideTextFields, "Pop out selected chat", "ctrl-enter", Some("cmd-enter"), PopOutSelectedChat),
141
143
shortcut!(General, GlobalOverTextFields, "Keyboard shortcuts", "ctrl-.", Some("cmd-."), ShowShortcuts),
142
144
shortcut!(General, GlobalOverTextFields, "Settings", "ctrl-,", Some("cmd-,"), OpenSettings),
143
145
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),
@@ -33,6 +33,7 @@ actions!(33
OpenCallsTab,33
OpenCallsTab,34
OpenAgents,34
OpenAgents,35
OpenChatFilter,35
OpenChatFilter,36
PopOutSelectedChat,36
FindInChat,37
FindInChat,37
FilterUnreadChats,38
FilterUnreadChats,38
FilterNonMeetingChats,39
FilterNonMeetingChats,@@ -138,6 +139,7 @@ macro_rules! shortcut {138
pub const SHORTCUTS: &[Shortcut] = &[139
pub const SHORTCUTS: &[Shortcut] = &[139
shortcut!(General, OutsideComposer, "Search and switch chats", "ctrl-k", Some("cmd-k"), OpenSwitcher),140
shortcut!(General, OutsideComposer, "Search and switch chats", "ctrl-k", Some("cmd-k"), OpenSwitcher),140
shortcut!(General, Global, "New chat", "ctrl-n", Some("cmd-n"), NewChat),141
shortcut!(General, Global, "New chat", "ctrl-n", Some("cmd-n"), NewChat),142
shortcut!(General, OutsideTextFields, "Pop out selected chat", "ctrl-enter", Some("cmd-enter"), PopOutSelectedChat),141
shortcut!(General, GlobalOverTextFields, "Keyboard shortcuts", "ctrl-.", Some("cmd-."), ShowShortcuts),143
shortcut!(General, GlobalOverTextFields, "Keyboard shortcuts", "ctrl-.", Some("cmd-."), ShowShortcuts),142
shortcut!(General, GlobalOverTextFields, "Settings", "ctrl-,", Some("cmd-,"), OpenSettings),144
shortcut!(General, GlobalOverTextFields, "Settings", "ctrl-,", Some("cmd-,"), OpenSettings),143
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),145
shortcut!(General, OutsideComposer, "Zoom in", "ctrl-=", Some("cmd-="), ZoomIn),@@ -19,6 +19,7 @@ use teams_core::{ChatNotificationMode, DesktopNotifications, is_notes_chat};
19
19
use super::activity_panel::ActivityPanel;
20
20
use super::avatar::{spec_avatar, square_avatar, with_presence};
21
21
use super::calls_tab::calls_body;
22
use super::chat_pop_out;
22
23
use super::saved_panel::SavedPanel;
23
24
use super::scroll_edge::{scroll_offset, with_top_edge};
24
25
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
@@ -218,7 +219,7 @@ fn chat_menu(
218
219
}),
219
220
);
220
221
if notes {
221
return popup;
222
return popup.item(pop_out_item(context, target));
222
223
}
223
224
popup = popup.item(
224
225
PopupMenuItem::new(if muted { "Unmute" } else { "Mute" })
@@ -232,6 +233,7 @@ fn chat_menu(
232
233
}),
233
234
);
234
235
popup = chat_notifications_submenu(popup, window, cx, context, target)
236
.item(pop_out_item(context, target))
235
237
.separator()
236
238
.item(
237
239
PopupMenuItem::new("Hide")
@@ -269,6 +271,13 @@ fn chat_menu(
269
271
popup
270
272
}
271
273
274
fn pop_out_item(context: &MenuContext, target: &ChatMenuTarget) -> PopupMenuItem {
275
let (state, chat_id) = (context.state.clone(), target.id.clone());
276
PopupMenuItem::new(chat_pop_out::POP_OUT_CHAT_LABEL)
277
.icon(menu_icon(IconName::ExternalLink))
278
.on_click(move |_, _, cx| chat_pop_out::pop_out_chat(&state, &chat_id, cx))
279
}
280
272
281
const CHAT_NOTIFICATION_MODES: [(&str, ChatNotificationMode); 2] = [
273
282
("All new messages", ChatNotificationMode::AllNewMessages),
274
283
("Mute", ChatNotificationMode::Mute),
@@ -19,6 +19,7 @@ use teams_core::{ChatNotificationMode, DesktopNotifications, is_notes_chat};19
use super::activity_panel::ActivityPanel;19
use super::activity_panel::ActivityPanel;20
use super::avatar::{spec_avatar, square_avatar, with_presence};20
use super::avatar::{spec_avatar, square_avatar, with_presence};21
use super::calls_tab::calls_body;21
use super::calls_tab::calls_body;22
use super::chat_pop_out;22
use super::saved_panel::SavedPanel;23
use super::saved_panel::SavedPanel;23
use super::scroll_edge::{scroll_offset, with_top_edge};24
use super::scroll_edge::{scroll_offset, with_top_edge};24
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};25
use super::section_dialog::{SectionNameTarget, open_section_name_dialog};@@ -218,7 +219,7 @@ fn chat_menu(218
}),219
}),219
);220
);220
if notes {221
if notes {221
return popup;222
return popup.item(pop_out_item(context, target));222
}223
}223
popup = popup.item(224
popup = popup.item(224
PopupMenuItem::new(if muted { "Unmute" } else { "Mute" })225
PopupMenuItem::new(if muted { "Unmute" } else { "Mute" })@@ -232,6 +233,7 @@ fn chat_menu(232
}),233
}),233
);234
);234
popup = chat_notifications_submenu(popup, window, cx, context, target)235
popup = chat_notifications_submenu(popup, window, cx, context, target)236
.item(pop_out_item(context, target))235
.separator()237
.separator()236
.item(238
.item(237
PopupMenuItem::new("Hide")239
PopupMenuItem::new("Hide")@@ -269,6 +271,13 @@ fn chat_menu(269
popup271
popup270
}272
}271
273
274
fn pop_out_item(context: &MenuContext, target: &ChatMenuTarget) -> PopupMenuItem {275
let (state, chat_id) = (context.state.clone(), target.id.clone());276
PopupMenuItem::new(chat_pop_out::POP_OUT_CHAT_LABEL)277
.icon(menu_icon(IconName::ExternalLink))278
.on_click(move |_, _, cx| chat_pop_out::pop_out_chat(&state, &chat_id, cx))279
}280
272
const CHAT_NOTIFICATION_MODES: [(&str, ChatNotificationMode); 2] = [281
const CHAT_NOTIFICATION_MODES: [(&str, ChatNotificationMode); 2] = [273
("All new messages", ChatNotificationMode::AllNewMessages),282
("All new messages", ChatNotificationMode::AllNewMessages),274
("Mute", ChatNotificationMode::Mute),283
("Mute", ChatNotificationMode::Mute),