Fix rendering of shared screens in collab panel

This commit is contained in:
Max Brunsfeld 2023-12-05 10:29:19 -08:00
parent 5e79807f6f
commit 38d41acf9b
2 changed files with 19 additions and 63 deletions

View file

@ -1294,70 +1294,20 @@ impl CollabPanel {
is_last: bool, is_last: bool,
cx: &mut ViewContext<Self>, cx: &mut ViewContext<Self>,
) -> impl IntoElement { ) -> impl IntoElement {
// enum OpenSharedScreen {} let id = peer_id.map_or(usize::MAX, |id| id.as_u64() as usize);
// let host_avatar_width = theme ListItem::new(("screen", id))
// .contact_avatar .left_child(render_tree_branch(is_last, cx))
// .width .child(IconButton::new(0, Icon::Screen))
// .or(theme.contact_avatar.height) .child(Label::new("Screen"))
// .unwrap_or(0.); .when_some(peer_id, |this, _| {
// let tree_branch = theme.tree_branch; this.on_click(cx.listener(move |this, _, cx| {
this.workspace.update(cx, |workspace, cx| {
// let handler = MouseEventHandler::new::<OpenSharedScreen, _>( workspace.open_shared_screen(peer_id.unwrap(), cx)
// peer_id.map(|id| id.as_u64()).unwrap_or(0) as usize, });
// cx, }))
// |mouse_state, cx| { .tooltip(move |cx| Tooltip::text(format!("Open shared screen"), cx))
// let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state); })
// let row = theme
// .project_row
// .in_state(is_selected)
// .style_for(mouse_state);
// Flex::row()
// .with_child(render_tree_branch(
// tree_branch,
// &row.name.text,
// is_last,
// vec2f(host_avatar_width, theme.row_height),
// cx.font_cache(),
// ))
// .with_child(
// Svg::new("icons/desktop.svg")
// .with_color(theme.channel_hash.color)
// .constrained()
// .with_width(theme.channel_hash.width)
// .aligned()
// .left(),
// )
// .with_child(
// Label::new("Screen", row.name.text.clone())
// .aligned()
// .left()
// .contained()
// .with_style(row.name.container)
// .flex(1., false),
// )
// .constrained()
// .with_height(theme.row_height)
// .contained()
// .with_style(row.container)
// },
// );
// if peer_id.is_none() {
// return handler.into_any();
// }
// handler
// .with_cursor_style(CursorStyle::PointingHand)
// .on_click(MouseButton::Left, move |_, this, cx| {
// if let Some(workspace) = this.workspace.upgrade(cx) {
// workspace.update(cx, |workspace, cx| {
// workspace.open_shared_screen(peer_id.unwrap(), cx)
// });
// }
// })
// .into_any()
div()
} }
fn take_editing_state(&mut self, cx: &mut ViewContext<Self>) -> bool { fn take_editing_state(&mut self, cx: &mut ViewContext<Self>) -> bool {

View file

@ -2816,3 +2816,9 @@ impl From<(&'static str, EntityId)> for ElementId {
ElementId::NamedInteger(name.into(), id.as_u64() as usize) ElementId::NamedInteger(name.into(), id.as_u64() as usize)
} }
} }
impl From<(&'static str, usize)> for ElementId {
fn from((name, id): (&'static str, usize)) -> Self {
ElementId::NamedInteger(name.into(), id)
}
}