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