fix(calls): leave chevron only when it offers more than Leave
- Attendees saw a chevron whose menu only repeated 'Leave' - The chevron shows for 'End meeting for everyone' or 'Lower all hands'; the control row width follows the same rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -820,8 +820,12 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
820
820
.into_any_element()
821
821
}
822
822
823
fn has_leave_menu(model: &CallModel) -> bool {
824
model.kind == CallKind::Meeting
825
&& (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))
826
}
827
823
828
fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
824
let leave_app = app.clone();
825
829
let end_app = app.clone();
826
830
let can_end = model.can_end_meeting;
827
831
let lower_app = app.clone();
@@ -838,16 +842,9 @@ fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
838
842
theme::text(),
839
843
))
840
844
.dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {
841
let leave_app = leave_app.clone();
842
845
let end_app = end_app.clone();
843
846
let lower_app = lower_app.clone();
844
let popup = popup.min_w(px(MENU_WIDTH)).item(
845
PopupMenuItem::new("Leave")
846
.icon(IconName::PhoneOff)
847
.on_click(move |_, _, cx| {
848
leave_app.update(cx, |state, cx| state.leave_call(cx))
849
}),
850
);
847
let popup = popup.min_w(px(MENU_WIDTH));
851
848
let popup = if can_lower_all {
852
849
popup.item(
853
850
PopupMenuItem::new("Lower all hands").on_click(move |_, _, cx| {
@@ -1122,7 +1119,7 @@ fn folded_controls(state: &AppState, call: &ActiveCall, fullscreen: bool) -> Fol
1122
1119
let fixed = fixed_controls_width(
1123
1120
model.can_use_camera(),
1124
1121
has_more,
1125
model.kind == CallKind::Meeting,
1122
has_leave_menu(model),
1126
1123
);
1127
1124
FoldedControls {
1128
1125
items: folded_for_width(measured_stage(call).0, fixed, &present),
@@ -1236,9 +1233,7 @@ pub fn render_call_view(
1236
1233
leave_button(app, model, "call-leave", false)
1237
1234
.debug_selector(|| "shell/islands/main/call-controls/leave".into()),
1238
1235
)
1239
.when(model.kind == CallKind::Meeting, |row| {
1240
row.child(leave_menu(app, model))
1241
});
1236
.when(has_leave_menu(model), |row| row.child(leave_menu(app, model)));
1242
1237
1243
1238
let top = v_flex()
1244
1239
.w_full()
@@ -820,8 +820,12 @@ fn reactions_button(app: &Entity<AppState>, model: &CallModel) -> AnyElement {820
.into_any_element()820
.into_any_element()821
}821
}822
822
823
fn has_leave_menu(model: &CallModel) -> bool {824
model.kind == CallKind::Meeting825
&& (model.can_end_meeting || (model.can_lower_hands() && model.any_hand_raised()))826
}827
823
fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {828
fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {824
let leave_app = app.clone();825
let end_app = app.clone();829
let end_app = app.clone();826
let can_end = model.can_end_meeting;830
let can_end = model.can_end_meeting;827
let lower_app = app.clone();831
let lower_app = app.clone();@@ -838,16 +842,9 @@ fn leave_menu(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {838
theme::text(),842
theme::text(),839
))843
))840
.dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {844
.dropdown_menu_with_anchor(Anchor::BottomRight, move |popup, _, _| {841
let leave_app = leave_app.clone();842
let end_app = end_app.clone();845
let end_app = end_app.clone();843
let lower_app = lower_app.clone();846
let lower_app = lower_app.clone();844
let popup = popup.min_w(px(MENU_WIDTH)).item(847
let popup = popup.min_w(px(MENU_WIDTH));845
PopupMenuItem::new("Leave")846
.icon(IconName::PhoneOff)847
.on_click(move |_, _, cx| {848
leave_app.update(cx, |state, cx| state.leave_call(cx))849
}),850
);851
let popup = if can_lower_all {848
let popup = if can_lower_all {852
popup.item(849
popup.item(853
PopupMenuItem::new("Lower all hands").on_click(move |_, _, cx| {850
PopupMenuItem::new("Lower all hands").on_click(move |_, _, cx| {@@ -1122,7 +1119,7 @@ fn folded_controls(state: &AppState, call: &ActiveCall, fullscreen: bool) -> Fol1122
let fixed = fixed_controls_width(1119
let fixed = fixed_controls_width(1123
model.can_use_camera(),1120
model.can_use_camera(),1124
has_more,1121
has_more,1125
model.kind == CallKind::Meeting,1122
has_leave_menu(model),1126
);1123
);1127
FoldedControls {1124
FoldedControls {1128
items: folded_for_width(measured_stage(call).0, fixed, &present),1125
items: folded_for_width(measured_stage(call).0, fixed, &present),@@ -1236,9 +1233,7 @@ pub fn render_call_view(1236
leave_button(app, model, "call-leave", false)1233
leave_button(app, model, "call-leave", false)1237
.debug_selector(|| "shell/islands/main/call-controls/leave".into()),1234
.debug_selector(|| "shell/islands/main/call-controls/leave".into()),1238
)1235
)1239
.when(model.kind == CallKind::Meeting, |row| {1236
.when(has_leave_menu(model), |row| row.child(leave_menu(app, model)));1240
row.child(leave_menu(app, model))1241
});1242
1237
1243
let top = v_flex()1238
let top = v_flex()1244
.w_full()1239
.w_full()