1pub mod channel_view;
2pub mod chat_panel;
3pub mod collab_panel;
4mod collab_titlebar_item;
5mod face_pile;
6pub mod notification_panel;
7pub mod notifications;
8mod panel_settings;
9
10use std::{rc::Rc, sync::Arc};
11
12pub use collab_panel::CollabPanel;
13pub use collab_titlebar_item::CollabTitlebarItem;
14use gpui::{
15 AppContext, GlobalPixels, Pixels, PlatformDisplay, Size, WindowBounds, WindowKind,
16 WindowOptions,
17};
18pub use panel_settings::{
19 ChatPanelSettings, CollaborationPanelSettings, NotificationPanelSettings,
20};
21use settings::Settings;
22use workspace::AppState;
23
24// actions!(
25// collab,
26// [ToggleScreenSharing, ToggleMute, ToggleDeafen, LeaveCall]
27// );
28
29pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
30 CollaborationPanelSettings::register(cx);
31 ChatPanelSettings::register(cx);
32 NotificationPanelSettings::register(cx);
33
34 // vcs_menu::init(cx);
35 collab_titlebar_item::init(cx);
36 collab_panel::init(cx);
37 // chat_panel::init(cx);
38 notifications::init(&app_state, cx);
39
40 // cx.add_global_action(toggle_screen_sharing);
41 // cx.add_global_action(toggle_mute);
42 // cx.add_global_action(toggle_deafen);
43}
44
45// pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
46// let call = ActiveCall::global(cx).read(cx);
47// if let Some(room) = call.room().cloned() {
48// let client = call.client();
49// let toggle_screen_sharing = room.update(cx, |room, cx| {
50// if room.is_screen_sharing() {
51// report_call_event_for_room(
52// "disable screen share",
53// room.id(),
54// room.channel_id(),
55// &client,
56// cx,
57// );
58// Task::ready(room.unshare_screen(cx))
59// } else {
60// report_call_event_for_room(
61// "enable screen share",
62// room.id(),
63// room.channel_id(),
64// &client,
65// cx,
66// );
67// room.share_screen(cx)
68// }
69// });
70// toggle_screen_sharing.detach_and_log_err(cx);
71// }
72// }
73
74// pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {
75// let call = ActiveCall::global(cx).read(cx);
76// if let Some(room) = call.room().cloned() {
77// let client = call.client();
78// room.update(cx, |room, cx| {
79// let operation = if room.is_muted(cx) {
80// "enable microphone"
81// } else {
82// "disable microphone"
83// };
84// report_call_event_for_room(operation, room.id(), room.channel_id(), &client, cx);
85
86// room.toggle_mute(cx)
87// })
88// .map(|task| task.detach_and_log_err(cx))
89// .log_err();
90// }
91// }
92
93// pub fn toggle_deafen(_: &ToggleDeafen, cx: &mut AppContext) {
94// if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
95// room.update(cx, Room::toggle_deafen)
96// .map(|task| task.detach_and_log_err(cx))
97// .log_err();
98// }
99// }
100
101fn notification_window_options(
102 screen: Rc<dyn PlatformDisplay>,
103 window_size: Size<Pixels>,
104) -> WindowOptions {
105 let _notification_padding = Pixels::from(16.);
106
107 let screen_bounds = screen.bounds();
108 let _size: Size<GlobalPixels> = window_size.into();
109
110 let bounds = gpui::Bounds::<GlobalPixels> {
111 origin: screen_bounds.origin,
112 size: window_size.into(),
113 };
114 WindowOptions {
115 bounds: WindowBounds::Fixed(bounds),
116 titlebar: None,
117 center: false,
118 focus: false,
119 show: true,
120 kind: WindowKind::PopUp,
121 is_movable: false,
122 display_id: Some(screen.id()),
123 }
124}
125
126// fn render_avatar<T: 'static>(
127// avatar: Option<Arc<ImageData>>,
128// avatar_style: &AvatarStyle,
129// container: ContainerStyle,
130// ) -> AnyElement<T> {
131// avatar
132// .map(|avatar| {
133// Image::from_data(avatar)
134// .with_style(avatar_style.image)
135// .aligned()
136// .contained()
137// .with_corner_radius(avatar_style.outer_corner_radius)
138// .constrained()
139// .with_width(avatar_style.outer_width)
140// .with_height(avatar_style.outer_width)
141// .into_any()
142// })
143// .unwrap_or_else(|| {
144// Empty::new()
145// .constrained()
146// .with_width(avatar_style.outer_width)
147// .into_any()
148// })
149// .contained()
150// .with_style(container)
151// .into_any()
152// }
153
154// fn is_channels_feature_enabled(cx: &gpui::WindowContext<'_>) -> bool {
155// cx.is_staff() || cx.has_flag::<ChannelsAlpha>()
156// }