BlueGit

ict rusty-teams

feat(call): controls in the header toolbar like the new Teams meeting window

- Chat, People, Raise, React, View, More, Camera, Mic, Share and Leave sit top right with icon and label
- Device menus open from small chevrons next to Camera and Mic
- Leave is a red button with its menu attached
- Controls fold into More by the room the header leaves after the title

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

metis Daniel Däschle · pushed by metis

Authored 2026-11-11 · 2 weeks ago

Hash
946479b26f6eb1ac45393ff25a5aae691ad46cf4
Parent
8bd8a9a8
8 files changed +252 −211
crates/app/src/layout_guard.rs +3 −3
@@ -261,9 +261,9 @@ mod frames {
261 261 const CALL_GUARDED: &[&str] = &[
262 262 "shell/islands/main/call-header",
263 263 "shell/islands/main/call-stage",
264 "shell/islands/main/call-controls",
265 "shell/islands/main/call-controls/mic",
266 "shell/islands/main/call-controls/leave",
264 "shell/islands/main/call-header/controls",
265 "shell/islands/main/call-header/controls/mic",
266 "shell/islands/main/call-header/controls/leave",
267 267 ];
268 268 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
269 269 const CALENDAR: &str = "shell/islands/calendar";
@@ -261,9 +261,9 @@ mod frames {
261 const CALL_GUARDED: &[&str] = &[
261 const CALL_GUARDED: &[&str] = &[
262 "shell/islands/main/call-header",
262 "shell/islands/main/call-header",
263 "shell/islands/main/call-stage",
263 "shell/islands/main/call-stage",
264 "shell/islands/main/call-controls",
264 "shell/islands/main/call-header/controls",
265 "shell/islands/main/call-controls/mic",
265 "shell/islands/main/call-header/controls/mic",
266 "shell/islands/main/call-controls/leave",
266 "shell/islands/main/call-header/controls/leave",
267 ];
267 ];
268 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
268 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
269 const CALENDAR: &str = "shell/islands/calendar";
269 const CALENDAR: &str = "shell/islands/calendar";
crates/app/src/views/call_control_fold.rs +25 −25
@@ -4,15 +4,14 @@ use gpui_kit::component::Icon;
4 4 use gpui_kit::component::menu::{PopupMenu, PopupMenuItem};
5 5 use gpui_kit::*;
6 6
7 use super::call_organizer::CAMERA_MENU_WIDTH;
8 use super::call_view::{CONTROL_SIZE, reaction_glyph};
7 use super::call_toolbar::{GROUP_GAP, SPLIT_CHEVRON_WIDTH, TOOL_GAP, TOOL_WIDTH};
8 use super::call_view::reaction_glyph;
9 9 use super::call_view_menu::view_items;
10 10 use crate::app_state::AppState;
11 11 use crate::call::CallModel;
12 12
13 pub(super) const CONTROL_GAP: f32 = 12.;
14 pub(super) const CONTROLS_PADDING: f32 = 16.;
15 const LEAVE_WIDTH: f32 = 116.;
13 pub(super) const TITLE_RESERVE: f32 = 280.;
14 const LEAVE_WIDTH: f32 = 96.;
16 15
17 16 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
18 17 pub enum Foldable {
@@ -39,27 +38,28 @@ impl FoldedControls {
39 38 }
40 39
41 40 pub fn fixed_controls_width(has_camera_menu: bool, has_more: bool, has_leave_menu: bool) -> f32 {
42 let mut widths = vec![
43 CONTROL_SIZE + CAMERA_MENU_WIDTH,
44 CONTROL_SIZE + if has_camera_menu { CAMERA_MENU_WIDTH } else { 0. },
45 CONTROL_SIZE,
46 LEAVE_WIDTH,
41 let devices = [
42 TOOL_WIDTH + if has_camera_menu { SPLIT_CHEVRON_WIDTH } else { 0. },
43 TOOL_WIDTH + SPLIT_CHEVRON_WIDTH,
44 TOOL_WIDTH,
47 45 ];
48 if has_more {
49 widths.push(CONTROL_SIZE);
50 }
51 if has_leave_menu {
52 widths.push(CONTROL_SIZE);
53 }
54 widths.iter().sum::<f32>() + CONTROL_GAP * (widths.len() - 1) as f32
46 let devices_width = devices.iter().sum::<f32>() + TOOL_GAP * (devices.len() - 1) as f32;
47 let more_width = if has_more { TOOL_WIDTH } else { 0. };
48 let leave_width = LEAVE_WIDTH
49 + if has_leave_menu {
50 SPLIT_CHEVRON_WIDTH + 4. + 1.
51 } else {
52 0.
53 };
54 devices_width + more_width + leave_width + 2. * GROUP_GAP
55 55 }
56 56
57 57 pub fn folded_for_width(available: f32, fixed: f32, present: &[Foldable]) -> Vec<Foldable> {
58 let room = available - 2. * CONTROLS_PADDING - fixed;
58 let room = available - TITLE_RESERVE - fixed;
59 59 let fitting = if room <= 0. {
60 60 0
61 61 } else {
62 (room / (CONTROL_SIZE + CONTROL_GAP)).floor() as usize
62 (room / (TOOL_WIDTH + TOOL_GAP)).floor() as usize
63 63 };
64 64 let folded_count = present.len().saturating_sub(fitting);
65 65 present[..folded_count].to_vec()
@@ -173,7 +173,7 @@ fn chat_item(popup: PopupMenu, app: &Entity<AppState>, folded: &FoldedControls)
173 173
174 174 #[cfg(test)]
175 175 mod tests {
176 use super::{CONTROLS_PADDING, Foldable, fixed_controls_width, folded_for_width};
176 use super::{Foldable, TITLE_RESERVE, fixed_controls_width, folded_for_width};
177 177
178 178 const ALL: [Foldable; 5] = [
179 179 Foldable::View,
@@ -182,11 +182,11 @@ mod tests {
182 182 Foldable::People,
183 183 Foldable::Chat,
184 184 ];
185 const SLOT: f32 = 44. + 12.;
185 const SLOT: f32 = 56. + 2.;
186 186 const FIXED: f32 = 400.;
187 187
188 188 fn width_for(fitting: f32) -> f32 {
189 FIXED + 2. * CONTROLS_PADDING + fitting * SLOT
189 FIXED + TITLE_RESERVE + fitting * SLOT
190 190 }
191 191
192 192 #[test]
@@ -223,8 +223,8 @@ mod tests {
223 223 #[test]
224 224 fn fixed_width_counts_optional_controls() {
225 225 let base = fixed_controls_width(false, false, false);
226 assert_eq!(fixed_controls_width(true, false, false), base + 28.);
227 assert_eq!(fixed_controls_width(false, true, false), base + 44. + 12.);
228 assert_eq!(fixed_controls_width(false, false, true), base + 44. + 12.);
226 assert_eq!(fixed_controls_width(true, false, false), base + 20.);
227 assert_eq!(fixed_controls_width(false, true, false), base + 56.);
228 assert_eq!(fixed_controls_width(false, false, true), base + 25.);
229 229 }
230 230 }
@@ -4,15 +4,14 @@ use gpui_kit::component::Icon;
4use gpui_kit::component::menu::{PopupMenu, PopupMenuItem};
4use gpui_kit::component::menu::{PopupMenu, PopupMenuItem};
5use gpui_kit::*;
5use gpui_kit::*;
6
6
7use super::call_organizer::CAMERA_MENU_WIDTH;
7use super::call_toolbar::{GROUP_GAP, SPLIT_CHEVRON_WIDTH, TOOL_GAP, TOOL_WIDTH};
8use super::call_view::{CONTROL_SIZE, reaction_glyph};
8use super::call_view::reaction_glyph;
9use super::call_view_menu::view_items;
9use super::call_view_menu::view_items;
10use crate::app_state::AppState;
10use crate::app_state::AppState;
11use crate::call::CallModel;
11use crate::call::CallModel;
12
12
13pub(super) const CONTROL_GAP: f32 = 12.;
13pub(super) const TITLE_RESERVE: f32 = 280.;
14pub(super) const CONTROLS_PADDING: f32 = 16.;
14const LEAVE_WIDTH: f32 = 96.;
15const LEAVE_WIDTH: f32 = 116.;
16
15
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18pub enum Foldable {
17pub enum Foldable {
@@ -39,27 +38,28 @@ impl FoldedControls {
39}
38}
40
39
41pub fn fixed_controls_width(has_camera_menu: bool, has_more: bool, has_leave_menu: bool) -> f32 {
40pub fn fixed_controls_width(has_camera_menu: bool, has_more: bool, has_leave_menu: bool) -> f32 {
42 let mut widths = vec![
41 let devices = [
43 CONTROL_SIZE + CAMERA_MENU_WIDTH,
42 TOOL_WIDTH + if has_camera_menu { SPLIT_CHEVRON_WIDTH } else { 0. },
44 CONTROL_SIZE + if has_camera_menu { CAMERA_MENU_WIDTH } else { 0. },
43 TOOL_WIDTH + SPLIT_CHEVRON_WIDTH,
45 CONTROL_SIZE,
44 TOOL_WIDTH,
46 LEAVE_WIDTH,
47 ];
45 ];
48 if has_more {
46 let devices_width = devices.iter().sum::<f32>() + TOOL_GAP * (devices.len() - 1) as f32;
49 widths.push(CONTROL_SIZE);
47 let more_width = if has_more { TOOL_WIDTH } else { 0. };
50 }
48 let leave_width = LEAVE_WIDTH
51 if has_leave_menu {
49 + if has_leave_menu {
52 widths.push(CONTROL_SIZE);
50 SPLIT_CHEVRON_WIDTH + 4. + 1.
53 }
51 } else {
54 widths.iter().sum::<f32>() + CONTROL_GAP * (widths.len() - 1) as f32
52 0.
53 };
54 devices_width + more_width + leave_width + 2. * GROUP_GAP
55}
55}
56
56
57pub fn folded_for_width(available: f32, fixed: f32, present: &[Foldable]) -> Vec<Foldable> {
57pub fn folded_for_width(available: f32, fixed: f32, present: &[Foldable]) -> Vec<Foldable> {
58 let room = available - 2. * CONTROLS_PADDING - fixed;
58 let room = available - TITLE_RESERVE - fixed;
59 let fitting = if room <= 0. {
59 let fitting = if room <= 0. {
60 0
60 0
61 } else {
61 } else {
62 (room / (CONTROL_SIZE + CONTROL_GAP)).floor() as usize
62 (room / (TOOL_WIDTH + TOOL_GAP)).floor() as usize
63 };
63 };
64 let folded_count = present.len().saturating_sub(fitting);
64 let folded_count = present.len().saturating_sub(fitting);
65 present[..folded_count].to_vec()
65 present[..folded_count].to_vec()
@@ -173,7 +173,7 @@ fn chat_item(popup: PopupMenu, app: &Entity<AppState>, folded: &FoldedControls)
173
173
174#[cfg(test)]
174#[cfg(test)]
175mod tests {
175mod tests {
176 use super::{CONTROLS_PADDING, Foldable, fixed_controls_width, folded_for_width};
176 use super::{Foldable, TITLE_RESERVE, fixed_controls_width, folded_for_width};
177
177
178 const ALL: [Foldable; 5] = [
178 const ALL: [Foldable; 5] = [
179 Foldable::View,
179 Foldable::View,
@@ -182,11 +182,11 @@ mod tests {
182 Foldable::People,
182 Foldable::People,
183 Foldable::Chat,
183 Foldable::Chat,
184 ];
184 ];
185 const SLOT: f32 = 44. + 12.;
185 const SLOT: f32 = 56. + 2.;
186 const FIXED: f32 = 400.;
186 const FIXED: f32 = 400.;
187
187
188 fn width_for(fitting: f32) -> f32 {
188 fn width_for(fitting: f32) -> f32 {
189 FIXED + 2. * CONTROLS_PADDING + fitting * SLOT
189 FIXED + TITLE_RESERVE + fitting * SLOT
190 }
190 }
191
191
192 #[test]
192 #[test]
@@ -223,8 +223,8 @@ mod tests {
223 #[test]
223 #[test]
224 fn fixed_width_counts_optional_controls() {
224 fn fixed_width_counts_optional_controls() {
225 let base = fixed_controls_width(false, false, false);
225 let base = fixed_controls_width(false, false, false);
226 assert_eq!(fixed_controls_width(true, false, false), base + 28.);
226 assert_eq!(fixed_controls_width(true, false, false), base + 20.);
227 assert_eq!(fixed_controls_width(false, true, false), base + 44. + 12.);
227 assert_eq!(fixed_controls_width(false, true, false), base + 56.);
228 assert_eq!(fixed_controls_width(false, false, true), base + 44. + 12.);
228 assert_eq!(fixed_controls_width(false, false, true), base + 25.);
229 }
229 }
230}
230}
crates/app/src/views/call_organizer.rs +10 −38
@@ -17,7 +17,8 @@ use super::call_extras::{
17 17 CameraMenu, background_items, effect_items, open_transfer_picker,
18 18 };
19 19 use super::call_record::{record_items, transcript_and_settings_items};
20 use super::call_view::{BANNER_HEIGHT, CONTROL_SIZE, MENU_WIDTH, round_control};
20 use super::call_toolbar::{split_chevron, tool_face, tool_trigger};
21 use super::call_view::{BANNER_HEIGHT, MENU_WIDTH};
21 22 use super::widgets::{Corner, corner_badge, count_badge, icon};
22 23 use crate::app_state::AppState;
23 24 use crate::call::{CAPTION_SHOWN, CallModel, CaptionPosition, Focus, contain_size};
@@ -29,7 +30,7 @@ const PILL_HEIGHT: f32 = 26.;
29 30 const LOBBY_LIST_WIDTH: f32 = 340.;
30 31 const LOBBY_NAME_LIMIT: usize = 28;
31 32 const CAPTION_WIDTH: f32 = 720.;
32 const CAPTION_BOTTOM: f32 = 2. * 16. + CONTROL_SIZE + 16.;
33 const CAPTION_BOTTOM: f32 = 16.;
33 34 const CAPTION_TOP: f32 = 72.;
34 35 const CAPTION_FADE_SECONDS: f32 = 1.;
35 36 const CAPTION_BACKGROUND: f32 = 0.72;
@@ -38,7 +39,6 @@ const FOCUS_BORDER: f32 = 2.;
38 39 const FOCUS_AVATAR: f32 = 140.;
39 40 const CHIP_HEIGHT: f32 = 24.;
40 41 const MORE_SIZE: f32 = 28.;
41 pub(super) const CAMERA_MENU_WIDTH: f32 = 28.;
42 42 const NAME_LIMIT: usize = 32;
43 43
44 44 fn dark_text() -> Hsla {
@@ -449,24 +449,15 @@ pub fn more_button(
449 449 let unread = folded.chat_unread;
450 450 let chat_folded = folded.folds(Foldable::Chat);
451 451 Some(
452 Button::new("call-more")
453 .ghost()
454 .p_0()
455 .size(px(CONTROL_SIZE))
456 .rounded_full()
457 .child(
458 round_control(
459 "call-more-face",
460 IconName::Ellipsis,
461 theme::surface_raised(),
462 theme::text(),
463 )
452 tool_trigger(
453 "call-more",
454 tool_face("call-more-face", IconName::Ellipsis, "More", false)
464 455 .relative()
465 456 .when(chat_folded && unread > 0, |face| {
466 457 face.child(corner_badge(Corner::TopRight, 4.).child(count_badge(unread, false)))
467 458 }),
468 )
469 .dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, window, cx| {
459 )
460 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
470 461 more_menu(popup, window, cx, &app, &model, &folded)
471 462 })
472 463 .into_any_element(),
@@ -573,25 +564,6 @@ fn meeting_items(
573 564 transcript_and_settings_items(popup, app)
574 565 }
575 566
576 pub fn chevron_button(button_id: &'static str, face_id: &'static str) -> Button {
577 Button::new(button_id)
578 .ghost()
579 .p_0()
580 .w(px(CAMERA_MENU_WIDTH))
581 .h(px(super::call_view::CONTROL_SIZE))
582 .rounded_full()
583 .child(
584 div()
585 .id(face_id)
586 .w(px(CAMERA_MENU_WIDTH))
587 .h(px(super::call_view::CONTROL_SIZE))
588 .flex()
589 .items_center()
590 .justify_center()
591 .child(icon(IconName::ChevronUp, 16., theme::text())),
592 )
593 }
594
595 567 pub fn camera_menu_button(
596 568 app: &Entity<AppState>,
597 569 model: &CallModel,
@@ -603,8 +575,8 @@ pub fn camera_menu_button(
603 575 let app = app.clone();
604 576 let model = model.clone();
605 577 Some(
606 chevron_button("call-camera-menu", "call-camera-menu-face")
607 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
578 split_chevron("call-camera-menu", "call-camera-menu-face")
579 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
608 580 camera_menu(popup, &app, &model, &backgrounds)
609 581 })
610 582 .into_any_element(),
@@ -17,7 +17,8 @@ use super::call_extras::{
17 CameraMenu, background_items, effect_items, open_transfer_picker,
17 CameraMenu, background_items, effect_items, open_transfer_picker,
18};
18};
19use super::call_record::{record_items, transcript_and_settings_items};
19use super::call_record::{record_items, transcript_and_settings_items};
20use super::call_view::{BANNER_HEIGHT, CONTROL_SIZE, MENU_WIDTH, round_control};
20use super::call_toolbar::{split_chevron, tool_face, tool_trigger};
21use super::call_view::{BANNER_HEIGHT, MENU_WIDTH};
21use super::widgets::{Corner, corner_badge, count_badge, icon};
22use super::widgets::{Corner, corner_badge, count_badge, icon};
22use crate::app_state::AppState;
23use crate::app_state::AppState;
23use crate::call::{CAPTION_SHOWN, CallModel, CaptionPosition, Focus, contain_size};
24use crate::call::{CAPTION_SHOWN, CallModel, CaptionPosition, Focus, contain_size};
@@ -29,7 +30,7 @@ const PILL_HEIGHT: f32 = 26.;
29const LOBBY_LIST_WIDTH: f32 = 340.;
30const LOBBY_LIST_WIDTH: f32 = 340.;
30const LOBBY_NAME_LIMIT: usize = 28;
31const LOBBY_NAME_LIMIT: usize = 28;
31const CAPTION_WIDTH: f32 = 720.;
32const CAPTION_WIDTH: f32 = 720.;
32const CAPTION_BOTTOM: f32 = 2. * 16. + CONTROL_SIZE + 16.;
33const CAPTION_BOTTOM: f32 = 16.;
33const CAPTION_TOP: f32 = 72.;
34const CAPTION_TOP: f32 = 72.;
34const CAPTION_FADE_SECONDS: f32 = 1.;
35const CAPTION_FADE_SECONDS: f32 = 1.;
35const CAPTION_BACKGROUND: f32 = 0.72;
36const CAPTION_BACKGROUND: f32 = 0.72;
@@ -38,7 +39,6 @@ const FOCUS_BORDER: f32 = 2.;
38const FOCUS_AVATAR: f32 = 140.;
39const FOCUS_AVATAR: f32 = 140.;
39const CHIP_HEIGHT: f32 = 24.;
40const CHIP_HEIGHT: f32 = 24.;
40const MORE_SIZE: f32 = 28.;
41const MORE_SIZE: f32 = 28.;
41pub(super) const CAMERA_MENU_WIDTH: f32 = 28.;
42const NAME_LIMIT: usize = 32;
42const NAME_LIMIT: usize = 32;
43
43
44fn dark_text() -> Hsla {
44fn dark_text() -> Hsla {
@@ -449,24 +449,15 @@ pub fn more_button(
449 let unread = folded.chat_unread;
449 let unread = folded.chat_unread;
450 let chat_folded = folded.folds(Foldable::Chat);
450 let chat_folded = folded.folds(Foldable::Chat);
451 Some(
451 Some(
452 Button::new("call-more")
452 tool_trigger(
453 .ghost()
453 "call-more",
454 .p_0()
454 tool_face("call-more-face", IconName::Ellipsis, "More", false)
455 .size(px(CONTROL_SIZE))
456 .rounded_full()
457 .child(
458 round_control(
459 "call-more-face",
460 IconName::Ellipsis,
461 theme::surface_raised(),
462 theme::text(),
463 )
464 .relative()
455 .relative()
465 .when(chat_folded && unread > 0, |face| {
456 .when(chat_folded && unread > 0, |face| {
466 face.child(corner_badge(Corner::TopRight, 4.).child(count_badge(unread, false)))
457 face.child(corner_badge(Corner::TopRight, 4.).child(count_badge(unread, false)))
467 }),
458 }),
468 )
459 )
469 .dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, window, cx| {
460 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
470 more_menu(popup, window, cx, &app, &model, &folded)
461 more_menu(popup, window, cx, &app, &model, &folded)
471 })
462 })
472 .into_any_element(),
463 .into_any_element(),
@@ -573,25 +564,6 @@ fn meeting_items(
573 transcript_and_settings_items(popup, app)
564 transcript_and_settings_items(popup, app)
574}
565}
575
566
576pub fn chevron_button(button_id: &'static str, face_id: &'static str) -> Button {
577 Button::new(button_id)
578 .ghost()
579 .p_0()
580 .w(px(CAMERA_MENU_WIDTH))
581 .h(px(super::call_view::CONTROL_SIZE))
582 .rounded_full()
583 .child(
584 div()
585 .id(face_id)
586 .w(px(CAMERA_MENU_WIDTH))
587 .h(px(super::call_view::CONTROL_SIZE))
588 .flex()
589 .items_center()
590 .justify_center()
591 .child(icon(IconName::ChevronUp, 16., theme::text())),
592 )
593}
594
595pub fn camera_menu_button(
567pub fn camera_menu_button(
596 app: &Entity<AppState>,
568 app: &Entity<AppState>,
597 model: &CallModel,
569 model: &CallModel,
@@ -603,8 +575,8 @@ pub fn camera_menu_button(
603 let app = app.clone();
575 let app = app.clone();
604 let model = model.clone();
576 let model = model.clone();
605 Some(
577 Some(
606 chevron_button("call-camera-menu", "call-camera-menu-face")
578 split_chevron("call-camera-menu", "call-camera-menu-face")
607 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
579 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
608 camera_menu(popup, &app, &model, &backgrounds)
580 camera_menu(popup, &app, &model, &backgrounds)
609 })
581 })
610 .into_any_element(),
582 .into_any_element(),
crates/app/src/views/call_people.rs +3 −7
@@ -15,7 +15,8 @@ use gpui_kit::*;
15 15 use super::avatar::person_avatar;
16 16 use super::call_extras::open_invite_picker;
17 17 use super::call_organizer::{pill, tile_menu};
18 use super::call_view::{BANNER_HEIGHT, CHAT_PANEL_WIDTH, MENU_WIDTH, round_control};
18 use super::call_toolbar::tool_face;
19 use super::call_view::{BANNER_HEIGHT, CHAT_PANEL_WIDTH, MENU_WIDTH};
19 20 use super::widgets::{Corner, corner_badge, count_badge, icon};
20 21 use super::scroll_edge::with_top_edge;
21 22 use crate::app_state::AppState;
@@ -45,12 +46,7 @@ fn dark_text() -> Hsla {
45 46
46 47 pub fn people_button(app: &Entity<AppState>, open: bool, raised_hands: usize) -> Stateful<Div> {
47 48 let app = app.clone();
48 let (background, foreground) = if open {
49 (theme::accent(), theme::on_accent())
50 } else {
51 (theme::surface_raised(), theme::text())
52 };
53 round_control("call-people", IconName::Users, background, foreground)
49 tool_face("call-people", IconName::Users, "People", open)
54 50 .relative()
55 51 .tooltip(move |window, cx| {
56 52 Tooltip::new(if open { "Close the people list" } else { "Show people" }).build(window, cx)
@@ -15,7 +15,8 @@ use gpui_kit::*;
15use super::avatar::person_avatar;
15use super::avatar::person_avatar;
16use super::call_extras::open_invite_picker;
16use super::call_extras::open_invite_picker;
17use super::call_organizer::{pill, tile_menu};
17use super::call_organizer::{pill, tile_menu};
18use super::call_view::{BANNER_HEIGHT, CHAT_PANEL_WIDTH, MENU_WIDTH, round_control};
18use super::call_toolbar::tool_face;
19use super::call_view::{BANNER_HEIGHT, CHAT_PANEL_WIDTH, MENU_WIDTH};
19use super::widgets::{Corner, corner_badge, count_badge, icon};
20use super::widgets::{Corner, corner_badge, count_badge, icon};
20use super::scroll_edge::with_top_edge;
21use super::scroll_edge::with_top_edge;
21use crate::app_state::AppState;
22use crate::app_state::AppState;
@@ -45,12 +46,7 @@ fn dark_text() -> Hsla {
45
46
46pub fn people_button(app: &Entity<AppState>, open: bool, raised_hands: usize) -> Stateful<Div> {
47pub fn people_button(app: &Entity<AppState>, open: bool, raised_hands: usize) -> Stateful<Div> {
47 let app = app.clone();
48 let app = app.clone();
48 let (background, foreground) = if open {
49 tool_face("call-people", IconName::Users, "People", open)
49 (theme::accent(), theme::on_accent())
50 } else {
51 (theme::surface_raised(), theme::text())
52 };
53 round_control("call-people", IconName::Users, background, foreground)
54 .relative()
50 .relative()
55 .tooltip(move |window, cx| {
51 .tooltip(move |window, cx| {
56 Tooltip::new(if open { "Close the people list" } else { "Show people" }).build(window, cx)
52 Tooltip::new(if open { "Close the people list" } else { "Show people" }).build(window, cx)
crates/app/src/views/call_toolbar.rs added +81 −0
@@ -0,0 +1,81 @@
1 use gpui_kit::assets::IconName;
2 use gpui_kit::component::button::{Button, ButtonVariants as _};
3 use gpui_kit::component::v_flex;
4 use gpui_kit::*;
5
6 use super::widgets::icon;
7 use crate::theme;
8
9 pub(super) const TOOL_WIDTH: f32 = 56.;
10 pub(super) const TOOL_HEIGHT: f32 = 48.;
11 pub(super) const TOOL_GAP: f32 = 2.;
12 pub(super) const GROUP_GAP: f32 = 12.;
13 pub(super) const SPLIT_CHEVRON_WIDTH: f32 = 20.;
14 pub(super) const LEAVE_HEIGHT: f32 = 32.;
15 const TOOL_ICON: f32 = 20.;
16 const TOOL_LABEL: f32 = 11.;
17 const TOOL_RADIUS: f32 = 6.;
18 const CHEVRON_ICON: f32 = 12.;
19
20 pub(super) fn tool_face(
21 id: impl Into<ElementId>,
22 glyph: IconName,
23 label: impl Into<SharedString>,
24 active: bool,
25 ) -> Stateful<Div> {
26 let color = if active {
27 theme::accent_text()
28 } else {
29 theme::text()
30 };
31 v_flex()
32 .id(id)
33 .w(px(TOOL_WIDTH))
34 .h(px(TOOL_HEIGHT))
35 .flex_none()
36 .items_center()
37 .justify_center()
38 .gap(px(3.))
39 .rounded(px(TOOL_RADIUS))
40 .cursor_pointer()
41 .hover(|face| face.bg(theme::row_hover()))
42 .child(icon(glyph, TOOL_ICON, color))
43 .child(
44 div()
45 .text_size(px(TOOL_LABEL))
46 .line_height(px(TOOL_LABEL + 3.))
47 .text_color(color)
48 .child(label.into()),
49 )
50 }
51
52 pub(super) fn tool_trigger(button_id: &'static str, face: Stateful<Div>) -> Button {
53 Button::new(button_id)
54 .ghost()
55 .p_0()
56 .w(px(TOOL_WIDTH))
57 .h(px(TOOL_HEIGHT))
58 .rounded(px(TOOL_RADIUS))
59 .child(face)
60 }
61
62 pub(super) fn split_chevron(button_id: &'static str, face_id: &'static str) -> Button {
63 Button::new(button_id)
64 .ghost()
65 .p_0()
66 .w(px(SPLIT_CHEVRON_WIDTH))
67 .h(px(TOOL_HEIGHT))
68 .rounded(px(TOOL_RADIUS))
69 .child(
70 div()
71 .id(face_id)
72 .w(px(SPLIT_CHEVRON_WIDTH))
73 .h(px(TOOL_HEIGHT))
74 .flex()
75 .items_center()
76 .justify_center()
77 .rounded(px(TOOL_RADIUS))
78 .hover(|face| face.bg(theme::row_hover()))
79 .child(icon(IconName::ChevronDown, CHEVRON_ICON, theme::text())),
80 )
81 }
@@ -0,0 +1,81 @@
1use gpui_kit::assets::IconName;
2use gpui_kit::component::button::{Button, ButtonVariants as _};
3use gpui_kit::component::v_flex;
4use gpui_kit::*;
5
6use super::widgets::icon;
7use crate::theme;
8
9pub(super) const TOOL_WIDTH: f32 = 56.;
10pub(super) const TOOL_HEIGHT: f32 = 48.;
11pub(super) const TOOL_GAP: f32 = 2.;
12pub(super) const GROUP_GAP: f32 = 12.;
13pub(super) const SPLIT_CHEVRON_WIDTH: f32 = 20.;
14pub(super) const LEAVE_HEIGHT: f32 = 32.;
15const TOOL_ICON: f32 = 20.;
16const TOOL_LABEL: f32 = 11.;
17const TOOL_RADIUS: f32 = 6.;
18const CHEVRON_ICON: f32 = 12.;
19
20pub(super) fn tool_face(
21 id: impl Into<ElementId>,
22 glyph: IconName,
23 label: impl Into<SharedString>,
24 active: bool,
25) -> Stateful<Div> {
26 let color = if active {
27 theme::accent_text()
28 } else {
29 theme::text()
30 };
31 v_flex()
32 .id(id)
33 .w(px(TOOL_WIDTH))
34 .h(px(TOOL_HEIGHT))
35 .flex_none()
36 .items_center()
37 .justify_center()
38 .gap(px(3.))
39 .rounded(px(TOOL_RADIUS))
40 .cursor_pointer()
41 .hover(|face| face.bg(theme::row_hover()))
42 .child(icon(glyph, TOOL_ICON, color))
43 .child(
44 div()
45 .text_size(px(TOOL_LABEL))
46 .line_height(px(TOOL_LABEL + 3.))
47 .text_color(color)
48 .child(label.into()),
49 )
50}
51
52pub(super) fn tool_trigger(button_id: &'static str, face: Stateful<Div>) -> Button {
53 Button::new(button_id)
54 .ghost()
55 .p_0()
56 .w(px(TOOL_WIDTH))
57 .h(px(TOOL_HEIGHT))
58 .rounded(px(TOOL_RADIUS))
59 .child(face)
60}
61
62pub(super) fn split_chevron(button_id: &'static str, face_id: &'static str) -> Button {
63 Button::new(button_id)
64 .ghost()
65 .p_0()
66 .w(px(SPLIT_CHEVRON_WIDTH))
67 .h(px(TOOL_HEIGHT))
68 .rounded(px(TOOL_RADIUS))
69 .child(
70 div()
71 .id(face_id)
72 .w(px(SPLIT_CHEVRON_WIDTH))
73 .h(px(TOOL_HEIGHT))
74 .flex()
75 .items_center()
76 .justify_center()
77 .rounded(px(TOOL_RADIUS))
78 .hover(|face| face.bg(theme::row_hover()))
79 .child(icon(IconName::ChevronDown, CHEVRON_ICON, theme::text())),
80 )
81}
crates/app/src/views/call_view.rs +122 −124
@@ -16,8 +16,9 @@ use gpui_kit::prelude::FluentBuilder as _;
16 16 use gpui_kit::*;
17 17
18 18 use super::avatar::person_avatar;
19 use super::call_control_fold::{
20 CONTROL_GAP, CONTROLS_PADDING, Foldable, FoldedControls, fixed_controls_width, folded_for_width,
19 use super::call_control_fold::{Foldable, FoldedControls, fixed_controls_width, folded_for_width};
20 use super::call_toolbar::{
21 GROUP_GAP, LEAVE_HEIGHT, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,
21 22 };
22 23 use super::call_extras::{
23 24 CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,
@@ -27,7 +28,7 @@ use super::call_health::{health_banner, health_indicator};
27 28 use super::call_layouts::stage_region;
28 29 use crate::call::measured_stage;
29 30 use super::call_organizer::{
30 camera_menu_button, captions_hint_chip, captions_overlay, chevron_button, lobby_banner,
31 camera_menu_button, captions_hint_chip, captions_overlay, lobby_banner,
31 32 more_button, pin_chip, spotlight_chip, with_tile_menu,
32 33 };
33 34 use super::call_people::{lock_banner, lock_chip, options_dialog, people_button, people_panel};
@@ -72,7 +73,8 @@ const THUMBNAIL_ICON: f32 = 22.;
72 73 pub const LOBBY_TEXT: &str = "Waiting in the lobby...";
73 74 pub(super) const CHAT_PANEL_WIDTH: f32 = 320.;
74 75 pub(super) const OVERLAY_BELOW: f32 = 720.;
75 const CONTROLS_HEIGHT: f32 = 2. * 16. + CONTROL_SIZE;
76 const HEADER_END_PADDING: f32 = 8.;
77 const LEAVE_RADIUS: f32 = 6.;
76 78 const CHAT_HEADER_HEIGHT: f32 = 48.;
77 79 const REACTION_RISE: f32 = 24.;
78 80 const REACTION_FADE_FROM: f32 = 0.75;
@@ -383,7 +385,19 @@ pub fn mute_button(
383 385 } else {
384 386 (IconName::Mic, theme::surface_raised(), theme::text())
385 387 };
386 let button = round_control(id, glyph, background, foreground).size(px(size));
388 mic_action(round_control(id, glyph, background, foreground).size(px(size)), app, model)
389 }
390
391 fn toolbar_mic(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
392 let glyph = if model.muted {
393 IconName::MicOff
394 } else {
395 IconName::Mic
396 };
397 mic_action(tool_face("call-mute", glyph, "Mic", false), app, model)
398 }
399
400 fn mic_action(button: Stateful<Div>, app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
387 401 if !model.can_unmute() {
388 402 let hint = if model.audio_off {
389 403 AUDIO_OFF_HINT
@@ -416,8 +430,8 @@ pub fn leave_button(
416 430 let app = app.clone();
417 431 h_flex()
418 432 .id(id)
419 .h(px(if compact { 28. } else { CONTROL_SIZE }))
420 .px(px(if compact { 10. } else { 20. }))
433 .h(px(if compact { 28. } else { LEAVE_HEIGHT }))
434 .px(px(if compact { 10. } else { 14. }))
421 435 .gap(px(8.))
422 436 .flex_none()
423 437 .items_center()
@@ -425,13 +439,13 @@ pub fn leave_button(
425 439 .rounded_full()
426 440 .bg(theme::red())
427 441 .text_color(theme::white())
428 .text_size(px(if compact { 12. } else { 14. }))
442 .text_size(px(if compact { 12. } else { 13. }))
429 443 .font_weight(FontWeight::SEMIBOLD)
430 444 .cursor_pointer()
431 445 .hover(|button| button.opacity(0.85))
432 446 .child(icon(
433 447 IconName::PhoneOff,
434 if compact { 14. } else { 18. },
448 if compact { 14. } else { 16. },
435 449 theme::white(),
436 450 ))
437 451 .child(label)
@@ -454,7 +468,19 @@ pub(super) fn camera_button(app: &Entity<AppState>, model: &CallModel) -> Statef
454 468 } else {
455 469 (IconName::VideoOff, theme::surface_raised(), theme::text())
456 470 };
457 let button = round_control("call-camera", glyph, background, foreground);
471 camera_action(round_control("call-camera", glyph, background, foreground), app, model)
472 }
473
474 fn toolbar_camera(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
475 let glyph = if model.camera_on {
476 IconName::Video
477 } else {
478 IconName::VideoOff
479 };
480 camera_action(tool_face("call-camera", glyph, "Camera", false), app, model)
481 }
482
483 fn camera_action(button: Stateful<Div>, app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
458 484 if !model.can_use_camera() {
459 485 return button
460 486 .opacity(DISABLED_OPACITY)
@@ -690,12 +716,7 @@ fn share_button(
690 716 ) -> AnyElement {
691 717 if model.local_share.is_some() {
692 718 let app = app.clone();
693 return round_control(
694 "call-share-stop",
695 IconName::ScreenShareOff,
696 theme::accent(),
697 theme::on_accent(),
698 )
719 return tool_face("call-share-stop", IconName::ScreenShareOff, "Stop", true)
699 720 .tooltip(|window, cx| Tooltip::new("Stop sharing").build(window, cx))
700 721 .on_click(move |_, _, cx| {
701 722 cx.stop_propagation();
@@ -703,12 +724,7 @@ fn share_button(
703 724 })
704 725 .into_any_element();
705 726 }
706 let face = round_control(
707 "call-share-face",
708 IconName::ScreenShare,
709 theme::surface_raised(),
710 theme::text(),
711 );
727 let face = tool_face("call-share-face", IconName::ScreenShare, "Share", false);
712 728 if !model.can_share() {
713 729 return face
714 730 .opacity(DISABLED_OPACITY)
@@ -719,13 +735,8 @@ fn share_button(
719 735 let app = app.clone();
720 736 let open_app = app.clone();
721 737 let model = model.clone();
722 Button::new("call-share")
723 .ghost()
724 .p_0()
725 .size(px(CONTROL_SIZE))
726 .rounded_full()
727 .child(face)
728 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
738 tool_trigger("call-share", face)
739 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
729 740 share_items(popup, &app, &model, options)
730 741 })
731 742 .open(menu_open)
@@ -798,12 +809,7 @@ fn sharing_banner(app: &Entity<AppState>, model: &CallModel, sound: bool) -> Opt
798 809
799 810 fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div> {
800 811 let app = app.clone();
801 let (background, foreground) = if open {
802 (theme::accent(), theme::on_accent())
803 } else {
804 (theme::surface_raised(), theme::text())
805 };
806 round_control("call-chat", IconName::MessageCircle, background, foreground)
812 tool_face("call-chat", IconName::MessageCircle, "Chat", open)
807 813 .relative()
808 814 .tooltip(move |window, cx| {
809 815 Tooltip::new(if open {
@@ -821,21 +827,8 @@ fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div>
821 827
822 828 fn hand_button(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
823 829 let raised = model.own_hand.is_some();
824 let background = if raised {
825 theme::accent()
826 } else {
827 theme::surface_raised()
828 };
829 let foreground = if raised {
830 theme::on_accent()
831 } else {
832 theme::text()
833 };
834 let button = control_shell("call-hand", background).child(icon(
835 IconName::Hand,
836 CONTROL_ICON,
837 foreground,
838 ));
830 let label = if raised { "Lower" } else { "Raise" };
831 let button = tool_face("call-hand", IconName::Hand, label, raised);
839 832 let tooltip = if raised { "Lower hand" } else { "Raise hand" };
840 833 let button = button.tooltip(move |window, cx| Tooltip::new(tooltip).build(window, cx));
841 834 if !model.can_react() {
@@ -849,11 +842,7 @@ fn hand_button(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
849 842 }
850 843
851 844 fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
852 let face = control_shell("call-reactions-face", theme::surface_raised()).child(icon(
853 IconName::FaceSlightlySmiling,
854 CONTROL_ICON,
855 theme::text(),
856 ));
845 let face = tool_face("call-reactions-face", IconName::FaceSlightlySmiling, "React", false);
857 846 if !model.can_react() {
858 847 return face
859 848 .opacity(DISABLED_OPACITY)
@@ -862,16 +851,9 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
862 851 }
863 852 let app = app.clone();
864 853 Popover::new("call-reactions-popover")
865 .anchor(Anchor::BottomLeft)
866 .offset(px(10.))
867 .trigger(
868 Button::new("call-reactions")
869 .ghost()
870 .p_0()
871 .size(px(CONTROL_SIZE))
872 .rounded_full()
873 .child(face),
874 )
854 .anchor(Anchor::TopRight)
855 .offset(px(6.))
856 .trigger(tool_trigger("call-reactions", face))
875 857 .content(move |_, _, cx| {
876 858 let popover = cx.entity().downgrade();
877 859 h_flex()
@@ -902,6 +884,21 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
902 884 .into_any_element()
903 885 }
904 886
887 fn leave_group(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
888 let leave = leave_button(app, model, "call-leave", false)
889 .rounded(px(LEAVE_RADIUS))
890 .debug_selector(|| "shell/islands/main/call-header/controls/leave".into());
891 if !has_leave_menu(model) {
892 return leave.into_any_element();
893 }
894 h_flex()
895 .flex_none()
896 .gap(px(1.))
897 .child(leave.rounded_r(px(0.)))
898 .child(leave_menu(app, model))
899 .into_any_element()
900 }
901
905 902 fn has_leave_menu(model: &CallModel) -> bool {
906 903 model.kind == CallKind::Meeting
907 904 && (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))
@@ -915,15 +912,23 @@ fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
915 912 Button::new("call-leave-menu")
916 913 .ghost()
917 914 .p_0()
918 .size(px(CONTROL_SIZE))
919 .rounded_full()
920 .child(round_control(
921 "call-leave-menu-face",
922 IconName::ChevronUp,
923 theme::surface_raised(),
924 theme::text(),
925 ))
926 .dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {
915 .w(px(SPLIT_CHEVRON_WIDTH + 4.))
916 .h(px(LEAVE_HEIGHT))
917 .rounded_r(px(LEAVE_RADIUS))
918 .child(
919 div()
920 .id("call-leave-menu-face")
921 .size_full()
922 .flex()
923 .items_center()
924 .justify_center()
925 .rounded_r(px(LEAVE_RADIUS))
926 .bg(theme::red())
927 .cursor_pointer()
928 .hover(|face| face.opacity(0.85))
929 .child(icon(IconName::ChevronDown, 12., theme::white())),
930 )
931 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
927 932 let end_app = end_app.clone();
928 933 let lower_app = lower_app.clone();
929 934 let popup = popup.min_w(px(MENU_WIDTH));
@@ -1035,8 +1040,8 @@ fn devices_menu(
1035 1040 fn mic_menu_button(app: &Entity<AppState>, model: &CallModel, mic: MicSettings) -> impl IntoElement {
1036 1041 let app = app.clone();
1037 1042 let model = model.clone();
1038 chevron_button("call-mic-menu", "call-mic-menu-face")
1039 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
1043 split_chevron("call-mic-menu", "call-mic-menu-face")
1044 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
1040 1045 devices_menu(popup, &app, &model, mic)
1041 1046 })
1042 1047 }
@@ -1249,7 +1254,8 @@ pub fn render_call_view(
1249 1254 .w_full()
1250 1255 .h(px(HEADER_HEIGHT))
1251 1256 .flex_none()
1252 .px(px(20.))
1257 .pl(px(20.))
1258 .pr(px(HEADER_END_PADDING))
1253 1259 .gap(px(12.))
1254 1260 .items_center()
1255 1261 .child(icon(IconName::Phone, 18., theme::accent_text()))
@@ -1280,39 +1286,17 @@ pub fn render_call_view(
1280 1286 let region = stage_region(app, state, call, now, hold, share_stage);
1281 1287
1282 1288 let folded = folded_controls(state, call, fullscreen);
1283 let controls = h_flex()
1284 .w_full()
1285 .flex_none()
1286 .py(px(16.))
1287 .px(px(CONTROLS_PADDING))
1288 .gap(px(CONTROL_GAP))
1289 let panels_and_reactions = h_flex()
1290 .gap(px(TOOL_GAP))
1289 1291 .items_center()
1290 .justify_center()
1291 .child(
1292 h_flex()
1293 .debug_selector(|| "shell/islands/main/call-controls/mic".into())
1294 .h(px(CONTROL_SIZE))
1295 .items_center()
1296 .rounded_full()
1297 .bg(theme::surface_raised())
1298 .child(mute_button(app, model, "call-mute", CONTROL_SIZE))
1299 .child(mic_menu_button(app, model, state.call_mic)),
1292 .when(
1293 call.chat_thread().is_some() && !folded.folds(Foldable::Chat),
1294 |row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),
1300 1295 )
1301 .child(
1302 h_flex()
1303 .h(px(CONTROL_SIZE))
1304 .items_center()
1305 .rounded_full()
1306 .bg(theme::surface_raised())
1307 .child(camera_button(app, model))
1308 .children(camera_menu_button(app, model, CameraMenu::of(state))),
1296 .when(
1297 model.kind != CallKind::Test && !folded.folds(Foldable::People),
1298 |row| row.child(people_button(app, call.people_open, model.raised_hands())),
1309 1299 )
1310 .child(share_button(
1311 app,
1312 model,
1313 ShareOptions::of(state),
1314 call.share_menu_open,
1315 ))
1316 1300 .when(
1317 1301 model.has_reaction_controls() && !folded.folds(Foldable::RaiseHand),
1318 1302 |row| row.child(hand_button(app, model)),
@@ -1324,20 +1308,38 @@ pub fn render_call_view(
1324 1308 .when(!folded.folds(Foldable::View), |row| {
1325 1309 row.child(view_button(app, model, fullscreen))
1326 1310 })
1327 .children(more_button(app, model, &folded))
1328 .when(
1329 model.kind != CallKind::Test && !folded.folds(Foldable::People),
1330 |row| row.child(people_button(app, call.people_open, model.raised_hands())),
1331 )
1332 .when(
1333 call.chat_thread().is_some() && !folded.folds(Foldable::Chat),
1334 |row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),
1311 .children(more_button(app, model, &folded));
1312 let devices = h_flex()
1313 .gap(px(TOOL_GAP))
1314 .items_center()
1315 .child(
1316 h_flex()
1317 .items_center()
1318 .child(toolbar_camera(app, model))
1319 .children(camera_menu_button(app, model, CameraMenu::of(state))),
1335 1320 )
1336 1321 .child(
1337 leave_button(app, model, "call-leave", false)
1338 .debug_selector(|| "shell/islands/main/call-controls/leave".into()),
1322 h_flex()
1323 .debug_selector(|| "shell/islands/main/call-header/controls/mic".into())
1324 .items_center()
1325 .child(toolbar_mic(app, model))
1326 .child(mic_menu_button(app, model, state.call_mic)),
1339 1327 )
1340 .when(has_leave_menu(model), |row| row.child(leave_menu(app, model)));
1328 .child(share_button(
1329 app,
1330 model,
1331 ShareOptions::of(state),
1332 call.share_menu_open,
1333 ));
1334 let controls = h_flex()
1335 .debug_selector(|| "shell/islands/main/call-header/controls".into())
1336 .flex_none()
1337 .gap(px(GROUP_GAP))
1338 .items_center()
1339 .child(panels_and_reactions)
1340 .child(devices)
1341 .child(leave_group(app, model));
1342 let header = header.child(controls);
1341 1343
1342 1344 let top = v_flex()
1343 1345 .w_full()
@@ -1368,14 +1370,10 @@ pub fn render_call_view(
1368 1370 column.child(fullscreen_chrome("call-chrome-top", app, top))
1369 1371 })
1370 1372 .child(region)
1371 .when(chrome_visible, |column| {
1372 column.child(fullscreen_chrome("call-chrome-bottom", app, controls))
1373 })
1374 1373 } else {
1375 1374 base.rounded(px(10.))
1376 1375 .child(top.debug_selector(|| "shell/islands/main/call-header".into()))
1377 1376 .child(region)
1378 .child(controls.debug_selector(|| "shell/islands/main/call-controls".into()))
1379 1377 }
1380 1378 .children(captions_overlay(model, now))
1381 1379 .children(captions_hint_chip(model))
@@ -1421,9 +1419,9 @@ fn side_panels(panels: Vec<AnyElement>, island_width: f32) -> Vec<AnyElement> {
1421 1419 vec![
1422 1420 h_flex()
1423 1421 .absolute()
1424 .top_0()
1422 .top(px(HEADER_HEIGHT))
1425 1423 .right_0()
1426 .bottom(px(CONTROLS_HEIGHT))
1424 .bottom_0()
1427 1425 .gap(px(ISLAND_GAP))
1428 1426 .w(px(panels_width.min(island_width)))
1429 1427 .children(panels)
@@ -16,8 +16,9 @@ use gpui_kit::prelude::FluentBuilder as _;
16use gpui_kit::*;
16use gpui_kit::*;
17
17
18use super::avatar::person_avatar;
18use super::avatar::person_avatar;
19use super::call_control_fold::{
19use super::call_control_fold::{Foldable, FoldedControls, fixed_controls_width, folded_for_width};
20 CONTROL_GAP, CONTROLS_PADDING, Foldable, FoldedControls, fixed_controls_width, folded_for_width,
20use super::call_toolbar::{
21 GROUP_GAP, LEAVE_HEIGHT, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,
21};
22};
22use super::call_extras::{
23use super::call_extras::{
23 CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,
24 CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,
@@ -27,7 +28,7 @@ use super::call_health::{health_banner, health_indicator};
27use super::call_layouts::stage_region;
28use super::call_layouts::stage_region;
28use crate::call::measured_stage;
29use crate::call::measured_stage;
29use super::call_organizer::{
30use super::call_organizer::{
30 camera_menu_button, captions_hint_chip, captions_overlay, chevron_button, lobby_banner,
31 camera_menu_button, captions_hint_chip, captions_overlay, lobby_banner,
31 more_button, pin_chip, spotlight_chip, with_tile_menu,
32 more_button, pin_chip, spotlight_chip, with_tile_menu,
32};
33};
33use super::call_people::{lock_banner, lock_chip, options_dialog, people_button, people_panel};
34use super::call_people::{lock_banner, lock_chip, options_dialog, people_button, people_panel};
@@ -72,7 +73,8 @@ const THUMBNAIL_ICON: f32 = 22.;
72pub const LOBBY_TEXT: &str = "Waiting in the lobby...";
73pub const LOBBY_TEXT: &str = "Waiting in the lobby...";
73pub(super) const CHAT_PANEL_WIDTH: f32 = 320.;
74pub(super) const CHAT_PANEL_WIDTH: f32 = 320.;
74pub(super) const OVERLAY_BELOW: f32 = 720.;
75pub(super) const OVERLAY_BELOW: f32 = 720.;
75const CONTROLS_HEIGHT: f32 = 2. * 16. + CONTROL_SIZE;
76const HEADER_END_PADDING: f32 = 8.;
77const LEAVE_RADIUS: f32 = 6.;
76const CHAT_HEADER_HEIGHT: f32 = 48.;
78const CHAT_HEADER_HEIGHT: f32 = 48.;
77const REACTION_RISE: f32 = 24.;
79const REACTION_RISE: f32 = 24.;
78const REACTION_FADE_FROM: f32 = 0.75;
80const REACTION_FADE_FROM: f32 = 0.75;
@@ -383,7 +385,19 @@ pub fn mute_button(
383 } else {
385 } else {
384 (IconName::Mic, theme::surface_raised(), theme::text())
386 (IconName::Mic, theme::surface_raised(), theme::text())
385 };
387 };
386 let button = round_control(id, glyph, background, foreground).size(px(size));
388 mic_action(round_control(id, glyph, background, foreground).size(px(size)), app, model)
389}
390
391fn toolbar_mic(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
392 let glyph = if model.muted {
393 IconName::MicOff
394 } else {
395 IconName::Mic
396 };
397 mic_action(tool_face("call-mute", glyph, "Mic", false), app, model)
398}
399
400fn mic_action(button: Stateful<Div>, app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
387 if !model.can_unmute() {
401 if !model.can_unmute() {
388 let hint = if model.audio_off {
402 let hint = if model.audio_off {
389 AUDIO_OFF_HINT
403 AUDIO_OFF_HINT
@@ -416,8 +430,8 @@ pub fn leave_button(
416 let app = app.clone();
430 let app = app.clone();
417 h_flex()
431 h_flex()
418 .id(id)
432 .id(id)
419 .h(px(if compact { 28. } else { CONTROL_SIZE }))
433 .h(px(if compact { 28. } else { LEAVE_HEIGHT }))
420 .px(px(if compact { 10. } else { 20. }))
434 .px(px(if compact { 10. } else { 14. }))
421 .gap(px(8.))
435 .gap(px(8.))
422 .flex_none()
436 .flex_none()
423 .items_center()
437 .items_center()
@@ -425,13 +439,13 @@ pub fn leave_button(
425 .rounded_full()
439 .rounded_full()
426 .bg(theme::red())
440 .bg(theme::red())
427 .text_color(theme::white())
441 .text_color(theme::white())
428 .text_size(px(if compact { 12. } else { 14. }))
442 .text_size(px(if compact { 12. } else { 13. }))
429 .font_weight(FontWeight::SEMIBOLD)
443 .font_weight(FontWeight::SEMIBOLD)
430 .cursor_pointer()
444 .cursor_pointer()
431 .hover(|button| button.opacity(0.85))
445 .hover(|button| button.opacity(0.85))
432 .child(icon(
446 .child(icon(
433 IconName::PhoneOff,
447 IconName::PhoneOff,
434 if compact { 14. } else { 18. },
448 if compact { 14. } else { 16. },
435 theme::white(),
449 theme::white(),
436 ))
450 ))
437 .child(label)
451 .child(label)
@@ -454,7 +468,19 @@ pub(super) fn camera_button(app: &Entity<AppState>, model: &CallModel) -> Statef
454 } else {
468 } else {
455 (IconName::VideoOff, theme::surface_raised(), theme::text())
469 (IconName::VideoOff, theme::surface_raised(), theme::text())
456 };
470 };
457 let button = round_control("call-camera", glyph, background, foreground);
471 camera_action(round_control("call-camera", glyph, background, foreground), app, model)
472}
473
474fn toolbar_camera(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
475 let glyph = if model.camera_on {
476 IconName::Video
477 } else {
478 IconName::VideoOff
479 };
480 camera_action(tool_face("call-camera", glyph, "Camera", false), app, model)
481}
482
483fn camera_action(button: Stateful<Div>, app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
458 if !model.can_use_camera() {
484 if !model.can_use_camera() {
459 return button
485 return button
460 .opacity(DISABLED_OPACITY)
486 .opacity(DISABLED_OPACITY)
@@ -690,12 +716,7 @@ fn share_button(
690) -> AnyElement {
716) -> AnyElement {
691 if model.local_share.is_some() {
717 if model.local_share.is_some() {
692 let app = app.clone();
718 let app = app.clone();
693 return round_control(
719 return tool_face("call-share-stop", IconName::ScreenShareOff, "Stop", true)
694 "call-share-stop",
695 IconName::ScreenShareOff,
696 theme::accent(),
697 theme::on_accent(),
698 )
699 .tooltip(|window, cx| Tooltip::new("Stop sharing").build(window, cx))
720 .tooltip(|window, cx| Tooltip::new("Stop sharing").build(window, cx))
700 .on_click(move |_, _, cx| {
721 .on_click(move |_, _, cx| {
701 cx.stop_propagation();
722 cx.stop_propagation();
@@ -703,12 +724,7 @@ fn share_button(
703 })
724 })
704 .into_any_element();
725 .into_any_element();
705 }
726 }
706 let face = round_control(
727 let face = tool_face("call-share-face", IconName::ScreenShare, "Share", false);
707 "call-share-face",
708 IconName::ScreenShare,
709 theme::surface_raised(),
710 theme::text(),
711 );
712 if !model.can_share() {
728 if !model.can_share() {
713 return face
729 return face
714 .opacity(DISABLED_OPACITY)
730 .opacity(DISABLED_OPACITY)
@@ -719,13 +735,8 @@ fn share_button(
719 let app = app.clone();
735 let app = app.clone();
720 let open_app = app.clone();
736 let open_app = app.clone();
721 let model = model.clone();
737 let model = model.clone();
722 Button::new("call-share")
738 tool_trigger("call-share", face)
723 .ghost()
739 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
724 .p_0()
725 .size(px(CONTROL_SIZE))
726 .rounded_full()
727 .child(face)
728 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
729 share_items(popup, &app, &model, options)
740 share_items(popup, &app, &model, options)
730 })
741 })
731 .open(menu_open)
742 .open(menu_open)
@@ -798,12 +809,7 @@ fn sharing_banner(app: &Entity<AppState>, model: &CallModel, sound: bool) -> Opt
798
809
799fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div> {
810fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div> {
800 let app = app.clone();
811 let app = app.clone();
801 let (background, foreground) = if open {
812 tool_face("call-chat", IconName::MessageCircle, "Chat", open)
802 (theme::accent(), theme::on_accent())
803 } else {
804 (theme::surface_raised(), theme::text())
805 };
806 round_control("call-chat", IconName::MessageCircle, background, foreground)
807 .relative()
813 .relative()
808 .tooltip(move |window, cx| {
814 .tooltip(move |window, cx| {
809 Tooltip::new(if open {
815 Tooltip::new(if open {
@@ -821,21 +827,8 @@ fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div>
821
827
822fn hand_button(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
828fn hand_button(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
823 let raised = model.own_hand.is_some();
829 let raised = model.own_hand.is_some();
824 let background = if raised {
830 let label = if raised { "Lower" } else { "Raise" };
825 theme::accent()
831 let button = tool_face("call-hand", IconName::Hand, label, raised);
826 } else {
827 theme::surface_raised()
828 };
829 let foreground = if raised {
830 theme::on_accent()
831 } else {
832 theme::text()
833 };
834 let button = control_shell("call-hand", background).child(icon(
835 IconName::Hand,
836 CONTROL_ICON,
837 foreground,
838 ));
839 let tooltip = if raised { "Lower hand" } else { "Raise hand" };
832 let tooltip = if raised { "Lower hand" } else { "Raise hand" };
840 let button = button.tooltip(move |window, cx| Tooltip::new(tooltip).build(window, cx));
833 let button = button.tooltip(move |window, cx| Tooltip::new(tooltip).build(window, cx));
841 if !model.can_react() {
834 if !model.can_react() {
@@ -849,11 +842,7 @@ fn hand_button(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
849}
842}
850
843
851fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
844fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
852 let face = control_shell("call-reactions-face", theme::surface_raised()).child(icon(
845 let face = tool_face("call-reactions-face", IconName::FaceSlightlySmiling, "React", false);
853 IconName::FaceSlightlySmiling,
854 CONTROL_ICON,
855 theme::text(),
856 ));
857 if !model.can_react() {
846 if !model.can_react() {
858 return face
847 return face
859 .opacity(DISABLED_OPACITY)
848 .opacity(DISABLED_OPACITY)
@@ -862,16 +851,9 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
862 }
851 }
863 let app = app.clone();
852 let app = app.clone();
864 Popover::new("call-reactions-popover")
853 Popover::new("call-reactions-popover")
865 .anchor(Anchor::BottomLeft)
854 .anchor(Anchor::TopRight)
866 .offset(px(10.))
855 .offset(px(6.))
867 .trigger(
856 .trigger(tool_trigger("call-reactions", face))
868 Button::new("call-reactions")
869 .ghost()
870 .p_0()
871 .size(px(CONTROL_SIZE))
872 .rounded_full()
873 .child(face),
874 )
875 .content(move |_, _, cx| {
857 .content(move |_, _, cx| {
876 let popover = cx.entity().downgrade();
858 let popover = cx.entity().downgrade();
877 h_flex()
859 h_flex()
@@ -902,6 +884,21 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
902 .into_any_element()
884 .into_any_element()
903}
885}
904
886
887fn leave_group(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
888 let leave = leave_button(app, model, "call-leave", false)
889 .rounded(px(LEAVE_RADIUS))
890 .debug_selector(|| "shell/islands/main/call-header/controls/leave".into());
891 if !has_leave_menu(model) {
892 return leave.into_any_element();
893 }
894 h_flex()
895 .flex_none()
896 .gap(px(1.))
897 .child(leave.rounded_r(px(0.)))
898 .child(leave_menu(app, model))
899 .into_any_element()
900}
901
905fn has_leave_menu(model: &CallModel) -> bool {
902fn has_leave_menu(model: &CallModel) -> bool {
906 model.kind == CallKind::Meeting
903 model.kind == CallKind::Meeting
907 && (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))
904 && (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))
@@ -915,15 +912,23 @@ fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
915 Button::new("call-leave-menu")
912 Button::new("call-leave-menu")
916 .ghost()
913 .ghost()
917 .p_0()
914 .p_0()
918 .size(px(CONTROL_SIZE))
915 .w(px(SPLIT_CHEVRON_WIDTH + 4.))
919 .rounded_full()
916 .h(px(LEAVE_HEIGHT))
920 .child(round_control(
917 .rounded_r(px(LEAVE_RADIUS))
921 "call-leave-menu-face",
918 .child(
922 IconName::ChevronUp,
919 div()
923 theme::surface_raised(),
920 .id("call-leave-menu-face")
924 theme::text(),
921 .size_full()
925 ))
922 .flex()
926 .dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {
923 .items_center()
924 .justify_center()
925 .rounded_r(px(LEAVE_RADIUS))
926 .bg(theme::red())
927 .cursor_pointer()
928 .hover(|face| face.opacity(0.85))
929 .child(icon(IconName::ChevronDown, 12., theme::white())),
930 )
931 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
927 let end_app = end_app.clone();
932 let end_app = end_app.clone();
928 let lower_app = lower_app.clone();
933 let lower_app = lower_app.clone();
929 let popup = popup.min_w(px(MENU_WIDTH));
934 let popup = popup.min_w(px(MENU_WIDTH));
@@ -1035,8 +1040,8 @@ fn devices_menu(
1035fn mic_menu_button(app: &Entity<AppState>, model: &CallModel, mic: MicSettings) -> impl IntoElement {
1040fn mic_menu_button(app: &Entity<AppState>, model: &CallModel, mic: MicSettings) -> impl IntoElement {
1036 let app = app.clone();
1041 let app = app.clone();
1037 let model = model.clone();
1042 let model = model.clone();
1038 chevron_button("call-mic-menu", "call-mic-menu-face")
1043 split_chevron("call-mic-menu", "call-mic-menu-face")
1039 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
1044 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
1040 devices_menu(popup, &app, &model, mic)
1045 devices_menu(popup, &app, &model, mic)
1041 })
1046 })
1042}
1047}
@@ -1249,7 +1254,8 @@ pub fn render_call_view(
1249 .w_full()
1254 .w_full()
1250 .h(px(HEADER_HEIGHT))
1255 .h(px(HEADER_HEIGHT))
1251 .flex_none()
1256 .flex_none()
1252 .px(px(20.))
1257 .pl(px(20.))
1258 .pr(px(HEADER_END_PADDING))
1253 .gap(px(12.))
1259 .gap(px(12.))
1254 .items_center()
1260 .items_center()
1255 .child(icon(IconName::Phone, 18., theme::accent_text()))
1261 .child(icon(IconName::Phone, 18., theme::accent_text()))
@@ -1280,39 +1286,17 @@ pub fn render_call_view(
1280 let region = stage_region(app, state, call, now, hold, share_stage);
1286 let region = stage_region(app, state, call, now, hold, share_stage);
1281
1287
1282 let folded = folded_controls(state, call, fullscreen);
1288 let folded = folded_controls(state, call, fullscreen);
1283 let controls = h_flex()
1289 let panels_and_reactions = h_flex()
1284 .w_full()
1290 .gap(px(TOOL_GAP))
1285 .flex_none()
1286 .py(px(16.))
1287 .px(px(CONTROLS_PADDING))
1288 .gap(px(CONTROL_GAP))
1289 .items_center()
1291 .items_center()
1290 .justify_center()
1292 .when(
1291 .child(
1293 call.chat_thread().is_some() && !folded.folds(Foldable::Chat),
1292 h_flex()
1294 |row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),
1293 .debug_selector(|| "shell/islands/main/call-controls/mic".into())
1294 .h(px(CONTROL_SIZE))
1295 .items_center()
1296 .rounded_full()
1297 .bg(theme::surface_raised())
1298 .child(mute_button(app, model, "call-mute", CONTROL_SIZE))
1299 .child(mic_menu_button(app, model, state.call_mic)),
1300 )
1295 )
1301 .child(
1296 .when(
1302 h_flex()
1297 model.kind != CallKind::Test && !folded.folds(Foldable::People),
1303 .h(px(CONTROL_SIZE))
1298 |row| row.child(people_button(app, call.people_open, model.raised_hands())),
1304 .items_center()
1305 .rounded_full()
1306 .bg(theme::surface_raised())
1307 .child(camera_button(app, model))
1308 .children(camera_menu_button(app, model, CameraMenu::of(state))),
1309 )
1299 )
1310 .child(share_button(
1311 app,
1312 model,
1313 ShareOptions::of(state),
1314 call.share_menu_open,
1315 ))
1316 .when(
1300 .when(
1317 model.has_reaction_controls() && !folded.folds(Foldable::RaiseHand),
1301 model.has_reaction_controls() && !folded.folds(Foldable::RaiseHand),
1318 |row| row.child(hand_button(app, model)),
1302 |row| row.child(hand_button(app, model)),
@@ -1324,20 +1308,38 @@ pub fn render_call_view(
1324 .when(!folded.folds(Foldable::View), |row| {
1308 .when(!folded.folds(Foldable::View), |row| {
1325 row.child(view_button(app, model, fullscreen))
1309 row.child(view_button(app, model, fullscreen))
1326 })
1310 })
1327 .children(more_button(app, model, &folded))
1311 .children(more_button(app, model, &folded));
1328 .when(
1312 let devices = h_flex()
1329 model.kind != CallKind::Test && !folded.folds(Foldable::People),
1313 .gap(px(TOOL_GAP))
1330 |row| row.child(people_button(app, call.people_open, model.raised_hands())),
1314 .items_center()
1331 )
1315 .child(
1332 .when(
1316 h_flex()
1333 call.chat_thread().is_some() && !folded.folds(Foldable::Chat),
1317 .items_center()
1334 |row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),
1318 .child(toolbar_camera(app, model))
1319 .children(camera_menu_button(app, model, CameraMenu::of(state))),
1335 )
1320 )
1336 .child(
1321 .child(
1337 leave_button(app, model, "call-leave", false)
1322 h_flex()
1338 .debug_selector(|| "shell/islands/main/call-controls/leave".into()),
1323 .debug_selector(|| "shell/islands/main/call-header/controls/mic".into())
1324 .items_center()
1325 .child(toolbar_mic(app, model))
1326 .child(mic_menu_button(app, model, state.call_mic)),
1339 )
1327 )
1340 .when(has_leave_menu(model), |row| row.child(leave_menu(app, model)));
1328 .child(share_button(
1329 app,
1330 model,
1331 ShareOptions::of(state),
1332 call.share_menu_open,
1333 ));
1334 let controls = h_flex()
1335 .debug_selector(|| "shell/islands/main/call-header/controls".into())
1336 .flex_none()
1337 .gap(px(GROUP_GAP))
1338 .items_center()
1339 .child(panels_and_reactions)
1340 .child(devices)
1341 .child(leave_group(app, model));
1342 let header = header.child(controls);
1341
1343
1342 let top = v_flex()
1344 let top = v_flex()
1343 .w_full()
1345 .w_full()
@@ -1368,14 +1370,10 @@ pub fn render_call_view(
1368 column.child(fullscreen_chrome("call-chrome-top", app, top))
1370 column.child(fullscreen_chrome("call-chrome-top", app, top))
1369 })
1371 })
1370 .child(region)
1372 .child(region)
1371 .when(chrome_visible, |column| {
1372 column.child(fullscreen_chrome("call-chrome-bottom", app, controls))
1373 })
1374 } else {
1373 } else {
1375 base.rounded(px(10.))
1374 base.rounded(px(10.))
1376 .child(top.debug_selector(|| "shell/islands/main/call-header".into()))
1375 .child(top.debug_selector(|| "shell/islands/main/call-header".into()))
1377 .child(region)
1376 .child(region)
1378 .child(controls.debug_selector(|| "shell/islands/main/call-controls".into()))
1379 }
1377 }
1380 .children(captions_overlay(model, now))
1378 .children(captions_overlay(model, now))
1381 .children(captions_hint_chip(model))
1379 .children(captions_hint_chip(model))
@@ -1421,9 +1419,9 @@ fn side_panels(panels: Vec<AnyElement>, island_width: f32) -> Vec<AnyElement> {
1421 vec![
1419 vec![
1422 h_flex()
1420 h_flex()
1423 .absolute()
1421 .absolute()
1424 .top_0()
1422 .top(px(HEADER_HEIGHT))
1425 .right_0()
1423 .right_0()
1426 .bottom(px(CONTROLS_HEIGHT))
1424 .bottom_0()
1427 .gap(px(ISLAND_GAP))
1425 .gap(px(ISLAND_GAP))
1428 .w(px(panels_width.min(island_width)))
1426 .w(px(panels_width.min(island_width)))
1429 .children(panels)
1427 .children(panels)
crates/app/src/views/call_view_menu.rs +7 −14
@@ -1,6 +1,5 @@
1 1 use gpui_kit::assets::IconName;
2 2 use gpui_kit::component::{
3 button::{Button, ButtonVariants as _},
4 3 h_flex,
5 4 menu::{DropdownMenu as _, PopupMenu, PopupMenuItem},
6 5 switch::Switch,
@@ -8,7 +7,8 @@ use gpui_kit::component::{
8 7 use gpui_kit::prelude::FluentBuilder as _;
9 8 use gpui_kit::*;
10 9
11 use super::call_view::{CONTROL_SIZE, DISABLED_OPACITY, MENU_WIDTH, round_control};
10 use super::call_toolbar::{tool_face, tool_trigger};
11 use super::call_view::{DISABLED_OPACITY, MENU_WIDTH};
12 12 use super::shortcuts::keys_for_label;
13 13 use crate::app_state::AppState;
14 14 use crate::call::{CallLayout, CallModel};
@@ -137,18 +137,11 @@ pub(super) fn view_button(
137 137 ) -> AnyElement {
138 138 let app = app.clone();
139 139 let model = model.clone();
140 Button::new("call-view")
141 .ghost()
142 .p_0()
143 .size(px(CONTROL_SIZE))
144 .rounded_full()
145 .child(round_control(
146 "call-view-face",
147 IconName::LayoutGrid,
148 theme::surface_raised(),
149 theme::text(),
150 ))
151 .dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {
140 tool_trigger(
141 "call-view",
142 tool_face("call-view-face", IconName::LayoutGrid, "View", false),
143 )
144 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
152 145 view_items(popup, &app, &model, fullscreen)
153 146 })
154 147 .into_any_element()
@@ -1,6 +1,5 @@
1use gpui_kit::assets::IconName;
1use gpui_kit::assets::IconName;
2use gpui_kit::component::{
2use gpui_kit::component::{
3 button::{Button, ButtonVariants as _},
4 h_flex,
3 h_flex,
5 menu::{DropdownMenu as _, PopupMenu, PopupMenuItem},
4 menu::{DropdownMenu as _, PopupMenu, PopupMenuItem},
6 switch::Switch,
5 switch::Switch,
@@ -8,7 +7,8 @@ use gpui_kit::component::{
8use gpui_kit::prelude::FluentBuilder as _;
7use gpui_kit::prelude::FluentBuilder as _;
9use gpui_kit::*;
8use gpui_kit::*;
10
9
11use super::call_view::{CONTROL_SIZE, DISABLED_OPACITY, MENU_WIDTH, round_control};
10use super::call_toolbar::{tool_face, tool_trigger};
11use super::call_view::{DISABLED_OPACITY, MENU_WIDTH};
12use super::shortcuts::keys_for_label;
12use super::shortcuts::keys_for_label;
13use crate::app_state::AppState;
13use crate::app_state::AppState;
14use crate::call::{CallLayout, CallModel};
14use crate::call::{CallLayout, CallModel};
@@ -137,18 +137,11 @@ pub(super) fn view_button(
137) -> AnyElement {
137) -> AnyElement {
138 let app = app.clone();
138 let app = app.clone();
139 let model = model.clone();
139 let model = model.clone();
140 Button::new("call-view")
140 tool_trigger(
141 .ghost()
141 "call-view",
142 .p_0()
142 tool_face("call-view-face", IconName::LayoutGrid, "View", false),
143 .size(px(CONTROL_SIZE))
143 )
144 .rounded_full()
144 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
145 .child(round_control(
146 "call-view-face",
147 IconName::LayoutGrid,
148 theme::surface_raised(),
149 theme::text(),
150 ))
151 .dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {
152 view_items(popup, &app, &model, fullscreen)
145 view_items(popup, &app, &model, fullscreen)
153 })
146 })
154 .into_any_element()
147 .into_any_element()
crates/app/src/views/mod.rs +1 −0
@@ -24,6 +24,7 @@ pub mod call_stage;
24 24 pub mod call_transcript;
25 25 pub mod call_view;
26 26 pub mod call_window;
27 pub mod call_toolbar;
27 28 pub mod call_view_menu;
28 29 pub mod calendar_date_picker;
29 30 pub mod calendar_month;
@@ -24,6 +24,7 @@ pub mod call_stage;
24pub mod call_transcript;
24pub mod call_transcript;
25pub mod call_view;
25pub mod call_view;
26pub mod call_window;
26pub mod call_window;
27pub mod call_toolbar;
27pub mod call_view_menu;
28pub mod call_view_menu;
28pub mod calendar_date_picker;
29pub mod calendar_date_picker;
29pub mod calendar_month;
30pub mod calendar_month;