Merge branch 'main' into collab-panel
This commit is contained in:
commit
111e17b220
54 changed files with 1233 additions and 679 deletions
|
@ -981,7 +981,7 @@ impl CollabPanel {
|
|||
worktree_root_names.join(", ")
|
||||
};
|
||||
|
||||
MouseEventHandler::<JoinProject, Self>::new(project_id as usize, cx, |mouse_state, _| {
|
||||
MouseEventHandler::new::<JoinProject, _>(project_id as usize, cx, |mouse_state, _| {
|
||||
let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
|
||||
let row = theme
|
||||
.project_row
|
||||
|
@ -1075,7 +1075,7 @@ impl CollabPanel {
|
|||
let baseline_offset =
|
||||
row.name.text.baseline_offset(font_cache) + (theme.row_height - line_height) / 2.;
|
||||
|
||||
MouseEventHandler::<OpenSharedScreen, Self>::new(
|
||||
MouseEventHandler::new::<OpenSharedScreen, _>(
|
||||
peer_id.as_u64() as usize,
|
||||
cx,
|
||||
|mouse_state, _| {
|
||||
|
@ -1193,7 +1193,7 @@ impl CollabPanel {
|
|||
enum AddContact {}
|
||||
let button = match section {
|
||||
Section::ActiveCall => Some(
|
||||
MouseEventHandler::<AddContact, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<AddContact, _>(0, cx, |state, _| {
|
||||
render_icon_button(
|
||||
theme
|
||||
.collab_panel
|
||||
|
@ -1215,7 +1215,7 @@ impl CollabPanel {
|
|||
),
|
||||
),
|
||||
Section::Contacts => Some(
|
||||
MouseEventHandler::<LeaveCallContactList, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<LeaveCallContactList, _>(0, cx, |state, _| {
|
||||
render_icon_button(
|
||||
theme
|
||||
.collab_panel
|
||||
|
@ -1237,7 +1237,7 @@ impl CollabPanel {
|
|||
),
|
||||
),
|
||||
Section::Channels => Some(
|
||||
MouseEventHandler::<AddChannel, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<AddChannel, _>(0, cx, |state, _| {
|
||||
render_icon_button(
|
||||
theme
|
||||
.collab_panel
|
||||
|
@ -1261,7 +1261,7 @@ impl CollabPanel {
|
|||
|
||||
let can_collapse = depth > 0;
|
||||
let icon_size = (&theme.collab_panel).section_icon_size;
|
||||
MouseEventHandler::<Header, Self>::new(section as usize, cx, |state, _| {
|
||||
MouseEventHandler::new::<Header, _>(section as usize, cx, |state, _| {
|
||||
let header_style = if can_collapse {
|
||||
theme
|
||||
.collab_panel
|
||||
|
@ -1330,7 +1330,7 @@ impl CollabPanel {
|
|||
let github_login = contact.user.github_login.clone();
|
||||
let initial_project = project.clone();
|
||||
let mut event_handler =
|
||||
MouseEventHandler::<Contact, Self>::new(contact.user.id as usize, cx, |state, cx| {
|
||||
MouseEventHandler::new::<Contact, _>(contact.user.id as usize, cx, |state, cx| {
|
||||
Flex::row()
|
||||
.with_children(contact.user.avatar.clone().map(|avatar| {
|
||||
let status_badge = if contact.online {
|
||||
|
@ -1369,7 +1369,7 @@ impl CollabPanel {
|
|||
.flex(1., true),
|
||||
)
|
||||
.with_child(
|
||||
MouseEventHandler::<Cancel, Self>::new(
|
||||
MouseEventHandler::new::<Cancel, _>(
|
||||
contact.user.id as usize,
|
||||
cx,
|
||||
|mouse_state, _| {
|
||||
|
@ -1421,7 +1421,7 @@ impl CollabPanel {
|
|||
cx: &mut ViewContext<Self>,
|
||||
) -> AnyElement<Self> {
|
||||
enum AddContacts {}
|
||||
MouseEventHandler::<AddContacts, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<AddContacts, _>(0, cx, |state, _| {
|
||||
let style = theme.list_empty_state.style_for(is_selected, state);
|
||||
Flex::row()
|
||||
.with_child(
|
||||
|
@ -1516,7 +1516,7 @@ impl CollabPanel {
|
|||
|
||||
const FACEPILE_LIMIT: usize = 4;
|
||||
|
||||
MouseEventHandler::<Channel, Self>::new(channel.id as usize, cx, |state, cx| {
|
||||
MouseEventHandler::new::<Channel, _>(channel.id as usize, cx, |state, cx| {
|
||||
Flex::row()
|
||||
.with_child(
|
||||
Svg::new("icons/hash.svg")
|
||||
|
@ -1618,18 +1618,14 @@ impl CollabPanel {
|
|||
.flex(1., true),
|
||||
)
|
||||
.with_child(
|
||||
MouseEventHandler::<Decline, Self>::new(
|
||||
channel.id as usize,
|
||||
cx,
|
||||
|mouse_state, _| {
|
||||
let button_style = if is_invite_pending {
|
||||
&theme.disabled_button
|
||||
} else {
|
||||
theme.contact_button.style_for(mouse_state)
|
||||
};
|
||||
render_icon_button(button_style, "icons/x.svg").aligned()
|
||||
},
|
||||
)
|
||||
MouseEventHandler::new::<Decline, _>(channel.id as usize, cx, |mouse_state, _| {
|
||||
let button_style = if is_invite_pending {
|
||||
&theme.disabled_button
|
||||
} else {
|
||||
theme.contact_button.style_for(mouse_state)
|
||||
};
|
||||
render_icon_button(button_style, "icons/x.svg").aligned()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(MouseButton::Left, move |_, this, cx| {
|
||||
this.respond_to_channel_invite(channel_id, false, cx);
|
||||
|
@ -1638,20 +1634,16 @@ impl CollabPanel {
|
|||
.with_margin_right(button_spacing),
|
||||
)
|
||||
.with_child(
|
||||
MouseEventHandler::<Accept, Self>::new(
|
||||
channel.id as usize,
|
||||
cx,
|
||||
|mouse_state, _| {
|
||||
let button_style = if is_invite_pending {
|
||||
&theme.disabled_button
|
||||
} else {
|
||||
theme.contact_button.style_for(mouse_state)
|
||||
};
|
||||
render_icon_button(button_style, "icons/check_8.svg")
|
||||
.aligned()
|
||||
.flex_float()
|
||||
},
|
||||
)
|
||||
MouseEventHandler::new::<Accept, _>(channel.id as usize, cx, |mouse_state, _| {
|
||||
let button_style = if is_invite_pending {
|
||||
&theme.disabled_button
|
||||
} else {
|
||||
theme.contact_button.style_for(mouse_state)
|
||||
};
|
||||
render_icon_button(button_style, "icons/check_8.svg")
|
||||
.aligned()
|
||||
.flex_float()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(MouseButton::Left, move |_, this, cx| {
|
||||
this.respond_to_channel_invite(channel_id, true, cx);
|
||||
|
@ -1710,7 +1702,7 @@ impl CollabPanel {
|
|||
|
||||
if is_incoming {
|
||||
row.add_child(
|
||||
MouseEventHandler::<Decline, Self>::new(user.id as usize, cx, |mouse_state, _| {
|
||||
MouseEventHandler::new::<Decline, _>(user.id as usize, cx, |mouse_state, _| {
|
||||
let button_style = if is_contact_request_pending {
|
||||
&theme.disabled_button
|
||||
} else {
|
||||
|
@ -1727,7 +1719,7 @@ impl CollabPanel {
|
|||
);
|
||||
|
||||
row.add_child(
|
||||
MouseEventHandler::<Accept, Self>::new(user.id as usize, cx, |mouse_state, _| {
|
||||
MouseEventHandler::new::<Accept, _>(user.id as usize, cx, |mouse_state, _| {
|
||||
let button_style = if is_contact_request_pending {
|
||||
&theme.disabled_button
|
||||
} else {
|
||||
|
@ -1744,7 +1736,7 @@ impl CollabPanel {
|
|||
);
|
||||
} else {
|
||||
row.add_child(
|
||||
MouseEventHandler::<Cancel, Self>::new(user.id as usize, cx, |mouse_state, _| {
|
||||
MouseEventHandler::new::<Cancel, _>(user.id as usize, cx, |mouse_state, _| {
|
||||
let button_style = if is_contact_request_pending {
|
||||
&theme.disabled_button
|
||||
} else {
|
||||
|
@ -2266,7 +2258,7 @@ impl View for CollabPanel {
|
|||
|
||||
return Flex::column()
|
||||
.with_child(
|
||||
MouseEventHandler::<LogInButton, _>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<LogInButton, _>(0, cx, |state, _| {
|
||||
let button = theme.log_in_button.style_for(state);
|
||||
Label::new("Sign in to collaborate", button.text.clone())
|
||||
.contained()
|
||||
|
@ -2287,7 +2279,7 @@ impl View for CollabPanel {
|
|||
}
|
||||
|
||||
enum PanelFocus {}
|
||||
MouseEventHandler::<PanelFocus, _>::new(0, cx, |_, cx| {
|
||||
MouseEventHandler::new::<PanelFocus, _>(0, cx, |_, cx| {
|
||||
Stack::new()
|
||||
.with_child(
|
||||
Flex::column()
|
||||
|
|
|
@ -164,7 +164,7 @@ impl View for ChannelModal {
|
|||
cx: &mut ViewContext<ChannelModal>,
|
||||
) -> AnyElement<ChannelModal> {
|
||||
let active = mode == current_mode;
|
||||
MouseEventHandler::<T, _>::new(0, cx, move |state, _| {
|
||||
MouseEventHandler::new::<T, _>(0, cx, move |state, _| {
|
||||
let contained_text = theme.tab_button.style_for(active, state);
|
||||
Label::new(text, contained_text.text.clone())
|
||||
.contained()
|
||||
|
|
|
@ -219,7 +219,7 @@ impl CollabTitlebarItem {
|
|||
let mut ret = Flex::row().with_child(
|
||||
Stack::new()
|
||||
.with_child(
|
||||
MouseEventHandler::<ToggleProjectMenu, Self>::new(0, cx, |mouse_state, cx| {
|
||||
MouseEventHandler::new::<ToggleProjectMenu, _>(0, cx, |mouse_state, cx| {
|
||||
let style = project_style
|
||||
.in_state(self.project_popover.is_some())
|
||||
.style_for(mouse_state);
|
||||
|
@ -259,7 +259,7 @@ impl CollabTitlebarItem {
|
|||
.with_child(
|
||||
Stack::new()
|
||||
.with_child(
|
||||
MouseEventHandler::<ToggleVcsMenu, Self>::new(
|
||||
MouseEventHandler::new::<ToggleVcsMenu, _>(
|
||||
0,
|
||||
cx,
|
||||
|mouse_state, cx| {
|
||||
|
@ -363,7 +363,7 @@ impl CollabTitlebarItem {
|
|||
self.branch_popover.as_ref().map(|child| {
|
||||
let theme = theme::current(cx).clone();
|
||||
let child = ChildView::new(child, cx);
|
||||
let child = MouseEventHandler::<BranchList, Self>::new(0, cx, |_, _| {
|
||||
let child = MouseEventHandler::new::<BranchList, _>(0, cx, |_, _| {
|
||||
child
|
||||
.flex(1., true)
|
||||
.contained()
|
||||
|
@ -399,7 +399,7 @@ impl CollabTitlebarItem {
|
|||
self.project_popover.as_ref().map(|child| {
|
||||
let theme = theme::current(cx).clone();
|
||||
let child = ChildView::new(child, cx);
|
||||
let child = MouseEventHandler::<RecentProjects, Self>::new(0, cx, |_, _| {
|
||||
let child = MouseEventHandler::new::<RecentProjects, _>(0, cx, |_, _| {
|
||||
child
|
||||
.flex(1., true)
|
||||
.contained()
|
||||
|
@ -505,7 +505,7 @@ impl CollabTitlebarItem {
|
|||
|
||||
let active = room.read(cx).is_screen_sharing();
|
||||
let titlebar = &theme.titlebar;
|
||||
MouseEventHandler::<ToggleScreenSharing, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<ToggleScreenSharing, _>(0, cx, |state, _| {
|
||||
let style = titlebar
|
||||
.screen_share_button
|
||||
.in_state(active)
|
||||
|
@ -554,7 +554,7 @@ impl CollabTitlebarItem {
|
|||
}
|
||||
|
||||
let titlebar = &theme.titlebar;
|
||||
MouseEventHandler::<ToggleMute, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<ToggleMute, _>(0, cx, |state, _| {
|
||||
let style = titlebar
|
||||
.toggle_microphone_button
|
||||
.in_state(is_muted)
|
||||
|
@ -607,7 +607,7 @@ impl CollabTitlebarItem {
|
|||
}
|
||||
|
||||
let titlebar = &theme.titlebar;
|
||||
MouseEventHandler::<ToggleDeafen, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<ToggleDeafen, _>(0, cx, |state, _| {
|
||||
let style = titlebar
|
||||
.toggle_speakers_button
|
||||
.in_state(is_deafened)
|
||||
|
@ -642,7 +642,7 @@ impl CollabTitlebarItem {
|
|||
let tooltip = "Leave call";
|
||||
|
||||
let titlebar = &theme.titlebar;
|
||||
MouseEventHandler::<LeaveCall, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<LeaveCall, _>(0, cx, |state, _| {
|
||||
let style = titlebar.leave_call_button.style_for(state);
|
||||
Svg::new(icon)
|
||||
.with_color(style.color)
|
||||
|
@ -696,7 +696,7 @@ impl CollabTitlebarItem {
|
|||
Some(
|
||||
Stack::new()
|
||||
.with_child(
|
||||
MouseEventHandler::<ShareUnshare, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<ShareUnshare, _>(0, cx, |state, _| {
|
||||
//TODO: Ensure this button has consistent width for both text variations
|
||||
let style = titlebar.share_button.inactive_state().style_for(state);
|
||||
Label::new(label, style.text.clone())
|
||||
|
@ -742,7 +742,7 @@ impl CollabTitlebarItem {
|
|||
let avatar_style = &user_menu_button_style.avatar;
|
||||
Stack::new()
|
||||
.with_child(
|
||||
MouseEventHandler::<ToggleUserMenu, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<ToggleUserMenu, _>(0, cx, |state, _| {
|
||||
let style = user_menu_button_style
|
||||
.user_menu
|
||||
.inactive_state()
|
||||
|
@ -802,7 +802,7 @@ impl CollabTitlebarItem {
|
|||
|
||||
fn render_sign_in_button(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
let titlebar = &theme.titlebar;
|
||||
MouseEventHandler::<SignIn, Self>::new(0, cx, |state, _| {
|
||||
MouseEventHandler::new::<SignIn, _>(0, cx, |state, _| {
|
||||
let style = titlebar.sign_in_button.inactive_state().style_for(state);
|
||||
Label::new("Sign In", style.text.clone())
|
||||
.contained()
|
||||
|
@ -1020,7 +1020,7 @@ impl CollabTitlebarItem {
|
|||
if let Some(replica_id) = replica_id {
|
||||
enum ToggleFollow {}
|
||||
|
||||
content = MouseEventHandler::<ToggleFollow, Self>::new(
|
||||
content = MouseEventHandler::new::<ToggleFollow, _>(
|
||||
replica_id.into(),
|
||||
cx,
|
||||
move |_, _| content,
|
||||
|
@ -1051,7 +1051,7 @@ impl CollabTitlebarItem {
|
|||
enum JoinProject {}
|
||||
|
||||
let user_id = user.id;
|
||||
content = MouseEventHandler::<JoinProject, Self>::new(
|
||||
content = MouseEventHandler::new::<JoinProject, _>(
|
||||
peer_id.as_u64() as usize,
|
||||
cx,
|
||||
move |_, _| content,
|
||||
|
@ -1139,7 +1139,7 @@ impl CollabTitlebarItem {
|
|||
.into_any(),
|
||||
),
|
||||
client::Status::UpgradeRequired => Some(
|
||||
MouseEventHandler::<ConnectionStatusButton, Self>::new(0, cx, |_, _| {
|
||||
MouseEventHandler::new::<ConnectionStatusButton, _>(0, cx, |_, _| {
|
||||
Label::new(
|
||||
"Please update Zed to collaborate",
|
||||
theme.titlebar.outdated_warning.text.clone(),
|
||||
|
|
|
@ -173,7 +173,7 @@ impl IncomingCallNotification {
|
|||
let theme = theme::current(cx);
|
||||
Flex::column()
|
||||
.with_child(
|
||||
MouseEventHandler::<Accept, Self>::new(0, cx, |_, _| {
|
||||
MouseEventHandler::new::<Accept, _>(0, cx, |_, _| {
|
||||
let theme = &theme.incoming_call_notification;
|
||||
Label::new("Accept", theme.accept_button.text.clone())
|
||||
.aligned()
|
||||
|
@ -187,7 +187,7 @@ impl IncomingCallNotification {
|
|||
.flex(1., true),
|
||||
)
|
||||
.with_child(
|
||||
MouseEventHandler::<Decline, Self>::new(0, cx, |_, _| {
|
||||
MouseEventHandler::new::<Decline, _>(0, cx, |_, _| {
|
||||
let theme = &theme.incoming_call_notification;
|
||||
Label::new("Decline", theme.decline_button.text.clone())
|
||||
.aligned()
|
||||
|
|
|
@ -52,7 +52,7 @@ where
|
|||
.flex(1., true),
|
||||
)
|
||||
.with_child(
|
||||
MouseEventHandler::<Dismiss, V>::new(user.id as usize, cx, |state, _| {
|
||||
MouseEventHandler::new::<Dismiss, _>(user.id as usize, cx, |state, _| {
|
||||
let style = theme.dismiss_button.style_for(state);
|
||||
Svg::new("icons/x_mark_8.svg")
|
||||
.with_color(style.color)
|
||||
|
@ -92,7 +92,7 @@ where
|
|||
Flex::row()
|
||||
.with_children(buttons.into_iter().enumerate().map(
|
||||
|(ix, (message, handler))| {
|
||||
MouseEventHandler::<Button, V>::new(ix, cx, |state, _| {
|
||||
MouseEventHandler::new::<Button, _>(ix, cx, |state, _| {
|
||||
let button = theme.button.style_for(state);
|
||||
Label::new(message, button.text.clone())
|
||||
.contained()
|
||||
|
|
|
@ -170,7 +170,7 @@ impl ProjectSharedNotification {
|
|||
let theme = theme::current(cx);
|
||||
Flex::column()
|
||||
.with_child(
|
||||
MouseEventHandler::<Open, Self>::new(0, cx, |_, _| {
|
||||
MouseEventHandler::new::<Open, _>(0, cx, |_, _| {
|
||||
let theme = &theme.project_shared_notification;
|
||||
Label::new("Open", theme.open_button.text.clone())
|
||||
.aligned()
|
||||
|
@ -182,7 +182,7 @@ impl ProjectSharedNotification {
|
|||
.flex(1., true),
|
||||
)
|
||||
.with_child(
|
||||
MouseEventHandler::<Dismiss, Self>::new(0, cx, |_, _| {
|
||||
MouseEventHandler::new::<Dismiss, _>(0, cx, |_, _| {
|
||||
let theme = &theme.project_shared_notification;
|
||||
Label::new("Dismiss", theme.dismiss_button.text.clone())
|
||||
.aligned()
|
||||
|
|
|
@ -47,7 +47,7 @@ impl View for SharingStatusIndicator {
|
|||
Appearance::Dark | Appearance::VibrantDark => Color::white(),
|
||||
};
|
||||
|
||||
MouseEventHandler::<Self, Self>::new(0, cx, |_, _| {
|
||||
MouseEventHandler::new::<Self, _>(0, cx, |_, _| {
|
||||
Svg::new("icons/disable_screen_sharing_12.svg")
|
||||
.with_color(color)
|
||||
.constrained()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue