fix(share): resolve call_view share menu for portal picker
@@ -16,32 +16,32 @@ 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
fixed_controls_width, folded_for_width, Foldable, FoldedControls, CONTROLS_PADDING, CONTROL_GAP,
19
use super::call_control_fold::{Foldable, FoldedControls, fixed_controls_width, folded_for_width, in_more_menu};
20
use super::call_toolbar::{
21
GROUP_GAP, LEAVE_HEIGHT, group_divider, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,
21
22
};
22
23
use super::call_extras::{
23
consent_overlay, consult_banner, hold_panel, recording_chip, return_button, room_chip,
24
whiteboard_stage, CameraMenu,
24
CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,
25
room_chip, whiteboard_stage,
25
26
};
26
27
use super::call_health::{health_banner, health_indicator};
27
28
use super::call_layouts::stage_region;
29
use crate::call::measured_stage;
28
30
use super::call_organizer::{
29
camera_menu_button, captions_hint_chip, captions_overlay, chevron_button, lobby_banner,
31
camera_menu_button, captions_hint_chip, captions_overlay, lobby_banner,
30
32
more_button, pin_chip, spotlight_chip, with_tile_menu,
31
33
};
32
34
use super::call_people::{lock_banner, lock_chip, options_dialog, people_button, people_panel};
33
use super::call_stage::{popped_placeholder, render_stage, StageMode, WAITING_TEXT};
35
use super::call_stage::{POP_OUT_TOOLTIP, StageMode, popped_placeholder, render_stage};
34
36
use super::call_view_menu::view_button;
35
use super::widgets::{corner_badge, count_badge, icon, Corner};
37
use app_ui_kit::layout::ISLAND_GAP;
38
use super::widgets::{Corner, corner_badge, count_badge, icon};
36
39
use crate::app_state::AppState;
37
use crate::call::measured_stage;
38
use crate::call::model::ShareMenuEntry;
39
use crate::call::TileSize;
40
40
use crate::call::REACTION_SHOWN;
41
use crate::call::TileSize;
41
42
use crate::call::{ActiveCall, CallKind, CallModel, Tile, TileState};
42
43
use crate::rows::reaction_glyph as chat_reaction_glyph;
43
44
use crate::theme;
44
use app_ui_kit::layout::ISLAND_GAP;
45
45
46
46
const HEADER_HEIGHT: f32 = 60.;
47
47
const RING_WIDTH: f32 = 3.;
@@ -64,6 +64,7 @@ pub const NO_CAMERA_HINT: &str = "No camera found";
64
64
pub const NO_SHARE_HINT: &str = "Sharing starts once the call is connected";
65
65
pub const NO_WINDOWS_HINT: &str = "No windows found";
66
66
pub(super) const BANNER_HEIGHT: f32 = 40.;
67
const MAX_WINDOW_ITEMS: usize = 12;
67
68
pub const SHARE_THUMBNAIL_TAG: &str = "call/share-menu/thumbnail";
68
69
const SCREEN_THUMBNAIL: (f32, f32) = (128., 72.);
69
70
const WINDOW_THUMBNAIL: (f32, f32) = (96., 54.);
@@ -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;
@@ -88,13 +90,8 @@ const PUSH_TO_TALK_TOP: f32 = 12.;
88
90
89
91
pub fn reaction_glyph(reaction: &Reaction) -> String {
90
92
match reaction {
91
Reaction::Like => "\u{1F44D}".to_owned(),
92
// Keep VS16 so the heart stays emoji-style, not a text outline.
93
Reaction::Heart => "\u{2764}\u{FE0F}".to_owned(),
94
93
Reaction::Applause => "\u{1F44F}".to_owned(),
95
Reaction::Laugh => "\u{1F606}".to_owned(),
96
Reaction::Surprised => "\u{1F62E}".to_owned(),
97
Reaction::Other(name) => chat_reaction_glyph(name),
94
other => chat_reaction_glyph(other.name()),
98
95
}
99
96
}
100
97
@@ -146,7 +143,6 @@ fn reaction_chip(reaction: Reaction, serial: u64) -> AnyElement {
146
143
.rounded_full()
147
144
.bg(theme::popup())
148
145
.text_size(px(if emoji { 20. } else { 13. }))
149
.when(emoji, |chip| chip.font_family(theme::EMOJI_FONT_FAMILY))
150
146
.child(glyph)
151
147
.with_animation(
152
148
("call-reaction", serial as usize),
@@ -255,23 +251,9 @@ struct NamePlate {
255
251
256
252
fn name_plate_metrics(size: TileSize) -> NamePlate {
257
253
if size.height < COMPACT_PLATE_BELOW {
258
NamePlate {
259
inset: 4.,
260
padding_x: 6.,
261
padding_y: 2.,
262
radius: 4.,
263
text_size: 11.,
264
max_width_share: 0.6,
265
}
254
NamePlate { inset: 4., padding_x: 6., padding_y: 2., radius: 4., text_size: 11., max_width_share: 0.6 }
266
255
} else {
267
NamePlate {
268
inset: 8.,
269
padding_x: 8.,
270
padding_y: 4.,
271
radius: 6.,
272
text_size: 12.,
273
max_width_share: 1.,
274
}
256
NamePlate { inset: 8., padding_x: 8., padding_y: 4., radius: 6., text_size: 12., max_width_share: 1. }
275
257
}
276
258
}
277
259
@@ -281,9 +263,7 @@ fn name_plate(size: TileSize, name: &str) -> Div {
281
263
.absolute()
282
264
.left(px(plate.inset))
283
265
.bottom(px(plate.inset))
284
.max_w(px(((size.width - 3. * plate.inset)
285
* plate.max_width_share)
286
.max(0.)))
266
.max_w(px(((size.width - 3. * plate.inset) * plate.max_width_share).max(0.)))
287
267
.truncate()
288
268
.px(px(plate.padding_x))
289
269
.py(px(plate.padding_y))
@@ -405,7 +385,19 @@ pub fn mute_button(
405
385
} else {
406
386
(IconName::Mic, theme::surface_raised(), theme::text())
407
387
};
408
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> {
409
401
if !model.can_unmute() {
410
402
let hint = if model.audio_off {
411
403
AUDIO_OFF_HINT
@@ -438,8 +430,8 @@ pub fn leave_button(
438
430
let app = app.clone();
439
431
h_flex()
440
432
.id(id)
441
.h(px(if compact { 28. } else { CONTROL_SIZE }))
442
.px(px(if compact { 10. } else { 20. }))
433
.h(px(if compact { 28. } else { LEAVE_HEIGHT }))
434
.px(px(if compact { 10. } else { 14. }))
443
435
.gap(px(8.))
444
436
.flex_none()
445
437
.items_center()
@@ -447,13 +439,13 @@ pub fn leave_button(
447
439
.rounded_full()
448
440
.bg(theme::red())
449
441
.text_color(theme::white())
450
.text_size(px(if compact { 12. } else { 14. }))
442
.text_size(px(if compact { 12. } else { 13. }))
451
443
.font_weight(FontWeight::SEMIBOLD)
452
444
.cursor_pointer()
453
445
.hover(|button| button.opacity(0.85))
454
446
.child(icon(
455
447
IconName::PhoneOff,
456
if compact { 14. } else { 18. },
448
if compact { 14. } else { 16. },
457
449
theme::white(),
458
450
))
459
451
.child(label)
@@ -463,11 +455,7 @@ pub fn leave_button(
463
455
})
464
456
}
465
457
466
fn share_stage_element(
467
app: &Entity<AppState>,
468
state: &AppState,
469
call: &ActiveCall,
470
) -> Option<AnyElement> {
458
fn share_stage_element(app: &Entity<AppState>, state: &AppState, call: &ActiveCall) -> Option<AnyElement> {
471
459
if call.share_stage.popped && call.model.screen_sharer.is_some() {
472
460
return Some(popped_placeholder(app));
473
461
}
@@ -480,7 +468,19 @@ pub(super) fn camera_button(app: &Entity<AppState>, model: &CallModel) -> Statef
480
468
} else {
481
469
(IconName::VideoOff, theme::surface_raised(), theme::text())
482
470
};
483
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> {
484
484
if !model.can_use_camera() {
485
485
return button
486
486
.opacity(DISABLED_OPACITY)
@@ -550,9 +550,7 @@ fn standout_switch_item(app: &Entity<AppState>, standout: bool, camera_on: bool)
550
550
})
551
551
})
552
552
.disabled(!camera_on)
553
.on_click(move |_, _, cx| {
554
app.update(cx, |state, cx| state.set_call_share_standout(!standout, cx))
555
})
553
.on_click(move |_, _, cx| app.update(cx, |state, cx| state.set_call_share_standout(!standout, cx)))
556
554
}
557
555
558
556
fn music_mode_item(app: &Entity<AppState>, mic: MicSettings) -> PopupMenuItem {
@@ -626,72 +624,6 @@ fn share_items(
626
624
model: &CallModel,
627
625
options: ShareOptions,
628
626
) -> PopupMenu {
629
<<<<<<< ours
630
let single_screen = model.screens().len() == 1;
631
let mut screen_index = 0usize;
632
let mut separated = false;
633
let mut popup = popup.min_w(px(SHARE_MENU_WIDTH));
634
for entry in model.share_menu_entries() {
635
popup = match entry {
636
ShareMenuEntry::Sound => popup.item(sound_switch_item(app, options.sound)),
637
ShareMenuEntry::Motion => popup.item(motion_switch_item(app, options.motion)),
638
ShareMenuEntry::Standout => {
639
popup.item(standout_switch_item(app, options.standout, model.camera_on))
640
}
641
ShareMenuEntry::Portal(kind) => {
642
if !separated {
643
popup = popup.separator();
644
separated = true;
645
}
646
let label = match kind {
647
ShareKind::Screen => "Share entire screen",
648
ShareKind::Window => "Share a window",
649
};
650
let app = app.clone();
651
popup.item(PopupMenuItem::new(label).on_click(move |_, _, cx| {
652
app.update(cx, |state, cx| state.start_portal_share(kind, cx))
653
}))
654
}
655
ShareMenuEntry::Source(source) => {
656
if !separated {
657
popup = popup.separator();
658
separated = true;
659
}
660
let (label, thumbnail, icon, size) = if source.kind == ShareKind::Screen {
661
screen_index += 1;
662
let label = if single_screen {
663
"Share entire screen".to_owned()
664
} else {
665
format!("Share screen {screen_index}")
666
};
667
(
668
label,
669
model.share_thumbnail(&source),
670
IconName::Monitor,
671
SCREEN_THUMBNAIL,
672
)
673
} else {
674
(
675
source.label(),
676
model.share_thumbnail(&source),
677
IconName::AppWindow,
678
WINDOW_THUMBNAIL,
679
)
680
};
681
let app = app.clone();
682
popup.item(share_source_item(label, thumbnail, icon, size).on_click(
683
move |_, _, cx| {
684
app.update(cx, |state, cx| state.start_call_share(source.clone(), cx))
685
},
686
))
687
}
688
ShareMenuEntry::WindowHeader => popup
689
.separator()
690
.item(PopupMenuItem::label("Share a window...")),
691
ShareMenuEntry::NoWindows => {
692
popup.item(PopupMenuItem::new(NO_WINDOWS_HINT).disabled(true))
693
}
694
=======
695
627
let mut popup = popup
696
628
.min_w(px(SHARE_MENU_WIDTH))
697
629
.item(sound_switch_item(app, options.sound))
@@ -722,8 +654,33 @@ fn share_items(
722
654
"Share entire screen".to_owned()
723
655
} else {
724
656
format!("Share screen {}", index + 1)
725
>>>>>>> theirs
726
657
};
658
let thumbnail = model.share_thumbnail(source);
659
let source = source.clone();
660
let app = app.clone();
661
popup = popup.item(
662
share_source_item(label, thumbnail, IconName::Monitor, SCREEN_THUMBNAIL).on_click(
663
move |_, _, cx| app.update(cx, |state, cx| state.start_call_share(source.clone(), cx)),
664
),
665
);
666
}
667
popup = popup
668
.separator()
669
.item(PopupMenuItem::label("Share a window..."));
670
let windows = model.windows();
671
if windows.is_empty() {
672
return popup.item(PopupMenuItem::new(NO_WINDOWS_HINT).disabled(true));
673
}
674
for source in windows.into_iter().take(MAX_WINDOW_ITEMS) {
675
let label = source.label();
676
let thumbnail = model.share_thumbnail(source);
677
let source = source.clone();
678
let app = app.clone();
679
popup = popup.item(
680
share_source_item(label, thumbnail, IconName::AppWindow, WINDOW_THUMBNAIL).on_click(
681
move |_, _, cx| app.update(cx, |state, cx| state.start_call_share(source.clone(), cx)),
682
),
683
);
727
684
}
728
685
popup
729
686
}
@@ -776,12 +733,7 @@ fn share_button(
776
733
) -> AnyElement {
777
734
if model.local_share.is_some() {
778
735
let app = app.clone();
779
return round_control(
780
"call-share-stop",
781
IconName::ScreenShareOff,
782
theme::accent(),
783
theme::on_accent(),
784
)
736
return tool_face("call-share-stop", IconName::ScreenShareOff, "Stop", true)
785
737
.tooltip(|window, cx| Tooltip::new("Stop sharing").build(window, cx))
786
738
.on_click(move |_, _, cx| {
787
739
cx.stop_propagation();
@@ -789,12 +741,7 @@ fn share_button(
789
741
})
790
742
.into_any_element();
791
743
}
792
let face = round_control(
793
"call-share-face",
794
IconName::ScreenShare,
795
theme::surface_raised(),
796
theme::text(),
797
);
744
let face = tool_face("call-share-face", IconName::ScreenShare, "Share", false);
798
745
if !model.can_share() {
799
746
return face
800
747
.opacity(DISABLED_OPACITY)
@@ -805,13 +752,8 @@ fn share_button(
805
752
let app = app.clone();
806
753
let open_app = app.clone();
807
754
let model = model.clone();
808
Button::new("call-share")
809
.ghost()
810
.p_0()
811
.size(px(CONTROL_SIZE))
812
.rounded_full()
813
.child(face)
814
.dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
755
tool_trigger("call-share", face)
756
.dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
815
757
share_items(popup, &app, &model, options)
816
758
})
817
759
.open(menu_open)
@@ -884,12 +826,7 @@ fn sharing_banner(app: &Entity<AppState>, model: &CallModel, sound: bool) -> Opt
884
826
885
827
fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div> {
886
828
let app = app.clone();
887
let (background, foreground) = if open {
888
(theme::accent(), theme::on_accent())
889
} else {
890
(theme::surface_raised(), theme::text())
891
};
892
round_control("call-chat", IconName::MessageCircle, background, foreground)
829
tool_face("call-chat", IconName::MessageCircle, "Chat", open)
893
830
.relative()
894
831
.tooltip(move |window, cx| {
895
832
Tooltip::new(if open {
@@ -905,41 +842,9 @@ fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div>
905
842
.on_click(move |_, _, cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)))
906
843
}
907
844
908
fn hand_button(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {
909
let raised = model.own_hand.is_some();
910
let background = if raised {
911
theme::accent()
912
} else {
913
theme::surface_raised()
914
};
915
let foreground = if raised {
916
theme::on_accent()
917
} else {
918
theme::text()
919
};
920
let button = control_shell("call-hand", background).child(icon(
921
IconName::Hand,
922
CONTROL_ICON,
923
foreground,
924
));
925
let tooltip = if raised { "Lower hand" } else { "Raise hand" };
926
let button = button.tooltip(move |window, cx| Tooltip::new(tooltip).build(window, cx));
927
if !model.can_react() {
928
return button.opacity(DISABLED_OPACITY).cursor_default();
929
}
930
let app = app.clone();
931
button.on_click(move |_, _, cx| {
932
cx.stop_propagation();
933
app.update(cx, |state, cx| state.toggle_call_hand(cx));
934
})
935
}
936
937
845
fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
938
let face = control_shell("call-reactions-face", theme::surface_raised()).child(icon(
939
IconName::FaceSlightlySmiling,
940
CONTROL_ICON,
941
theme::text(),
942
));
846
let raised = model.own_hand.is_some();
847
let face = tool_face("call-reactions-face", IconName::FaceSlightlySmiling, "React", raised);
943
848
if !model.can_react() {
944
849
return face
945
850
.opacity(DISABLED_OPACITY)
@@ -948,19 +853,14 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
948
853
}
949
854
let app = app.clone();
950
855
Popover::new("call-reactions-popover")
951
.anchor(Anchor::BottomLeft)
952
.offset(px(10.))
953
.trigger(
954
Button::new("call-reactions")
955
.ghost()
956
.p_0()
957
.size(px(CONTROL_SIZE))
958
.rounded_full()
959
.child(face),
960
)
856
.anchor(Anchor::TopRight)
857
.offset(px(6.))
858
.trigger(tool_trigger("call-reactions", face))
961
859
.content(move |_, _, cx| {
962
860
let popover = cx.entity().downgrade();
963
h_flex()
861
let hand_app = app.clone();
862
let hand_popover = popover.clone();
863
let reactions = h_flex()
964
864
.id("call-reactions-row")
965
865
.gap(px(4.))
966
866
.children(Reaction::ALL.into_iter().map(|reaction| {
@@ -974,23 +874,68 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
974
874
.justify_center()
975
875
.rounded(px(8.))
976
876
.text_size(px(24.))
977
.font_family(theme::EMOJI_FONT_FAMILY)
978
877
.cursor_pointer()
979
878
.hover(|cell| cell.bg(theme::border_strong()))
980
879
.child(reaction_glyph(&reaction))
981
880
.on_click(move |_, window, cx| {
982
app.update(cx, |state, cx| {
983
state.send_call_reaction(reaction.clone(), cx)
984
});
881
app.update(cx, |state, cx| state.send_call_reaction(reaction.clone(), cx));
985
882
popover
986
883
.update(cx, |state, cx| state.dismiss(window, cx))
987
884
.ok();
988
885
})
989
}))
886
}));
887
v_flex()
888
.gap(px(6.))
889
.child(reactions)
890
.child(
891
h_flex()
892
.id("call-hand")
893
.h(px(36.))
894
.px(px(10.))
895
.gap(px(8.))
896
.items_center()
897
.rounded(px(8.))
898
.cursor_pointer()
899
.when(raised, |row| row.bg(theme::accent_soft()))
900
.hover(|row| row.bg(theme::border_strong()))
901
.child(icon(IconName::Hand, 18., if raised { theme::accent_text() } else { theme::text() }))
902
.child(div().text_size(px(13.)).child(if raised { "Lower hand" } else { "Raise hand" }))
903
.on_click(move |_, window, cx| {
904
hand_app.update(cx, |state, cx| state.toggle_call_hand(cx));
905
hand_popover
906
.update(cx, |state, cx| state.dismiss(window, cx))
907
.ok();
908
}),
909
)
990
910
})
991
911
.into_any_element()
992
912
}
993
913
914
fn pop_out_tool(app: &Entity<AppState>) -> Stateful<Div> {
915
let app = app.clone();
916
tool_face("call-pop-out", IconName::ExternalLink, POP_OUT_TOOLTIP, false)
917
.on_click(move |_, _, cx| app.update(cx, |state, cx| state.pop_out_stage(cx)))
918
}
919
920
fn shows_pop_out(call: &ActiveCall) -> bool {
921
call.model.screen_sharer.is_some() && !call.share_stage.popped
922
}
923
924
fn leave_group(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
925
let leave = leave_button(app, model, "call-leave", false)
926
.rounded(px(LEAVE_RADIUS))
927
.debug_selector(|| "shell/islands/main/call-header/leave".into());
928
if !has_leave_menu(model) {
929
return leave.into_any_element();
930
}
931
h_flex()
932
.flex_none()
933
.gap(px(1.))
934
.child(leave.rounded_r(px(0.)))
935
.child(leave_menu(app, model))
936
.into_any_element()
937
}
938
994
939
fn has_leave_menu(model: &CallModel) -> bool {
995
940
model.kind == CallKind::Meeting
996
941
&& (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))
@@ -1004,15 +949,23 @@ fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
1004
949
Button::new("call-leave-menu")
1005
950
.ghost()
1006
951
.p_0()
1007
.size(px(CONTROL_SIZE))
1008
.rounded_full()
1009
.child(round_control(
1010
"call-leave-menu-face",
1011
IconName::ChevronUp,
1012
theme::surface_raised(),
1013
theme::text(),
1014
))
1015
.dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {
952
.w(px(SPLIT_CHEVRON_WIDTH + 4.))
953
.h(px(LEAVE_HEIGHT))
954
.rounded_r(px(LEAVE_RADIUS))
955
.child(
956
div()
957
.id("call-leave-menu-face")
958
.size_full()
959
.flex()
960
.items_center()
961
.justify_center()
962
.rounded_r(px(LEAVE_RADIUS))
963
.bg(theme::red())
964
.cursor_pointer()
965
.hover(|face| face.opacity(0.85))
966
.child(icon(IconName::ChevronDown, 12., theme::white())),
967
)
968
.dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
1016
969
let end_app = end_app.clone();
1017
970
let lower_app = lower_app.clone();
1018
971
let popup = popup.min_w(px(MENU_WIDTH));
@@ -1121,15 +1074,11 @@ fn devices_menu(
1121
1074
popup
1122
1075
}
1123
1076
1124
fn mic_menu_button(
1125
app: &Entity<AppState>,
1126
model: &CallModel,
1127
mic: MicSettings,
1128
) -> impl IntoElement {
1077
fn mic_menu_button(app: &Entity<AppState>, model: &CallModel, mic: MicSettings) -> impl IntoElement {
1129
1078
let app = app.clone();
1130
1079
let model = model.clone();
1131
chevron_button("call-mic-menu", "call-mic-menu-face")
1132
.dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
1080
split_chevron("call-mic-menu", "call-mic-menu-face")
1081
.dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {
1133
1082
devices_menu(popup, &app, &model, mic)
1134
1083
})
1135
1084
}
@@ -1248,9 +1197,7 @@ pub(super) fn plain_own_tile(
1248
1197
let extras = TileExtras {
1249
1198
hand: model.own_hand.map(|rank| model.hand_position(rank)),
1250
1199
own: true,
1251
reaction: model
1252
.own_chip(now)
1253
.map(|chip| (chip.reaction.clone(), chip.serial)),
1200
reaction: model.own_chip(now).map(|chip| (chip.reaction.clone(), chip.serial)),
1254
1201
spotlight: model.own_spotlight.is_some(),
1255
1202
pinned: model.is_pinned(own_mri),
1256
1203
fitted: false,
@@ -1305,9 +1252,9 @@ fn folded_controls(state: &AppState, call: &ActiveCall, fullscreen: bool) -> Fol
1305
1252
if !has_more {
1306
1253
return FoldedControls::default();
1307
1254
}
1308
let mut present = vec![Foldable::View];
1255
let mut present = Vec::new();
1309
1256
if model.has_reaction_controls() {
1310
present.extend([Foldable::Reactions, Foldable::RaiseHand]);
1257
present.push(Foldable::Reactions);
1311
1258
}
1312
1259
if model.kind != CallKind::Test {
1313
1260
present.push(Foldable::People);
@@ -1315,9 +1262,14 @@ fn folded_controls(state: &AppState, call: &ActiveCall, fullscreen: bool) -> Fol
1315
1262
if call.chat_thread().is_some() {
1316
1263
present.push(Foldable::Chat);
1317
1264
}
1318
let fixed = fixed_controls_width(model.can_use_camera(), has_more, has_leave_menu(model));
1265
let fixed = fixed_controls_width(
1266
model.can_use_camera(),
1267
has_more,
1268
has_leave_menu(model),
1269
shows_pop_out(call),
1270
);
1319
1271
FoldedControls {
1320
items: folded_for_width(measured_stage(call).0, fixed, &present),
1272
items: in_more_menu(folded_for_width(measured_stage(call).0, fixed, &present)),
1321
1273
fullscreen,
1322
1274
people_open: call.people_open,
1323
1275
chat_open: call.chat_open,
@@ -1340,7 +1292,14 @@ pub fn render_call_view(
1340
1292
.w_full()
1341
1293
.h(px(HEADER_HEIGHT))
1342
1294
.flex_none()
1343
.px(px(20.))
1295
.pl(px(20.))
1296
.pr(px(HEADER_END_PADDING))
1297
.gap(px(12.))
1298
.items_center();
1299
let title_group = h_flex()
1300
.flex_1()
1301
.flex_basis(px(0.))
1302
.min_w_0()
1344
1303
.gap(px(12.))
1345
1304
.items_center()
1346
1305
.child(icon(IconName::Phone, 18., theme::accent_text()))
@@ -1362,40 +1321,59 @@ pub fn render_call_view(
1362
1321
.children(health_indicator(model))
1363
1322
.children(recording_chip(model))
1364
1323
.children(lock_chip(model))
1365
.children(room_chip(model))
1366
.child(div().flex_1())
1367
.children(return_button(app, model));
1324
.children(room_chip(model));
1325
let end_group = h_flex()
1326
.flex_1()
1327
.flex_basis(px(0.))
1328
.min_w_0()
1329
.justify_end()
1330
.gap(px(GROUP_GAP))
1331
.items_center()
1332
.children(return_button(app, model))
1333
.child(leave_group(app, model));
1368
1334
1369
1335
let hold = hold_panel(app, model);
1370
1336
let share_stage = share_stage_element(app, state, call);
1371
1337
let region = stage_region(app, state, call, now, hold, share_stage);
1372
1338
1373
1339
let folded = folded_controls(state, call, fullscreen);
1374
let controls = h_flex()
1375
.w_full()
1376
.flex_none()
1377
.py(px(16.))
1378
.px(px(CONTROLS_PADDING))
1379
.gap(px(CONTROL_GAP))
1340
let panels_and_reactions = h_flex()
1341
.gap(px(TOOL_GAP))
1342
.items_center()
1343
.when(
1344
model.has_reaction_controls() && !folded.folds(Foldable::Reactions),
1345
|row| row.child(reactions_button(app, model)),
1346
)
1347
.when(
1348
call.chat_thread().is_some() && !folded.folds(Foldable::Chat),
1349
|row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),
1350
)
1351
.when(
1352
model.kind != CallKind::Test && !folded.folds(Foldable::People),
1353
|row| row.child(people_button(app, call.people_open, model.raised_hands())),
1354
);
1355
let stage_and_more = h_flex()
1356
.gap(px(TOOL_GAP))
1357
.items_center()
1358
.when(shows_pop_out(call), |row| row.child(pop_out_tool(app)))
1359
.when(!folded.folds(Foldable::View), |row| {
1360
row.child(view_button(app, model, fullscreen))
1361
})
1362
.children(more_button(app, model, &folded));
1363
let devices = h_flex()
1364
.gap(px(TOOL_GAP))
1380
1365
.items_center()
1381
.justify_center()
1382
1366
.child(
1383
1367
h_flex()
1384
.debug_selector(|| "shell/islands/main/call-controls/mic".into())
1385
.h(px(CONTROL_SIZE))
1368
.debug_selector(|| "shell/islands/main/call-header/controls/mic".into())
1386
1369
.items_center()
1387
.rounded_full()
1388
.bg(theme::surface_raised())
1389
.child(mute_button(app, model, "call-mute", CONTROL_SIZE))
1370
.child(toolbar_mic(app, model))
1390
1371
.child(mic_menu_button(app, model, state.call_mic)),
1391
1372
)
1392
1373
.child(
1393
1374
h_flex()
1394
.h(px(CONTROL_SIZE))
1395
1375
.items_center()
1396
.rounded_full()
1397
.bg(theme::surface_raised())
1398
.child(camera_button(app, model))
1376
.child(toolbar_camera(app, model))
1399
1377
.children(camera_menu_button(app, model, CameraMenu::of(state))),
1400
1378
)
1401
1379
.child(share_button(
@@ -1403,34 +1381,18 @@ pub fn render_call_view(
1403
1381
model,
1404
1382
ShareOptions::of(state),
1405
1383
call.share_menu_open,
1406
))
1407
.when(
1408
model.has_reaction_controls() && !folded.folds(Foldable::RaiseHand),
1409
|row| row.child(hand_button(app, model)),
1410
)
1411
.when(
1412
model.has_reaction_controls() && !folded.folds(Foldable::Reactions),
1413
|row| row.child(reactions_button(app, model)),
1414
)
1415
.when(!folded.folds(Foldable::View), |row| {
1416
row.child(view_button(app, model, fullscreen))
1417
})
1418
.children(more_button(app, model, &folded))
1419
.when(
1420
model.kind != CallKind::Test && !folded.folds(Foldable::People),
1421
|row| row.child(people_button(app, call.people_open, model.raised_hands())),
1422
)
1423
.when(
1424
call.chat_thread().is_some() && !folded.folds(Foldable::Chat),
1425
|row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),
1426
)
1427
.child(
1428
leave_button(app, model, "call-leave", false)
1429
.debug_selector(|| "shell/islands/main/call-controls/leave".into()),
1430
)
1431
.when(has_leave_menu(model), |row| {
1432
row.child(leave_menu(app, model))
1433
});
1384
));
1385
let controls = h_flex()
1386
.debug_selector(|| "shell/islands/main/call-header/controls".into())
1387
.flex_none()
1388
.gap(px(GROUP_GAP))
1389
.items_center()
1390
.child(devices)
1391
.child(group_divider())
1392
.child(panels_and_reactions)
1393
.child(group_divider())
1394
.child(stage_and_more);
1395
let header = header.child(title_group).child(controls).child(end_group);
1434
1396
1435
1397
let top = v_flex()
1436
1398
.w_full()
@@ -1461,28 +1423,19 @@ pub fn render_call_view(
1461
1423
column.child(fullscreen_chrome("call-chrome-top", app, top))
1462
1424
})
1463
1425
.child(region)
1464
.when(chrome_visible, |column| {
1465
column.child(fullscreen_chrome("call-chrome-bottom", app, controls))
1466
})
1467
1426
} else {
1468
1427
base.rounded(px(10.))
1469
1428
.child(top.debug_selector(|| "shell/islands/main/call-header".into()))
1470
1429
.child(region)
1471
.child(controls.debug_selector(|| "shell/islands/main/call-controls".into()))
1472
1430
}
1473
1431
.children(captions_overlay(model, now))
1474
1432
.children(captions_hint_chip(model))
1475
1433
.children(push_to_talk_chip(call))
1476
1434
.children(state.transfer_picker.clone())
1477
1435
.children(options_dialog(app, call))
1478
.children(consent_overlay(app, model))
1479
.children(local_share_float(app, state));
1480
let share_in_chat = call
1481
.chat_open
1482
.then(|| local_share_window(app, state, CHAT_PANEL_WIDTH))
1483
.flatten();
1436
.children(consent_overlay(app, model));
1484
1437
let panels: Vec<AnyElement> = chat
1485
.map(|chat| chat_panel(app, share_in_chat, chat))
1438
.map(|chat| chat_panel(app, chat))
1486
1439
.into_iter()
1487
1440
.chain(
1488
1441
call.transcript_open
@@ -1516,15 +1469,17 @@ fn side_panels(panels: Vec<AnyElement>, island_width: f32) -> Vec<AnyElement> {
1516
1469
if island_width - panels_width >= OVERLAY_BELOW {
1517
1470
return panels;
1518
1471
}
1519
vec![h_flex()
1520
.absolute()
1521
.top_0()
1522
.right_0()
1523
.bottom(px(CONTROLS_HEIGHT))
1524
.gap(px(ISLAND_GAP))
1525
.w(px(panels_width.min(island_width)))
1526
.children(panels)
1527
.into_any_element()]
1472
vec![
1473
h_flex()
1474
.absolute()
1475
.top(px(HEADER_HEIGHT))
1476
.right_0()
1477
.bottom_0()
1478
.gap(px(ISLAND_GAP))
1479
.w(px(panels_width.min(island_width)))
1480
.children(panels)
1481
.into_any_element(),
1482
]
1528
1483
}
1529
1484
1530
1485
fn fullscreen_chrome(id: &'static str, app: &Entity<AppState>, content: Div) -> Stateful<Div> {
@@ -1539,146 +1494,19 @@ fn fullscreen_chrome(id: &'static str, app: &Entity<AppState>, content: Div) ->
1539
1494
.child(content)
1540
1495
}
1541
1496
1542
fn chat_panel(app: &Entity<AppState>, share: Option<AnyElement>, chat: AnyView) -> AnyElement {
1497
fn chat_panel(app: &Entity<AppState>, chat: AnyView) -> AnyElement {
1543
1498
let app = app.clone();
1544
let body = v_flex()
1545
.w_full()
1546
.flex_1()
1547
.min_h_0()
1548
.children(share)
1549
.child(div().flex_1().min_h_0().overflow_hidden().child(chat));
1550
1499
side_panel(
1551
1500
"call-chat-panel",
1552
1501
"Chat",
1553
1502
"Close the chat",
1554
1503
move |cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)),
1555
body,
1504
chat,
1556
1505
)
1557
1506
.debug_selector(|| CHAT_PANEL_TAG.into())
1558
1507
.into_any_element()
1559
1508
}
1560
1509
1561
const SHARE_WINDOW_INSET: f32 = 12.;
1562
const SHARE_WINDOW_RATIO: f32 = 9. / 16.;
1563
const SHARE_FLOAT_WIDTH: f32 = 320.;
1564
1565
/// The live local share, pinned in the meeting chat or floating on the call
1566
/// when the chat is closed.
1567
fn local_share_window(app: &Entity<AppState>, state: &AppState, width: f32) -> Option<AnyElement> {
1568
let call = state.call.as_ref()?;
1569
let label = call.model.local_share.clone()?;
1570
let image = call.pictures.live(&VideoKey::LocalScreen, Instant::now());
1571
Some(share_window(app, &label, image, width))
1572
}
1573
1574
fn local_share_float(app: &Entity<AppState>, state: &AppState) -> Option<AnyElement> {
1575
let call = state.call.as_ref()?;
1576
if call.chat_open {
1577
return None;
1578
}
1579
let window = local_share_window(app, state, SHARE_FLOAT_WIDTH)?;
1580
Some(
1581
div()
1582
.absolute()
1583
.right(px(16.))
1584
.bottom(px(CONTROLS_HEIGHT + 12.))
1585
.w(px(SHARE_FLOAT_WIDTH))
1586
.rounded(px(10.))
1587
.overflow_hidden()
1588
.bg(theme::surface())
1589
.shadow(theme::flyout_shadow())
1590
.child(window)
1591
.into_any_element(),
1592
)
1593
}
1594
1595
fn share_window(
1596
app: &Entity<AppState>,
1597
label: &str,
1598
image: Option<Arc<RenderImage>>,
1599
width: f32,
1600
) -> AnyElement {
1601
let picture_width = (width - 2. * SHARE_WINDOW_INSET).max(0.);
1602
let picture_height = picture_width * SHARE_WINDOW_RATIO;
1603
let stop = app.clone();
1604
v_flex()
1605
.w_full()
1606
.flex_none()
1607
.p(px(SHARE_WINDOW_INSET))
1608
.child(
1609
div()
1610
.id("call-share-window")
1611
.relative()
1612
.w(px(picture_width))
1613
.h(px(picture_height))
1614
.rounded(px(8.))
1615
.overflow_hidden()
1616
.bg(hsla(0., 0., 0.04, 1.))
1617
.child(share_picture(image))
1618
.child(
1619
div()
1620
.absolute()
1621
.top(px(8.))
1622
.left(px(8.))
1623
.max_w(px(picture_width * 0.62))
1624
.h(px(22.))
1625
.px(px(8.))
1626
.flex()
1627
.items_center()
1628
.rounded_full()
1629
.bg(hsla(0., 0., 0., 0.6))
1630
.text_size(px(11.))
1631
.text_color(theme::white())
1632
.child(div().truncate().child(label.to_owned())),
1633
)
1634
.child(share_stop(stop)),
1635
)
1636
.into_any_element()
1637
}
1638
1639
fn share_picture(image: Option<Arc<RenderImage>>) -> AnyElement {
1640
let Some(image) = image else {
1641
return div()
1642
.size_full()
1643
.flex()
1644
.items_center()
1645
.justify_center()
1646
.px(px(12.))
1647
.text_size(px(12.))
1648
.text_color(theme::text_muted())
1649
.child(WAITING_TEXT)
1650
.into_any_element();
1651
};
1652
img(ImageSource::Render(image))
1653
.size_full()
1654
.object_fit(ObjectFit::Contain)
1655
.into_any_element()
1656
}
1657
1658
fn share_stop(app: Entity<AppState>) -> Stateful<Div> {
1659
div()
1660
.id("call-share-window-stop")
1661
.absolute()
1662
.top(px(8.))
1663
.right(px(8.))
1664
.h(px(22.))
1665
.px(px(8.))
1666
.flex()
1667
.items_center()
1668
.rounded_full()
1669
.bg(theme::red())
1670
.text_color(theme::white())
1671
.text_size(px(11.))
1672
.font_weight(FontWeight::SEMIBOLD)
1673
.cursor_pointer()
1674
.hover(|button| button.opacity(0.85))
1675
.child("Stop")
1676
.on_click(move |_, _, cx| {
1677
cx.stop_propagation();
1678
app.update(cx, |state, cx| state.stop_call_share(cx));
1679
})
1680
}
1681
1682
1510
pub fn side_panel(
1683
1511
panel_id: &'static str,
1684
1512
title: &'static str,
@@ -1730,25 +1558,14 @@ pub fn side_panel(
1730
1558
1731
1559
#[cfg(test)]
1732
1560
mod tests {
1733
use super::{name_plate_metrics, TileSize};
1561
use super::{TileSize, name_plate_metrics};
1734
1562
1735
1563
#[test]
1736
1564
fn small_strip_tiles_get_a_compact_name_plate() {
1737
let strip = name_plate_metrics(TileSize {
1738
width: 216.,
1739
height: 121.5,
1740
avatar: 48.,
1741
});
1742
assert_eq!(
1743
(strip.text_size, strip.inset, strip.padding_y),
1744
(11., 4., 2.)
1745
);
1565
let strip = name_plate_metrics(TileSize { width: 216., height: 121.5, avatar: 48. });
1566
assert_eq!((strip.text_size, strip.inset, strip.padding_y), (11., 4., 2.));
1746
1567
assert!(strip.max_width_share < 1.);
1747
let stage = name_plate_metrics(TileSize {
1748
width: 640.,
1749
height: 360.,
1750
avatar: 96.,
1751
});
1568
let stage = name_plate_metrics(TileSize { width: 640., height: 360., avatar: 96. });
1752
1569
assert_eq!((stage.text_size, stage.inset), (12., 8.));
1753
1570
}
1754
1571
}
@@ -16,32 +16,32 @@ use gpui_kit::prelude::FluentBuilder as _;16
use gpui_kit::*;16
use gpui_kit::*;17
17
18
use super::avatar::person_avatar;18
use super::avatar::person_avatar;19
use super::call_control_fold::{19
use super::call_control_fold::{Foldable, FoldedControls, fixed_controls_width, folded_for_width, in_more_menu};20
fixed_controls_width, folded_for_width, Foldable, FoldedControls, CONTROLS_PADDING, CONTROL_GAP,20
use super::call_toolbar::{21
GROUP_GAP, LEAVE_HEIGHT, group_divider, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,21
};22
};22
use super::call_extras::{23
use super::call_extras::{23
consent_overlay, consult_banner, hold_panel, recording_chip, return_button, room_chip,24
CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,24
whiteboard_stage, CameraMenu,25
room_chip, whiteboard_stage,25
};26
};26
use super::call_health::{health_banner, health_indicator};27
use super::call_health::{health_banner, health_indicator};27
use super::call_layouts::stage_region;28
use super::call_layouts::stage_region;29
use crate::call::measured_stage;28
use super::call_organizer::{30
use super::call_organizer::{29
camera_menu_button, captions_hint_chip, captions_overlay, chevron_button, lobby_banner,31
camera_menu_button, captions_hint_chip, captions_overlay, lobby_banner,30
more_button, pin_chip, spotlight_chip, with_tile_menu,32
more_button, pin_chip, spotlight_chip, with_tile_menu,31
};33
};32
use super::call_people::{lock_banner, lock_chip, options_dialog, people_button, people_panel};34
use super::call_people::{lock_banner, lock_chip, options_dialog, people_button, people_panel};33
use super::call_stage::{popped_placeholder, render_stage, StageMode, WAITING_TEXT};35
use super::call_stage::{POP_OUT_TOOLTIP, StageMode, popped_placeholder, render_stage};34
use super::call_view_menu::view_button;36
use super::call_view_menu::view_button;35
use super::widgets::{corner_badge, count_badge, icon, Corner};37
use app_ui_kit::layout::ISLAND_GAP;38
use super::widgets::{Corner, corner_badge, count_badge, icon};36
use crate::app_state::AppState;39
use crate::app_state::AppState;37
use crate::call::measured_stage;38
use crate::call::model::ShareMenuEntry;39
use crate::call::TileSize;40
use crate::call::REACTION_SHOWN;40
use crate::call::REACTION_SHOWN;41
use crate::call::TileSize;41
use crate::call::{ActiveCall, CallKind, CallModel, Tile, TileState};42
use crate::call::{ActiveCall, CallKind, CallModel, Tile, TileState};42
use crate::rows::reaction_glyph as chat_reaction_glyph;43
use crate::rows::reaction_glyph as chat_reaction_glyph;43
use crate::theme;44
use crate::theme;44
use app_ui_kit::layout::ISLAND_GAP;45
45
46
const HEADER_HEIGHT: f32 = 60.;46
const HEADER_HEIGHT: f32 = 60.;47
const RING_WIDTH: f32 = 3.;47
const RING_WIDTH: f32 = 3.;@@ -64,6 +64,7 @@ pub const NO_CAMERA_HINT: &str = "No camera found";64
pub const NO_SHARE_HINT: &str = "Sharing starts once the call is connected";64
pub const NO_SHARE_HINT: &str = "Sharing starts once the call is connected";65
pub const NO_WINDOWS_HINT: &str = "No windows found";65
pub const NO_WINDOWS_HINT: &str = "No windows found";66
pub(super) const BANNER_HEIGHT: f32 = 40.;66
pub(super) const BANNER_HEIGHT: f32 = 40.;67
const MAX_WINDOW_ITEMS: usize = 12;67
pub const SHARE_THUMBNAIL_TAG: &str = "call/share-menu/thumbnail";68
pub const SHARE_THUMBNAIL_TAG: &str = "call/share-menu/thumbnail";68
const SCREEN_THUMBNAIL: (f32, f32) = (128., 72.);69
const SCREEN_THUMBNAIL: (f32, f32) = (128., 72.);69
const WINDOW_THUMBNAIL: (f32, f32) = (96., 54.);70
const WINDOW_THUMBNAIL: (f32, f32) = (96., 54.);@@ -72,7 +73,8 @@ const THUMBNAIL_ICON: f32 = 22.;72
pub const LOBBY_TEXT: &str = "Waiting in the lobby...";73
pub const LOBBY_TEXT: &str = "Waiting in the lobby...";73
pub(super) const CHAT_PANEL_WIDTH: f32 = 320.;74
pub(super) const CHAT_PANEL_WIDTH: f32 = 320.;74
pub(super) const OVERLAY_BELOW: f32 = 720.;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
const CHAT_HEADER_HEIGHT: f32 = 48.;78
const CHAT_HEADER_HEIGHT: f32 = 48.;77
const REACTION_RISE: f32 = 24.;79
const REACTION_RISE: f32 = 24.;78
const REACTION_FADE_FROM: f32 = 0.75;80
const REACTION_FADE_FROM: f32 = 0.75;@@ -88,13 +90,8 @@ const PUSH_TO_TALK_TOP: f32 = 12.;88
90
89
pub fn reaction_glyph(reaction: &Reaction) -> String {91
pub fn reaction_glyph(reaction: &Reaction) -> String {90
match reaction {92
match reaction {91
Reaction::Like => "\u{1F44D}".to_owned(),92
// Keep VS16 so the heart stays emoji-style, not a text outline.93
Reaction::Heart => "\u{2764}\u{FE0F}".to_owned(),94
Reaction::Applause => "\u{1F44F}".to_owned(),93
Reaction::Applause => "\u{1F44F}".to_owned(),95
Reaction::Laugh => "\u{1F606}".to_owned(),94
other => chat_reaction_glyph(other.name()),96
Reaction::Surprised => "\u{1F62E}".to_owned(),97
Reaction::Other(name) => chat_reaction_glyph(name),98
}95
}99
}96
}100
97
@@ -146,7 +143,6 @@ fn reaction_chip(reaction: Reaction, serial: u64) -> AnyElement {146
.rounded_full()143
.rounded_full()147
.bg(theme::popup())144
.bg(theme::popup())148
.text_size(px(if emoji { 20. } else { 13. }))145
.text_size(px(if emoji { 20. } else { 13. }))149
.when(emoji, |chip| chip.font_family(theme::EMOJI_FONT_FAMILY))150
.child(glyph)146
.child(glyph)151
.with_animation(147
.with_animation(152
("call-reaction", serial as usize),148
("call-reaction", serial as usize),@@ -255,23 +251,9 @@ struct NamePlate {255
251
256
fn name_plate_metrics(size: TileSize) -> NamePlate {252
fn name_plate_metrics(size: TileSize) -> NamePlate {257
if size.height < COMPACT_PLATE_BELOW {253
if size.height < COMPACT_PLATE_BELOW {258
NamePlate {254
NamePlate { inset: 4., padding_x: 6., padding_y: 2., radius: 4., text_size: 11., max_width_share: 0.6 }259
inset: 4.,260
padding_x: 6.,261
padding_y: 2.,262
radius: 4.,263
text_size: 11.,264
max_width_share: 0.6,265
}266
} else {255
} else {267
NamePlate {256
NamePlate { inset: 8., padding_x: 8., padding_y: 4., radius: 6., text_size: 12., max_width_share: 1. }268
inset: 8.,269
padding_x: 8.,270
padding_y: 4.,271
radius: 6.,272
text_size: 12.,273
max_width_share: 1.,274
}275
}257
}276
}258
}277
259
@@ -281,9 +263,7 @@ fn name_plate(size: TileSize, name: &str) -> Div {281
.absolute()263
.absolute()282
.left(px(plate.inset))264
.left(px(plate.inset))283
.bottom(px(plate.inset))265
.bottom(px(plate.inset))284
.max_w(px(((size.width - 3. * plate.inset)266
.max_w(px(((size.width - 3. * plate.inset) * plate.max_width_share).max(0.)))285
* plate.max_width_share)286
.max(0.)))287
.truncate()267
.truncate()288
.px(px(plate.padding_x))268
.px(px(plate.padding_x))289
.py(px(plate.padding_y))269
.py(px(plate.padding_y))@@ -405,7 +385,19 @@ pub fn mute_button(405
} else {385
} else {406
(IconName::Mic, theme::surface_raised(), theme::text())386
(IconName::Mic, theme::surface_raised(), theme::text())407
};387
};408
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::MicOff394
} else {395
IconName::Mic396
};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> {409
if !model.can_unmute() {401
if !model.can_unmute() {410
let hint = if model.audio_off {402
let hint = if model.audio_off {411
AUDIO_OFF_HINT403
AUDIO_OFF_HINT@@ -438,8 +430,8 @@ pub fn leave_button(438
let app = app.clone();430
let app = app.clone();439
h_flex()431
h_flex()440
.id(id)432
.id(id)441
.h(px(if compact { 28. } else { CONTROL_SIZE }))433
.h(px(if compact { 28. } else { LEAVE_HEIGHT }))442
.px(px(if compact { 10. } else { 20. }))434
.px(px(if compact { 10. } else { 14. }))443
.gap(px(8.))435
.gap(px(8.))444
.flex_none()436
.flex_none()445
.items_center()437
.items_center()@@ -447,13 +439,13 @@ pub fn leave_button(447
.rounded_full()439
.rounded_full()448
.bg(theme::red())440
.bg(theme::red())449
.text_color(theme::white())441
.text_color(theme::white())450
.text_size(px(if compact { 12. } else { 14. }))442
.text_size(px(if compact { 12. } else { 13. }))451
.font_weight(FontWeight::SEMIBOLD)443
.font_weight(FontWeight::SEMIBOLD)452
.cursor_pointer()444
.cursor_pointer()453
.hover(|button| button.opacity(0.85))445
.hover(|button| button.opacity(0.85))454
.child(icon(446
.child(icon(455
IconName::PhoneOff,447
IconName::PhoneOff,456
if compact { 14. } else { 18. },448
if compact { 14. } else { 16. },457
theme::white(),449
theme::white(),458
))450
))459
.child(label)451
.child(label)@@ -463,11 +455,7 @@ pub fn leave_button(463
})455
})464
}456
}465
457
466
fn share_stage_element(458
fn share_stage_element(app: &Entity<AppState>, state: &AppState, call: &ActiveCall) -> Option<AnyElement> {467
app: &Entity<AppState>,468
state: &AppState,469
call: &ActiveCall,470
) -> Option<AnyElement> {471
if call.share_stage.popped && call.model.screen_sharer.is_some() {459
if call.share_stage.popped && call.model.screen_sharer.is_some() {472
return Some(popped_placeholder(app));460
return Some(popped_placeholder(app));473
}461
}@@ -480,7 +468,19 @@ pub(super) fn camera_button(app: &Entity<AppState>, model: &CallModel) -> Statef480
} else {468
} else {481
(IconName::VideoOff, theme::surface_raised(), theme::text())469
(IconName::VideoOff, theme::surface_raised(), theme::text())482
};470
};483
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::Video477
} else {478
IconName::VideoOff479
};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> {484
if !model.can_use_camera() {484
if !model.can_use_camera() {485
return button485
return button486
.opacity(DISABLED_OPACITY)486
.opacity(DISABLED_OPACITY)@@ -550,9 +550,7 @@ fn standout_switch_item(app: &Entity<AppState>, standout: bool, camera_on: bool)550
})550
})551
})551
})552
.disabled(!camera_on)552
.disabled(!camera_on)553
.on_click(move |_, _, cx| {553
.on_click(move |_, _, cx| app.update(cx, |state, cx| state.set_call_share_standout(!standout, cx)))554
app.update(cx, |state, cx| state.set_call_share_standout(!standout, cx))555
})556
}554
}557
555
558
fn music_mode_item(app: &Entity<AppState>, mic: MicSettings) -> PopupMenuItem {556
fn music_mode_item(app: &Entity<AppState>, mic: MicSettings) -> PopupMenuItem {@@ -626,72 +624,6 @@ fn share_items(626
model: &CallModel,624
model: &CallModel,627
options: ShareOptions,625
options: ShareOptions,628
) -> PopupMenu {626
) -> PopupMenu {629
<<<<<<< ours630
let single_screen = model.screens().len() == 1;631
let mut screen_index = 0usize;632
let mut separated = false;633
let mut popup = popup.min_w(px(SHARE_MENU_WIDTH));634
for entry in model.share_menu_entries() {635
popup = match entry {636
ShareMenuEntry::Sound => popup.item(sound_switch_item(app, options.sound)),637
ShareMenuEntry::Motion => popup.item(motion_switch_item(app, options.motion)),638
ShareMenuEntry::Standout => {639
popup.item(standout_switch_item(app, options.standout, model.camera_on))640
}641
ShareMenuEntry::Portal(kind) => {642
if !separated {643
popup = popup.separator();644
separated = true;645
}646
let label = match kind {647
ShareKind::Screen => "Share entire screen",648
ShareKind::Window => "Share a window",649
};650
let app = app.clone();651
popup.item(PopupMenuItem::new(label).on_click(move |_, _, cx| {652
app.update(cx, |state, cx| state.start_portal_share(kind, cx))653
}))654
}655
ShareMenuEntry::Source(source) => {656
if !separated {657
popup = popup.separator();658
separated = true;659
}660
let (label, thumbnail, icon, size) = if source.kind == ShareKind::Screen {661
screen_index += 1;662
let label = if single_screen {663
"Share entire screen".to_owned()664
} else {665
format!("Share screen {screen_index}")666
};667
(668
label,669
model.share_thumbnail(&source),670
IconName::Monitor,671
SCREEN_THUMBNAIL,672
)673
} else {674
(675
source.label(),676
model.share_thumbnail(&source),677
IconName::AppWindow,678
WINDOW_THUMBNAIL,679
)680
};681
let app = app.clone();682
popup.item(share_source_item(label, thumbnail, icon, size).on_click(683
move |_, _, cx| {684
app.update(cx, |state, cx| state.start_call_share(source.clone(), cx))685
},686
))687
}688
ShareMenuEntry::WindowHeader => popup689
.separator()690
.item(PopupMenuItem::label("Share a window...")),691
ShareMenuEntry::NoWindows => {692
popup.item(PopupMenuItem::new(NO_WINDOWS_HINT).disabled(true))693
}694
=======695
let mut popup = popup627
let mut popup = popup696
.min_w(px(SHARE_MENU_WIDTH))628
.min_w(px(SHARE_MENU_WIDTH))697
.item(sound_switch_item(app, options.sound))629
.item(sound_switch_item(app, options.sound))@@ -722,8 +654,33 @@ fn share_items(722
"Share entire screen".to_owned()654
"Share entire screen".to_owned()723
} else {655
} else {724
format!("Share screen {}", index + 1)656
format!("Share screen {}", index + 1)725
>>>>>>> theirs726
};657
};658
let thumbnail = model.share_thumbnail(source);659
let source = source.clone();660
let app = app.clone();661
popup = popup.item(662
share_source_item(label, thumbnail, IconName::Monitor, SCREEN_THUMBNAIL).on_click(663
move |_, _, cx| app.update(cx, |state, cx| state.start_call_share(source.clone(), cx)),664
),665
);666
}667
popup = popup668
.separator()669
.item(PopupMenuItem::label("Share a window..."));670
let windows = model.windows();671
if windows.is_empty() {672
return popup.item(PopupMenuItem::new(NO_WINDOWS_HINT).disabled(true));673
}674
for source in windows.into_iter().take(MAX_WINDOW_ITEMS) {675
let label = source.label();676
let thumbnail = model.share_thumbnail(source);677
let source = source.clone();678
let app = app.clone();679
popup = popup.item(680
share_source_item(label, thumbnail, IconName::AppWindow, WINDOW_THUMBNAIL).on_click(681
move |_, _, cx| app.update(cx, |state, cx| state.start_call_share(source.clone(), cx)),682
),683
);727
}684
}728
popup685
popup729
}686
}@@ -776,12 +733,7 @@ fn share_button(776
) -> AnyElement {733
) -> AnyElement {777
if model.local_share.is_some() {734
if model.local_share.is_some() {778
let app = app.clone();735
let app = app.clone();779
return round_control(736
return tool_face("call-share-stop", IconName::ScreenShareOff, "Stop", true)780
"call-share-stop",781
IconName::ScreenShareOff,782
theme::accent(),783
theme::on_accent(),784
)785
.tooltip(|window, cx| Tooltip::new("Stop sharing").build(window, cx))737
.tooltip(|window, cx| Tooltip::new("Stop sharing").build(window, cx))786
.on_click(move |_, _, cx| {738
.on_click(move |_, _, cx| {787
cx.stop_propagation();739
cx.stop_propagation();@@ -789,12 +741,7 @@ fn share_button(789
})741
})790
.into_any_element();742
.into_any_element();791
}743
}792
let face = round_control(744
let face = tool_face("call-share-face", IconName::ScreenShare, "Share", false);793
"call-share-face",794
IconName::ScreenShare,795
theme::surface_raised(),796
theme::text(),797
);798
if !model.can_share() {745
if !model.can_share() {799
return face746
return face800
.opacity(DISABLED_OPACITY)747
.opacity(DISABLED_OPACITY)@@ -805,13 +752,8 @@ fn share_button(805
let app = app.clone();752
let app = app.clone();806
let open_app = app.clone();753
let open_app = app.clone();807
let model = model.clone();754
let model = model.clone();808
Button::new("call-share")755
tool_trigger("call-share", face)809
.ghost()756
.dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {810
.p_0()811
.size(px(CONTROL_SIZE))812
.rounded_full()813
.child(face)814
.dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {815
share_items(popup, &app, &model, options)757
share_items(popup, &app, &model, options)816
})758
})817
.open(menu_open)759
.open(menu_open)@@ -884,12 +826,7 @@ fn sharing_banner(app: &Entity<AppState>, model: &CallModel, sound: bool) -> Opt884
826
885
fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div> {827
fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div> {886
let app = app.clone();828
let app = app.clone();887
let (background, foreground) = if open {829
tool_face("call-chat", IconName::MessageCircle, "Chat", open)888
(theme::accent(), theme::on_accent())889
} else {890
(theme::surface_raised(), theme::text())891
};892
round_control("call-chat", IconName::MessageCircle, background, foreground)893
.relative()830
.relative()894
.tooltip(move |window, cx| {831
.tooltip(move |window, cx| {895
Tooltip::new(if open {832
Tooltip::new(if open {@@ -905,41 +842,9 @@ fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div>905
.on_click(move |_, _, cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)))842
.on_click(move |_, _, cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)))906
}843
}907
844
908
fn hand_button(app: &Entity<AppState>, model: &CallModel) -> Stateful<Div> {909
let raised = model.own_hand.is_some();910
let background = if raised {911
theme::accent()912
} else {913
theme::surface_raised()914
};915
let foreground = if raised {916
theme::on_accent()917
} else {918
theme::text()919
};920
let button = control_shell("call-hand", background).child(icon(921
IconName::Hand,922
CONTROL_ICON,923
foreground,924
));925
let tooltip = if raised { "Lower hand" } else { "Raise hand" };926
let button = button.tooltip(move |window, cx| Tooltip::new(tooltip).build(window, cx));927
if !model.can_react() {928
return button.opacity(DISABLED_OPACITY).cursor_default();929
}930
let app = app.clone();931
button.on_click(move |_, _, cx| {932
cx.stop_propagation();933
app.update(cx, |state, cx| state.toggle_call_hand(cx));934
})935
}936
937
fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {845
fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {938
let face = control_shell("call-reactions-face", theme::surface_raised()).child(icon(846
let raised = model.own_hand.is_some();939
IconName::FaceSlightlySmiling,847
let face = tool_face("call-reactions-face", IconName::FaceSlightlySmiling, "React", raised);940
CONTROL_ICON,941
theme::text(),942
));943
if !model.can_react() {848
if !model.can_react() {944
return face849
return face945
.opacity(DISABLED_OPACITY)850
.opacity(DISABLED_OPACITY)@@ -948,19 +853,14 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {948
}853
}949
let app = app.clone();854
let app = app.clone();950
Popover::new("call-reactions-popover")855
Popover::new("call-reactions-popover")951
.anchor(Anchor::BottomLeft)856
.anchor(Anchor::TopRight)952
.offset(px(10.))857
.offset(px(6.))953
.trigger(858
.trigger(tool_trigger("call-reactions", face))954
Button::new("call-reactions")955
.ghost()956
.p_0()957
.size(px(CONTROL_SIZE))958
.rounded_full()959
.child(face),960
)961
.content(move |_, _, cx| {859
.content(move |_, _, cx| {962
let popover = cx.entity().downgrade();860
let popover = cx.entity().downgrade();963
h_flex()861
let hand_app = app.clone();862
let hand_popover = popover.clone();863
let reactions = h_flex()964
.id("call-reactions-row")864
.id("call-reactions-row")965
.gap(px(4.))865
.gap(px(4.))966
.children(Reaction::ALL.into_iter().map(|reaction| {866
.children(Reaction::ALL.into_iter().map(|reaction| {@@ -974,23 +874,68 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {974
.justify_center()874
.justify_center()975
.rounded(px(8.))875
.rounded(px(8.))976
.text_size(px(24.))876
.text_size(px(24.))977
.font_family(theme::EMOJI_FONT_FAMILY)978
.cursor_pointer()877
.cursor_pointer()979
.hover(|cell| cell.bg(theme::border_strong()))878
.hover(|cell| cell.bg(theme::border_strong()))980
.child(reaction_glyph(&reaction))879
.child(reaction_glyph(&reaction))981
.on_click(move |_, window, cx| {880
.on_click(move |_, window, cx| {982
app.update(cx, |state, cx| {881
app.update(cx, |state, cx| state.send_call_reaction(reaction.clone(), cx));983
state.send_call_reaction(reaction.clone(), cx)984
});985
popover882
popover986
.update(cx, |state, cx| state.dismiss(window, cx))883
.update(cx, |state, cx| state.dismiss(window, cx))987
.ok();884
.ok();988
})885
})989
}))886
}));887
v_flex()888
.gap(px(6.))889
.child(reactions)890
.child(891
h_flex()892
.id("call-hand")893
.h(px(36.))894
.px(px(10.))895
.gap(px(8.))896
.items_center()897
.rounded(px(8.))898
.cursor_pointer()899
.when(raised, |row| row.bg(theme::accent_soft()))900
.hover(|row| row.bg(theme::border_strong()))901
.child(icon(IconName::Hand, 18., if raised { theme::accent_text() } else { theme::text() }))902
.child(div().text_size(px(13.)).child(if raised { "Lower hand" } else { "Raise hand" }))903
.on_click(move |_, window, cx| {904
hand_app.update(cx, |state, cx| state.toggle_call_hand(cx));905
hand_popover906
.update(cx, |state, cx| state.dismiss(window, cx))907
.ok();908
}),909
)990
})910
})991
.into_any_element()911
.into_any_element()992
}912
}993
913
914
fn pop_out_tool(app: &Entity<AppState>) -> Stateful<Div> {915
let app = app.clone();916
tool_face("call-pop-out", IconName::ExternalLink, POP_OUT_TOOLTIP, false)917
.on_click(move |_, _, cx| app.update(cx, |state, cx| state.pop_out_stage(cx)))918
}919
920
fn shows_pop_out(call: &ActiveCall) -> bool {921
call.model.screen_sharer.is_some() && !call.share_stage.popped922
}923
924
fn leave_group(app: &Entity<AppState>, model: &CallModel) -> AnyElement {925
let leave = leave_button(app, model, "call-leave", false)926
.rounded(px(LEAVE_RADIUS))927
.debug_selector(|| "shell/islands/main/call-header/leave".into());928
if !has_leave_menu(model) {929
return leave.into_any_element();930
}931
h_flex()932
.flex_none()933
.gap(px(1.))934
.child(leave.rounded_r(px(0.)))935
.child(leave_menu(app, model))936
.into_any_element()937
}938
994
fn has_leave_menu(model: &CallModel) -> bool {939
fn has_leave_menu(model: &CallModel) -> bool {995
model.kind == CallKind::Meeting940
model.kind == CallKind::Meeting996
&& (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))941
&& (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))@@ -1004,15 +949,23 @@ fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {1004
Button::new("call-leave-menu")949
Button::new("call-leave-menu")1005
.ghost()950
.ghost()1006
.p_0()951
.p_0()1007
.size(px(CONTROL_SIZE))952
.w(px(SPLIT_CHEVRON_WIDTH + 4.))1008
.rounded_full()953
.h(px(LEAVE_HEIGHT))1009
.child(round_control(954
.rounded_r(px(LEAVE_RADIUS))1010
"call-leave-menu-face",955
.child(1011
IconName::ChevronUp,956
div()1012
theme::surface_raised(),957
.id("call-leave-menu-face")1013
theme::text(),958
.size_full()1014
))959
.flex()1015
.dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {960
.items_center()961
.justify_center()962
.rounded_r(px(LEAVE_RADIUS))963
.bg(theme::red())964
.cursor_pointer()965
.hover(|face| face.opacity(0.85))966
.child(icon(IconName::ChevronDown, 12., theme::white())),967
)968
.dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {1016
let end_app = end_app.clone();969
let end_app = end_app.clone();1017
let lower_app = lower_app.clone();970
let lower_app = lower_app.clone();1018
let popup = popup.min_w(px(MENU_WIDTH));971
let popup = popup.min_w(px(MENU_WIDTH));@@ -1121,15 +1074,11 @@ fn devices_menu(1121
popup1074
popup1122
}1075
}1123
1076
1124
fn mic_menu_button(1077
fn mic_menu_button(app: &Entity<AppState>, model: &CallModel, mic: MicSettings) -> impl IntoElement {1125
app: &Entity<AppState>,1126
model: &CallModel,1127
mic: MicSettings,1128
) -> impl IntoElement {1129
let app = app.clone();1078
let app = app.clone();1130
let model = model.clone();1079
let model = model.clone();1131
chevron_button("call-mic-menu", "call-mic-menu-face")1080
split_chevron("call-mic-menu", "call-mic-menu-face")1132
.dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {1081
.dropdown_menu_with_anchor(Anchor::TopRight, move |popup, _, _| {1133
devices_menu(popup, &app, &model, mic)1082
devices_menu(popup, &app, &model, mic)1134
})1083
})1135
}1084
}@@ -1248,9 +1197,7 @@ pub(super) fn plain_own_tile(1248
let extras = TileExtras {1197
let extras = TileExtras {1249
hand: model.own_hand.map(|rank| model.hand_position(rank)),1198
hand: model.own_hand.map(|rank| model.hand_position(rank)),1250
own: true,1199
own: true,1251
reaction: model1200
reaction: model.own_chip(now).map(|chip| (chip.reaction.clone(), chip.serial)),1252
.own_chip(now)1253
.map(|chip| (chip.reaction.clone(), chip.serial)),1254
spotlight: model.own_spotlight.is_some(),1201
spotlight: model.own_spotlight.is_some(),1255
pinned: model.is_pinned(own_mri),1202
pinned: model.is_pinned(own_mri),1256
fitted: false,1203
fitted: false,@@ -1305,9 +1252,9 @@ fn folded_controls(state: &AppState, call: &ActiveCall, fullscreen: bool) -> Fol1305
if !has_more {1252
if !has_more {1306
return FoldedControls::default();1253
return FoldedControls::default();1307
}1254
}1308
let mut present = vec![Foldable::View];1255
let mut present = Vec::new();1309
if model.has_reaction_controls() {1256
if model.has_reaction_controls() {1310
present.extend([Foldable::Reactions, Foldable::RaiseHand]);1257
present.push(Foldable::Reactions);1311
}1258
}1312
if model.kind != CallKind::Test {1259
if model.kind != CallKind::Test {1313
present.push(Foldable::People);1260
present.push(Foldable::People);@@ -1315,9 +1262,14 @@ fn folded_controls(state: &AppState, call: &ActiveCall, fullscreen: bool) -> Fol1315
if call.chat_thread().is_some() {1262
if call.chat_thread().is_some() {1316
present.push(Foldable::Chat);1263
present.push(Foldable::Chat);1317
}1264
}1318
let fixed = fixed_controls_width(model.can_use_camera(), has_more, has_leave_menu(model));1265
let fixed = fixed_controls_width(1266
model.can_use_camera(),1267
has_more,1268
has_leave_menu(model),1269
shows_pop_out(call),1270
);1319
FoldedControls {1271
FoldedControls {1320
items: folded_for_width(measured_stage(call).0, fixed, &present),1272
items: in_more_menu(folded_for_width(measured_stage(call).0, fixed, &present)),1321
fullscreen,1273
fullscreen,1322
people_open: call.people_open,1274
people_open: call.people_open,1323
chat_open: call.chat_open,1275
chat_open: call.chat_open,@@ -1340,7 +1292,14 @@ pub fn render_call_view(1340
.w_full()1292
.w_full()1341
.h(px(HEADER_HEIGHT))1293
.h(px(HEADER_HEIGHT))1342
.flex_none()1294
.flex_none()1343
.px(px(20.))1295
.pl(px(20.))1296
.pr(px(HEADER_END_PADDING))1297
.gap(px(12.))1298
.items_center();1299
let title_group = h_flex()1300
.flex_1()1301
.flex_basis(px(0.))1302
.min_w_0()1344
.gap(px(12.))1303
.gap(px(12.))1345
.items_center()1304
.items_center()1346
.child(icon(IconName::Phone, 18., theme::accent_text()))1305
.child(icon(IconName::Phone, 18., theme::accent_text()))@@ -1362,40 +1321,59 @@ pub fn render_call_view(1362
.children(health_indicator(model))1321
.children(health_indicator(model))1363
.children(recording_chip(model))1322
.children(recording_chip(model))1364
.children(lock_chip(model))1323
.children(lock_chip(model))1365
.children(room_chip(model))1324
.children(room_chip(model));1366
.child(div().flex_1())1325
let end_group = h_flex()1367
.children(return_button(app, model));1326
.flex_1()1327
.flex_basis(px(0.))1328
.min_w_0()1329
.justify_end()1330
.gap(px(GROUP_GAP))1331
.items_center()1332
.children(return_button(app, model))1333
.child(leave_group(app, model));1368
1334
1369
let hold = hold_panel(app, model);1335
let hold = hold_panel(app, model);1370
let share_stage = share_stage_element(app, state, call);1336
let share_stage = share_stage_element(app, state, call);1371
let region = stage_region(app, state, call, now, hold, share_stage);1337
let region = stage_region(app, state, call, now, hold, share_stage);1372
1338
1373
let folded = folded_controls(state, call, fullscreen);1339
let folded = folded_controls(state, call, fullscreen);1374
let controls = h_flex()1340
let panels_and_reactions = h_flex()1375
.w_full()1341
.gap(px(TOOL_GAP))1376
.flex_none()1342
.items_center()1377
.py(px(16.))1343
.when(1378
.px(px(CONTROLS_PADDING))1344
model.has_reaction_controls() && !folded.folds(Foldable::Reactions),1379
.gap(px(CONTROL_GAP))1345
|row| row.child(reactions_button(app, model)),1346
)1347
.when(1348
call.chat_thread().is_some() && !folded.folds(Foldable::Chat),1349
|row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),1350
)1351
.when(1352
model.kind != CallKind::Test && !folded.folds(Foldable::People),1353
|row| row.child(people_button(app, call.people_open, model.raised_hands())),1354
);1355
let stage_and_more = h_flex()1356
.gap(px(TOOL_GAP))1357
.items_center()1358
.when(shows_pop_out(call), |row| row.child(pop_out_tool(app)))1359
.when(!folded.folds(Foldable::View), |row| {1360
row.child(view_button(app, model, fullscreen))1361
})1362
.children(more_button(app, model, &folded));1363
let devices = h_flex()1364
.gap(px(TOOL_GAP))1380
.items_center()1365
.items_center()1381
.justify_center()1382
.child(1366
.child(1383
h_flex()1367
h_flex()1384
.debug_selector(|| "shell/islands/main/call-controls/mic".into())1368
.debug_selector(|| "shell/islands/main/call-header/controls/mic".into())1385
.h(px(CONTROL_SIZE))1386
.items_center()1369
.items_center()1387
.rounded_full()1370
.child(toolbar_mic(app, model))1388
.bg(theme::surface_raised())1389
.child(mute_button(app, model, "call-mute", CONTROL_SIZE))1390
.child(mic_menu_button(app, model, state.call_mic)),1371
.child(mic_menu_button(app, model, state.call_mic)),1391
)1372
)1392
.child(1373
.child(1393
h_flex()1374
h_flex()1394
.h(px(CONTROL_SIZE))1395
.items_center()1375
.items_center()1396
.rounded_full()1376
.child(toolbar_camera(app, model))1397
.bg(theme::surface_raised())1398
.child(camera_button(app, model))1399
.children(camera_menu_button(app, model, CameraMenu::of(state))),1377
.children(camera_menu_button(app, model, CameraMenu::of(state))),1400
)1378
)1401
.child(share_button(1379
.child(share_button(@@ -1403,34 +1381,18 @@ pub fn render_call_view(1403
model,1381
model,1404
ShareOptions::of(state),1382
ShareOptions::of(state),1405
call.share_menu_open,1383
call.share_menu_open,1406
))1384
));1407
.when(1385
let controls = h_flex()1408
model.has_reaction_controls() && !folded.folds(Foldable::RaiseHand),1386
.debug_selector(|| "shell/islands/main/call-header/controls".into())1409
|row| row.child(hand_button(app, model)),1387
.flex_none()1410
)1388
.gap(px(GROUP_GAP))1411
.when(1389
.items_center()1412
model.has_reaction_controls() && !folded.folds(Foldable::Reactions),1390
.child(devices)1413
|row| row.child(reactions_button(app, model)),1391
.child(group_divider())1414
)1392
.child(panels_and_reactions)1415
.when(!folded.folds(Foldable::View), |row| {1393
.child(group_divider())1416
row.child(view_button(app, model, fullscreen))1394
.child(stage_and_more);1417
})1395
let header = header.child(title_group).child(controls).child(end_group);1418
.children(more_button(app, model, &folded))1419
.when(1420
model.kind != CallKind::Test && !folded.folds(Foldable::People),1421
|row| row.child(people_button(app, call.people_open, model.raised_hands())),1422
)1423
.when(1424
call.chat_thread().is_some() && !folded.folds(Foldable::Chat),1425
|row| row.child(chat_button(app, call.chat_open, state.call_chat_unread())),1426
)1427
.child(1428
leave_button(app, model, "call-leave", false)1429
.debug_selector(|| "shell/islands/main/call-controls/leave".into()),1430
)1431
.when(has_leave_menu(model), |row| {1432
row.child(leave_menu(app, model))1433
});1434
1396
1435
let top = v_flex()1397
let top = v_flex()1436
.w_full()1398
.w_full()@@ -1461,28 +1423,19 @@ pub fn render_call_view(1461
column.child(fullscreen_chrome("call-chrome-top", app, top))1423
column.child(fullscreen_chrome("call-chrome-top", app, top))1462
})1424
})1463
.child(region)1425
.child(region)1464
.when(chrome_visible, |column| {1465
column.child(fullscreen_chrome("call-chrome-bottom", app, controls))1466
})1467
} else {1426
} else {1468
base.rounded(px(10.))1427
base.rounded(px(10.))1469
.child(top.debug_selector(|| "shell/islands/main/call-header".into()))1428
.child(top.debug_selector(|| "shell/islands/main/call-header".into()))1470
.child(region)1429
.child(region)1471
.child(controls.debug_selector(|| "shell/islands/main/call-controls".into()))1472
}1430
}1473
.children(captions_overlay(model, now))1431
.children(captions_overlay(model, now))1474
.children(captions_hint_chip(model))1432
.children(captions_hint_chip(model))1475
.children(push_to_talk_chip(call))1433
.children(push_to_talk_chip(call))1476
.children(state.transfer_picker.clone())1434
.children(state.transfer_picker.clone())1477
.children(options_dialog(app, call))1435
.children(options_dialog(app, call))1478
.children(consent_overlay(app, model))1436
.children(consent_overlay(app, model));1479
.children(local_share_float(app, state));1480
let share_in_chat = call1481
.chat_open1482
.then(|| local_share_window(app, state, CHAT_PANEL_WIDTH))1483
.flatten();1484
let panels: Vec<AnyElement> = chat1437
let panels: Vec<AnyElement> = chat1485
.map(|chat| chat_panel(app, share_in_chat, chat))1438
.map(|chat| chat_panel(app, chat))1486
.into_iter()1439
.into_iter()1487
.chain(1440
.chain(1488
call.transcript_open1441
call.transcript_open@@ -1516,15 +1469,17 @@ fn side_panels(panels: Vec<AnyElement>, island_width: f32) -> Vec<AnyElement> {1516
if island_width - panels_width >= OVERLAY_BELOW {1469
if island_width - panels_width >= OVERLAY_BELOW {1517
return panels;1470
return panels;1518
}1471
}1519
vec![h_flex()1472
vec![1520
.absolute()1473
h_flex()1521
.top_0()1474
.absolute()1522
.right_0()1475
.top(px(HEADER_HEIGHT))1523
.bottom(px(CONTROLS_HEIGHT))1476
.right_0()1524
.gap(px(ISLAND_GAP))1477
.bottom_0()1525
.w(px(panels_width.min(island_width)))1478
.gap(px(ISLAND_GAP))1526
.children(panels)1479
.w(px(panels_width.min(island_width)))1527
.into_any_element()]1480
.children(panels)1481
.into_any_element(),1482
]1528
}1483
}1529
1484
1530
fn fullscreen_chrome(id: &'static str, app: &Entity<AppState>, content: Div) -> Stateful<Div> {1485
fn fullscreen_chrome(id: &'static str, app: &Entity<AppState>, content: Div) -> Stateful<Div> {@@ -1539,146 +1494,19 @@ fn fullscreen_chrome(id: &'static str, app: &Entity<AppState>, content: Div) ->1539
.child(content)1494
.child(content)1540
}1495
}1541
1496
1542
fn chat_panel(app: &Entity<AppState>, share: Option<AnyElement>, chat: AnyView) -> AnyElement {1497
fn chat_panel(app: &Entity<AppState>, chat: AnyView) -> AnyElement {1543
let app = app.clone();1498
let app = app.clone();1544
let body = v_flex()1545
.w_full()1546
.flex_1()1547
.min_h_0()1548
.children(share)1549
.child(div().flex_1().min_h_0().overflow_hidden().child(chat));1550
side_panel(1499
side_panel(1551
"call-chat-panel",1500
"call-chat-panel",1552
"Chat",1501
"Chat",1553
"Close the chat",1502
"Close the chat",1554
move |cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)),1503
move |cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)),1555
body,1504
chat,1556
)1505
)1557
.debug_selector(|| CHAT_PANEL_TAG.into())1506
.debug_selector(|| CHAT_PANEL_TAG.into())1558
.into_any_element()1507
.into_any_element()1559
}1508
}1560
1509
1561
const SHARE_WINDOW_INSET: f32 = 12.;1562
const SHARE_WINDOW_RATIO: f32 = 9. / 16.;1563
const SHARE_FLOAT_WIDTH: f32 = 320.;1564
1565
/// The live local share, pinned in the meeting chat or floating on the call1566
/// when the chat is closed.1567
fn local_share_window(app: &Entity<AppState>, state: &AppState, width: f32) -> Option<AnyElement> {1568
let call = state.call.as_ref()?;1569
let label = call.model.local_share.clone()?;1570
let image = call.pictures.live(&VideoKey::LocalScreen, Instant::now());1571
Some(share_window(app, &label, image, width))1572
}1573
1574
fn local_share_float(app: &Entity<AppState>, state: &AppState) -> Option<AnyElement> {1575
let call = state.call.as_ref()?;1576
if call.chat_open {1577
return None;1578
}1579
let window = local_share_window(app, state, SHARE_FLOAT_WIDTH)?;1580
Some(1581
div()1582
.absolute()1583
.right(px(16.))1584
.bottom(px(CONTROLS_HEIGHT + 12.))1585
.w(px(SHARE_FLOAT_WIDTH))1586
.rounded(px(10.))1587
.overflow_hidden()1588
.bg(theme::surface())1589
.shadow(theme::flyout_shadow())1590
.child(window)1591
.into_any_element(),1592
)1593
}1594
1595
fn share_window(1596
app: &Entity<AppState>,1597
label: &str,1598
image: Option<Arc<RenderImage>>,1599
width: f32,1600
) -> AnyElement {1601
let picture_width = (width - 2. * SHARE_WINDOW_INSET).max(0.);1602
let picture_height = picture_width * SHARE_WINDOW_RATIO;1603
let stop = app.clone();1604
v_flex()1605
.w_full()1606
.flex_none()1607
.p(px(SHARE_WINDOW_INSET))1608
.child(1609
div()1610
.id("call-share-window")1611
.relative()1612
.w(px(picture_width))1613
.h(px(picture_height))1614
.rounded(px(8.))1615
.overflow_hidden()1616
.bg(hsla(0., 0., 0.04, 1.))1617
.child(share_picture(image))1618
.child(1619
div()1620
.absolute()1621
.top(px(8.))1622
.left(px(8.))1623
.max_w(px(picture_width * 0.62))1624
.h(px(22.))1625
.px(px(8.))1626
.flex()1627
.items_center()1628
.rounded_full()1629
.bg(hsla(0., 0., 0., 0.6))1630
.text_size(px(11.))1631
.text_color(theme::white())1632
.child(div().truncate().child(label.to_owned())),1633
)1634
.child(share_stop(stop)),1635
)1636
.into_any_element()1637
}1638
1639
fn share_picture(image: Option<Arc<RenderImage>>) -> AnyElement {1640
let Some(image) = image else {1641
return div()1642
.size_full()1643
.flex()1644
.items_center()1645
.justify_center()1646
.px(px(12.))1647
.text_size(px(12.))1648
.text_color(theme::text_muted())1649
.child(WAITING_TEXT)1650
.into_any_element();1651
};1652
img(ImageSource::Render(image))1653
.size_full()1654
.object_fit(ObjectFit::Contain)1655
.into_any_element()1656
}1657
1658
fn share_stop(app: Entity<AppState>) -> Stateful<Div> {1659
div()1660
.id("call-share-window-stop")1661
.absolute()1662
.top(px(8.))1663
.right(px(8.))1664
.h(px(22.))1665
.px(px(8.))1666
.flex()1667
.items_center()1668
.rounded_full()1669
.bg(theme::red())1670
.text_color(theme::white())1671
.text_size(px(11.))1672
.font_weight(FontWeight::SEMIBOLD)1673
.cursor_pointer()1674
.hover(|button| button.opacity(0.85))1675
.child("Stop")1676
.on_click(move |_, _, cx| {1677
cx.stop_propagation();1678
app.update(cx, |state, cx| state.stop_call_share(cx));1679
})1680
}1681
1682
pub fn side_panel(1510
pub fn side_panel(1683
panel_id: &'static str,1511
panel_id: &'static str,1684
title: &'static str,1512
title: &'static str,@@ -1730,25 +1558,14 @@ pub fn side_panel(1730
1558
1731
#[cfg(test)]1559
#[cfg(test)]1732
mod tests {1560
mod tests {1733
use super::{name_plate_metrics, TileSize};1561
use super::{TileSize, name_plate_metrics};1734
1562
1735
#[test]1563
#[test]1736
fn small_strip_tiles_get_a_compact_name_plate() {1564
fn small_strip_tiles_get_a_compact_name_plate() {1737
let strip = name_plate_metrics(TileSize {1565
let strip = name_plate_metrics(TileSize { width: 216., height: 121.5, avatar: 48. });1738
width: 216.,1566
assert_eq!((strip.text_size, strip.inset, strip.padding_y), (11., 4., 2.));1739
height: 121.5,1740
avatar: 48.,1741
});1742
assert_eq!(1743
(strip.text_size, strip.inset, strip.padding_y),1744
(11., 4., 2.)1745
);1746
assert!(strip.max_width_share < 1.);1567
assert!(strip.max_width_share < 1.);1747
let stage = name_plate_metrics(TileSize {1568
let stage = name_plate_metrics(TileSize { width: 640., height: 360., avatar: 96. });1748
width: 640.,1749
height: 360.,1750
avatar: 96.,1751
});1752
assert_eq!((stage.text_size, stage.inset), (12., 8.));1569
assert_eq!((stage.text_size, stage.inset), (12., 8.));1753
}1570
}1754
}1571
}