Fix context menu in tab bar

This commit is contained in:
Antonio Scandurra
2023-12-22 10:23:27 +01:00
parent 3d5b903f78
commit 3de72f8366
10 changed files with 100 additions and 30 deletions
+11
View File
@@ -993,6 +993,7 @@ impl CollabPanel {
};
context_menu = context_menu.entry(
expand_action_name,
None,
cx.handler_for(&this, move |this, cx| {
this.toggle_channel_collapsed(channel_id, cx)
}),
@@ -1002,18 +1003,21 @@ impl CollabPanel {
context_menu = context_menu
.entry(
"Open Notes",
None,
cx.handler_for(&this, move |this, cx| {
this.open_channel_notes(channel_id, cx)
}),
)
.entry(
"Open Chat",
None,
cx.handler_for(&this, move |this, cx| {
this.join_channel_chat(channel_id, cx)
}),
)
.entry(
"Copy Channel Link",
None,
cx.handler_for(&this, move |this, cx| {
this.copy_channel_link(channel_id, cx)
}),
@@ -1024,14 +1028,17 @@ impl CollabPanel {
.separator()
.entry(
"New Subchannel",
None,
cx.handler_for(&this, move |this, cx| this.new_subchannel(channel_id, cx)),
)
.entry(
"Rename",
None,
cx.handler_for(&this, move |this, cx| this.rename_channel(channel_id, cx)),
)
.entry(
"Move this channel",
None,
cx.handler_for(&this, move |this, cx| {
this.start_move_channel(channel_id, cx)
}),
@@ -1040,6 +1047,7 @@ impl CollabPanel {
if let Some(channel_name) = clipboard_channel_name {
context_menu = context_menu.separator().entry(
format!("Move '#{}' here", channel_name),
None,
cx.handler_for(&this, move |this, cx| {
this.move_channel_on_clipboard(channel_id, cx)
}),
@@ -1050,14 +1058,17 @@ impl CollabPanel {
.separator()
.entry(
"Invite Members",
None,
cx.handler_for(&this, move |this, cx| this.invite_members(channel_id, cx)),
)
.entry(
"Manage Members",
None,
cx.handler_for(&this, move |this, cx| this.manage_members(channel_id, cx)),
)
.entry(
"Delete",
None,
cx.handler_for(&this, move |this, cx| this.remove_channel(channel_id, cx)),
);
}
@@ -532,7 +532,7 @@ impl ChannelModalDelegate {
let user_id = user.id;
let picker = cx.view().clone();
let context_menu = ContextMenu::build(cx, |mut menu, _cx| {
menu = menu.entry("Remove Member", {
menu = menu.entry("Remove Member", None, {
let picker = picker.clone();
move |cx| {
picker.update(cx, |picker, cx| {
@@ -544,7 +544,7 @@ impl ChannelModalDelegate {
let picker = picker.clone();
match role {
ChannelRole::Admin => {
menu = menu.entry("Revoke Admin", move |cx| {
menu = menu.entry("Revoke Admin", None, move |cx| {
picker.update(cx, |picker, cx| {
picker
.delegate
@@ -553,7 +553,7 @@ impl ChannelModalDelegate {
});
}
ChannelRole::Member => {
menu = menu.entry("Make Admin", move |cx| {
menu = menu.entry("Make Admin", None, move |cx| {
picker.update(cx, |picker, cx| {
picker
.delegate