@@ -18,7 +18,7 @@ mod contact_finder;
// };
use contact_finder::ContactFinder;
use menu::{Cancel, Confirm, SelectNext, SelectPrev};
-use rpc::proto;
+use rpc::proto::{self, PeerId};
use theme::{ActiveTheme, ThemeSettings};
// use context_menu::{ContextMenu, ContextMenuItem};
// use db::kvp::KEY_VALUE_STORE;
@@ -169,11 +169,12 @@ use editor::Editor;
use feature_flags::{ChannelsAlpha, FeatureFlagAppExt, FeatureFlagViewExt};
use fuzzy::{match_strings, StringMatchCandidate};
use gpui::{
- actions, div, img, overlay, prelude::*, px, rems, serde_json, Action, AppContext,
- AsyncWindowContext, Bounds, ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle,
- Focusable, FocusableView, InteractiveElement, IntoElement, Model, MouseDownEvent,
- ParentElement, Pixels, Point, PromptLevel, Render, RenderOnce, ScrollHandle, SharedString,
- Stateful, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView,
+ actions, canvas, div, img, overlay, point, prelude::*, px, rems, serde_json, Action,
+ AppContext, AsyncWindowContext, Bounds, ClipboardItem, DismissEvent, Div, EventEmitter,
+ FocusHandle, Focusable, FocusableView, Hsla, InteractiveElement, IntoElement, Length, Model,
+ MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Quad, Render, RenderOnce,
+ ScrollHandle, SharedString, Size, Stateful, Styled, Subscription, Task, View, ViewContext,
+ VisualContext, WeakView,
};
use project::{Fs, Project};
use serde_derive::{Deserialize, Serialize};
@@ -345,21 +346,21 @@ enum Section {
#[derive(Clone, Debug)]
enum ListEntry {
Header(Section),
- // CallParticipant {
- // user: Arc<User>,
- // peer_id: Option<PeerId>,
- // is_pending: bool,
- // },
- // ParticipantProject {
- // project_id: u64,
- // worktree_root_names: Vec<String>,
- // host_user_id: u64,
- // is_last: bool,
- // },
- // ParticipantScreen {
- // peer_id: Option<PeerId>,
- // is_last: bool,
- // },
+ CallParticipant {
+ user: Arc<User>,
+ peer_id: Option<PeerId>,
+ is_pending: bool,
+ },
+ ParticipantProject {
+ project_id: u64,
+ worktree_root_names: Vec<String>,
+ host_user_id: u64,
+ is_last: bool,
+ },
+ ParticipantScreen {
+ peer_id: Option<PeerId>,
+ is_last: bool,
+ },
IncomingRequest(Arc<User>),
OutgoingRequest(Arc<User>),
// ChannelInvite(Arc<Channel>),
@@ -368,12 +369,12 @@ enum ListEntry {
depth: usize,
has_children: bool,
},
- // ChannelNotes {
- // channel_id: ChannelId,
- // },
- // ChannelChat {
- // channel_id: ChannelId,
- // },
+ ChannelNotes {
+ channel_id: ChannelId,
+ },
+ ChannelChat {
+ channel_id: ChannelId,
+ },
ChannelEditor {
depth: usize,
},
@@ -706,136 +707,136 @@ impl CollabPanel {
let prev_selected_entry = self.selection.and_then(|ix| self.entries.get(ix).cloned());
let old_entries = mem::take(&mut self.entries);
- let scroll_to_top = false;
-
- // if let Some(room) = ActiveCall::global(cx).read(cx).room() {
- // self.entries.push(ListEntry::Header(Section::ActiveCall));
- // if !old_entries
- // .iter()
- // .any(|entry| matches!(entry, ListEntry::Header(Section::ActiveCall)))
- // {
- // scroll_to_top = true;
- // }
+ let mut scroll_to_top = false;
- // if !self.collapsed_sections.contains(&Section::ActiveCall) {
- // let room = room.read(cx);
+ if let Some(room) = ActiveCall::global(cx).read(cx).room() {
+ self.entries.push(ListEntry::Header(Section::ActiveCall));
+ if !old_entries
+ .iter()
+ .any(|entry| matches!(entry, ListEntry::Header(Section::ActiveCall)))
+ {
+ scroll_to_top = true;
+ }
- // if let Some(channel_id) = room.channel_id() {
- // self.entries.push(ListEntry::ChannelNotes { channel_id });
- // self.entries.push(ListEntry::ChannelChat { channel_id })
- // }
+ if !self.collapsed_sections.contains(&Section::ActiveCall) {
+ let room = room.read(cx);
- // // Populate the active user.
- // if let Some(user) = user_store.current_user() {
- // self.match_candidates.clear();
- // self.match_candidates.push(StringMatchCandidate {
- // id: 0,
- // string: user.github_login.clone(),
- // char_bag: user.github_login.chars().collect(),
- // });
- // let matches = executor.block(match_strings(
- // &self.match_candidates,
- // &query,
- // true,
- // usize::MAX,
- // &Default::default(),
- // executor.clone(),
- // ));
- // if !matches.is_empty() {
- // let user_id = user.id;
- // self.entries.push(ListEntry::CallParticipant {
- // user,
- // peer_id: None,
- // is_pending: false,
- // });
- // let mut projects = room.local_participant().projects.iter().peekable();
- // while let Some(project) = projects.next() {
- // self.entries.push(ListEntry::ParticipantProject {
- // project_id: project.id,
- // worktree_root_names: project.worktree_root_names.clone(),
- // host_user_id: user_id,
- // is_last: projects.peek().is_none() && !room.is_screen_sharing(),
- // });
- // }
- // if room.is_screen_sharing() {
- // self.entries.push(ListEntry::ParticipantScreen {
- // peer_id: None,
- // is_last: true,
- // });
- // }
- // }
- // }
+ if let Some(channel_id) = room.channel_id() {
+ self.entries.push(ListEntry::ChannelNotes { channel_id });
+ self.entries.push(ListEntry::ChannelChat { channel_id })
+ }
- // // Populate remote participants.
- // self.match_candidates.clear();
- // self.match_candidates
- // .extend(room.remote_participants().iter().map(|(_, participant)| {
- // StringMatchCandidate {
- // id: participant.user.id as usize,
- // string: participant.user.github_login.clone(),
- // char_bag: participant.user.github_login.chars().collect(),
- // }
- // }));
- // let matches = executor.block(match_strings(
- // &self.match_candidates,
- // &query,
- // true,
- // usize::MAX,
- // &Default::default(),
- // executor.clone(),
- // ));
- // for mat in matches {
- // let user_id = mat.candidate_id as u64;
- // let participant = &room.remote_participants()[&user_id];
- // self.entries.push(ListEntry::CallParticipant {
- // user: participant.user.clone(),
- // peer_id: Some(participant.peer_id),
- // is_pending: false,
- // });
- // let mut projects = participant.projects.iter().peekable();
- // while let Some(project) = projects.next() {
- // self.entries.push(ListEntry::ParticipantProject {
- // project_id: project.id,
- // worktree_root_names: project.worktree_root_names.clone(),
- // host_user_id: participant.user.id,
- // is_last: projects.peek().is_none()
- // && participant.video_tracks.is_empty(),
- // });
- // }
- // if !participant.video_tracks.is_empty() {
- // self.entries.push(ListEntry::ParticipantScreen {
- // peer_id: Some(participant.peer_id),
- // is_last: true,
- // });
- // }
- // }
+ // Populate the active user.
+ if let Some(user) = user_store.current_user() {
+ self.match_candidates.clear();
+ self.match_candidates.push(StringMatchCandidate {
+ id: 0,
+ string: user.github_login.clone(),
+ char_bag: user.github_login.chars().collect(),
+ });
+ let matches = executor.block(match_strings(
+ &self.match_candidates,
+ &query,
+ true,
+ usize::MAX,
+ &Default::default(),
+ executor.clone(),
+ ));
+ if !matches.is_empty() {
+ let user_id = user.id;
+ self.entries.push(ListEntry::CallParticipant {
+ user,
+ peer_id: None,
+ is_pending: false,
+ });
+ let mut projects = room.local_participant().projects.iter().peekable();
+ while let Some(project) = projects.next() {
+ self.entries.push(ListEntry::ParticipantProject {
+ project_id: project.id,
+ worktree_root_names: project.worktree_root_names.clone(),
+ host_user_id: user_id,
+ is_last: projects.peek().is_none() && !room.is_screen_sharing(),
+ });
+ }
+ if room.is_screen_sharing() {
+ self.entries.push(ListEntry::ParticipantScreen {
+ peer_id: None,
+ is_last: true,
+ });
+ }
+ }
+ }
- // // Populate pending participants.
- // self.match_candidates.clear();
- // self.match_candidates
- // .extend(room.pending_participants().iter().enumerate().map(
- // |(id, participant)| StringMatchCandidate {
- // id,
- // string: participant.github_login.clone(),
- // char_bag: participant.github_login.chars().collect(),
- // },
- // ));
- // let matches = executor.block(match_strings(
- // &self.match_candidates,
- // &query,
- // true,
- // usize::MAX,
- // &Default::default(),
- // executor.clone(),
- // ));
- // self.entries
- // .extend(matches.iter().map(|mat| ListEntry::CallParticipant {
- // user: room.pending_participants()[mat.candidate_id].clone(),
- // peer_id: None,
- // is_pending: true,
- // }));
- // }
- // }
+ // Populate remote participants.
+ self.match_candidates.clear();
+ self.match_candidates
+ .extend(room.remote_participants().iter().map(|(_, participant)| {
+ StringMatchCandidate {
+ id: participant.user.id as usize,
+ string: participant.user.github_login.clone(),
+ char_bag: participant.user.github_login.chars().collect(),
+ }
+ }));
+ let matches = executor.block(match_strings(
+ &self.match_candidates,
+ &query,
+ true,
+ usize::MAX,
+ &Default::default(),
+ executor.clone(),
+ ));
+ for mat in matches {
+ let user_id = mat.candidate_id as u64;
+ let participant = &room.remote_participants()[&user_id];
+ self.entries.push(ListEntry::CallParticipant {
+ user: participant.user.clone(),
+ peer_id: Some(participant.peer_id),
+ is_pending: false,
+ });
+ let mut projects = participant.projects.iter().peekable();
+ while let Some(project) = projects.next() {
+ self.entries.push(ListEntry::ParticipantProject {
+ project_id: project.id,
+ worktree_root_names: project.worktree_root_names.clone(),
+ host_user_id: participant.user.id,
+ is_last: projects.peek().is_none()
+ && participant.video_tracks.is_empty(),
+ });
+ }
+ if !participant.video_tracks.is_empty() {
+ self.entries.push(ListEntry::ParticipantScreen {
+ peer_id: Some(participant.peer_id),
+ is_last: true,
+ });
+ }
+ }
+
+ // Populate pending participants.
+ self.match_candidates.clear();
+ self.match_candidates
+ .extend(room.pending_participants().iter().enumerate().map(
+ |(id, participant)| StringMatchCandidate {
+ id,
+ string: participant.github_login.clone(),
+ char_bag: participant.github_login.chars().collect(),
+ },
+ ));
+ let matches = executor.block(match_strings(
+ &self.match_candidates,
+ &query,
+ true,
+ usize::MAX,
+ &Default::default(),
+ executor.clone(),
+ ));
+ self.entries
+ .extend(matches.iter().map(|mat| ListEntry::CallParticipant {
+ user: room.pending_participants()[mat.candidate_id].clone(),
+ peer_id: None,
+ is_pending: true,
+ }));
+ }
+ }
let mut request_entries = Vec::new();
@@ -1133,290 +1134,235 @@ impl CollabPanel {
cx.notify();
}
- // fn render_call_participant(
- // user: &User,
- // peer_id: Option<PeerId>,
- // user_store: ModelHandle<UserStore>,
- // is_pending: bool,
- // is_selected: bool,
- // theme: &theme::Theme,
- // cx: &mut ViewContext<Self>,
- // ) -> AnyElement<Self> {
- // enum CallParticipant {}
- // enum CallParticipantTooltip {}
- // enum LeaveCallButton {}
- // enum LeaveCallTooltip {}
-
- // let collab_theme = &theme.collab_panel;
-
- // let is_current_user =
- // user_store.read(cx).current_user().map(|user| user.id) == Some(user.id);
-
- // let content = MouseEventHandler::new::<CallParticipant, _>(
- // user.id as usize,
- // cx,
- // |mouse_state, cx| {
- // let style = if is_current_user {
- // *collab_theme
- // .contact_row
- // .in_state(is_selected)
- // .style_for(&mut Default::default())
- // } else {
- // *collab_theme
- // .contact_row
- // .in_state(is_selected)
- // .style_for(mouse_state)
- // };
-
- // Flex::row()
- // .with_children(user.avatar.clone().map(|avatar| {
- // Image::from_data(avatar)
- // .with_style(collab_theme.contact_avatar)
- // .aligned()
- // .left()
- // }))
- // .with_child(
- // Label::new(
- // user.github_login.clone(),
- // collab_theme.contact_username.text.clone(),
- // )
- // .contained()
- // .with_style(collab_theme.contact_username.container)
- // .aligned()
- // .left()
- // .flex(1., true),
- // )
- // .with_children(if is_pending {
- // Some(
- // Label::new("Calling", collab_theme.calling_indicator.text.clone())
- // .contained()
- // .with_style(collab_theme.calling_indicator.container)
- // .aligned()
- // .into_any(),
- // )
- // } else if is_current_user {
- // Some(
- // MouseEventHandler::new::<LeaveCallButton, _>(0, cx, |state, _| {
- // render_icon_button(
- // theme
- // .collab_panel
- // .leave_call_button
- // .style_for(is_selected, state),
- // "icons/exit.svg",
- // )
- // })
- // .with_cursor_style(CursorStyle::PointingHand)
- // .on_click(MouseButton::Left, |_, _, cx| {
- // Self::leave_call(cx);
- // })
- // .with_tooltip::<LeaveCallTooltip>(
- // 0,
- // "Leave call",
- // None,
- // theme.tooltip.clone(),
- // cx,
- // )
- // .into_any(),
- // )
- // } else {
- // None
- // })
- // .constrained()
- // .with_height(collab_theme.row_height)
- // .contained()
- // .with_style(style)
- // },
- // );
-
- // if is_current_user || is_pending || peer_id.is_none() {
- // return content.into_any();
- // }
-
- // let tooltip = format!("Follow {}", user.github_login);
-
- // content
- // .on_click(MouseButton::Left, move |_, this, cx| {
- // if let Some(workspace) = this.workspace.upgrade(cx) {
- // workspace
- // .update(cx, |workspace, cx| workspace.follow(peer_id.unwrap(), cx))
- // .map(|task| task.detach_and_log_err(cx));
- // }
- // })
- // .with_cursor_style(CursorStyle::PointingHand)
- // .with_tooltip::<CallParticipantTooltip>(
- // user.id as usize,
- // tooltip,
- // Some(Box::new(FollowNextCollaborator)),
- // theme.tooltip.clone(),
- // cx,
- // )
- // .into_any()
- // }
+ fn render_call_participant(
+ &self,
+ user: Arc<User>,
+ peer_id: Option<PeerId>,
+ is_pending: bool,
+ cx: &mut ViewContext<Self>,
+ ) -> impl IntoElement {
+ let is_current_user =
+ self.user_store.read(cx).current_user().map(|user| user.id) == Some(user.id);
+ let tooltip = format!("Follow {}", user.github_login);
- // fn render_participant_project(
- // project_id: u64,
- // worktree_root_names: &[String],
- // host_user_id: u64,
- // is_current: bool,
- // is_last: bool,
- // is_selected: bool,
- // theme: &theme::Theme,
- // cx: &mut ViewContext<Self>,
- // ) -> AnyElement<Self> {
- // enum JoinProject {}
- // enum JoinProjectTooltip {}
-
- // let collab_theme = &theme.collab_panel;
- // let host_avatar_width = collab_theme
- // .contact_avatar
- // .width
- // .or(collab_theme.contact_avatar.height)
- // .unwrap_or(0.);
- // let tree_branch = collab_theme.tree_branch;
- // let project_name = if worktree_root_names.is_empty() {
- // "untitled".to_string()
- // } else {
- // worktree_root_names.join(", ")
- // };
-
- // let content =
- // MouseEventHandler::new::<JoinProject, _>(project_id as usize, cx, |mouse_state, cx| {
- // let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
- // let row = if is_current {
- // collab_theme
- // .project_row
- // .in_state(true)
- // .style_for(&mut Default::default())
- // } else {
- // collab_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, collab_theme.row_height),
- // cx.font_cache(),
- // ))
- // .with_child(
- // Svg::new("icons/file_icons/folder.svg")
- // .with_color(collab_theme.channel_hash.color)
- // .constrained()
- // .with_width(collab_theme.channel_hash.width)
- // .aligned()
- // .left(),
- // )
- // .with_child(
- // Label::new(project_name.clone(), row.name.text.clone())
- // .aligned()
- // .left()
- // .contained()
- // .with_style(row.name.container)
- // .flex(1., false),
- // )
- // .constrained()
- // .with_height(collab_theme.row_height)
- // .contained()
- // .with_style(row.container)
- // });
-
- // if is_current {
- // return content.into_any();
- // }
-
- // content
- // .with_cursor_style(CursorStyle::PointingHand)
- // .on_click(MouseButton::Left, move |_, this, cx| {
- // if let Some(workspace) = this.workspace.upgrade(cx) {
- // let app_state = workspace.read(cx).app_state().clone();
- // workspace::join_remote_project(project_id, host_user_id, app_state, cx)
- // .detach_and_log_err(cx);
- // }
- // })
- // .with_tooltip::<JoinProjectTooltip>(
- // project_id as usize,
- // format!("Open {}", project_name),
- // None,
- // theme.tooltip.clone(),
- // cx,
- // )
- // .into_any()
- // }
+ ListItem::new(SharedString::from(user.github_login.clone()))
+ .left_child(Avatar::data(user.avatar.clone().unwrap()))
+ .child(
+ h_stack()
+ .w_full()
+ .justify_between()
+ .child(Label::new(user.github_login.clone()))
+ .child(if is_pending {
+ Label::new("Calling").color(Color::Muted).into_any_element()
+ } else if is_current_user {
+ IconButton::new("leave-call", Icon::ArrowRight)
+ .on_click(cx.listener(move |this, _, cx| {
+ Self::leave_call(cx);
+ }))
+ .tooltip(|cx| Tooltip::text("Leave Call", cx))
+ .into_any_element()
+ } else {
+ div().into_any_element()
+ }),
+ )
+ .when(!is_current_user, |this| {
+ this.tooltip(move |cx| Tooltip::text(tooltip.clone(), cx))
+ .on_click(cx.listener(move |this, _, cx| {
+ this.workspace.update(cx, |workspace, cx| {
+ // workspace.follow(peer_id, cx)
+ });
+ }))
+ })
+ }
- // fn render_participant_screen(
- // peer_id: Option<PeerId>,
- // is_last: bool,
- // is_selected: bool,
- // theme: &theme::CollabPanel,
- // cx: &mut ViewContext<Self>,
- // ) -> AnyElement<Self> {
- // enum OpenSharedScreen {}
-
- // let host_avatar_width = theme
- // .contact_avatar
- // .width
- // .or(theme.contact_avatar.height)
- // .unwrap_or(0.);
- // let tree_branch = theme.tree_branch;
-
- // let handler = MouseEventHandler::new::<OpenSharedScreen, _>(
- // peer_id.map(|id| id.as_u64()).unwrap_or(0) as usize,
- // cx,
- // |mouse_state, 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()
- // }
+ fn render_participant_project(
+ &self,
+ project_id: u64,
+ worktree_root_names: &[String],
+ host_user_id: u64,
+ // is_current: bool,
+ is_last: bool,
+ // is_selected: bool,
+ // theme: &theme::Theme,
+ cx: &mut ViewContext<Self>,
+ ) -> impl IntoElement {
+ let project_name: SharedString = if worktree_root_names.is_empty() {
+ "untitled".to_string()
+ } else {
+ worktree_root_names.join(", ")
+ }
+ .into();
+
+ let theme = cx.theme();
+
+ ListItem::new(project_id as usize)
+ .on_click(cx.listener(move |this, _, cx| {
+ this.workspace.update(cx, |workspace, cx| {
+ let app_state = workspace.app_state().clone();
+ workspace::join_remote_project(project_id, host_user_id, app_state, cx)
+ .detach_and_log_err(cx);
+ });
+ }))
+ .left_child(IconButton::new(0, Icon::Folder))
+ .child(
+ h_stack()
+ .w_full()
+ .justify_between()
+ .child(render_tree_branch(is_last, cx))
+ .child(Label::new(project_name.clone())),
+ )
+ .tooltip(move |cx| Tooltip::text(format!("Open {}", project_name), cx))
+
+ // enum JoinProject {}
+ // enum JoinProjectTooltip {}
+
+ // let collab_theme = &theme.collab_panel;
+ // let host_avatar_width = collab_theme
+ // .contact_avatar
+ // .width
+ // .or(collab_theme.contact_avatar.height)
+ // .unwrap_or(0.);
+ // let tree_branch = collab_theme.tree_branch;
+
+ // let content =
+ // MouseEventHandler::new::<JoinProject, _>(project_id as usize, cx, |mouse_state, cx| {
+ // let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
+ // let row = if is_current {
+ // collab_theme
+ // .project_row
+ // .in_state(true)
+ // .style_for(&mut Default::default())
+ // } else {
+ // collab_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, collab_theme.row_height),
+ // cx.font_cache(),
+ // ))
+ // .with_child(
+ // Svg::new("icons/file_icons/folder.svg")
+ // .with_color(collab_theme.channel_hash.color)
+ // .constrained()
+ // .with_width(collab_theme.channel_hash.width)
+ // .aligned()
+ // .left(),
+ // )
+ // .with_child(
+ // Label::new(project_name.clone(), row.name.text.clone())
+ // .aligned()
+ // .left()
+ // .contained()
+ // .with_style(row.name.container)
+ // .flex(1., false),
+ // )
+ // .constrained()
+ // .with_height(collab_theme.row_height)
+ // .contained()
+ // .with_style(row.container)
+ // });
+
+ // if is_current {
+ // return content.into_any();
+ // }
+
+ // content
+ // .with_cursor_style(CursorStyle::PointingHand)
+ // .on_click(MouseButton::Left, move |_, this, cx| {
+ // if let Some(workspace) = this.workspace.upgrade(cx) {
+ // let app_state = workspace.read(cx).app_state().clone();
+ // workspace::join_remote_project(project_id, host_user_id, app_state, cx)
+ // .detach_and_log_err(cx);
+ // }
+ // })
+ // .with_tooltip::<JoinProjectTooltip>(
+ // project_id as usize,
+ // format!("Open {}", project_name),
+ // None,
+ // theme.tooltip.clone(),
+ // cx,
+ // )
+ // .into_any()
+ }
+
+ fn render_participant_screen(
+ &self,
+ peer_id: Option<PeerId>,
+ is_last: bool,
+ cx: &mut ViewContext<Self>,
+ ) -> impl IntoElement {
+ // enum OpenSharedScreen {}
+
+ // let host_avatar_width = theme
+ // .contact_avatar
+ // .width
+ // .or(theme.contact_avatar.height)
+ // .unwrap_or(0.);
+ // let tree_branch = theme.tree_branch;
+
+ // let handler = MouseEventHandler::new::<OpenSharedScreen, _>(
+ // peer_id.map(|id| id.as_u64()).unwrap_or(0) as usize,
+ // cx,
+ // |mouse_state, 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 {
if let Some(_) = self.channel_editing_state.take() {
@@ -1463,117 +1409,114 @@ impl CollabPanel {
// .into_any()
// }
- // fn render_channel_notes(
- // &self,
- // channel_id: ChannelId,
- // theme: &theme::CollabPanel,
- // is_selected: bool,
- // ix: usize,
- // cx: &mut ViewContext<Self>,
- // ) -> AnyElement<Self> {
- // enum ChannelNotes {}
- // let host_avatar_width = theme
- // .contact_avatar
- // .width
- // .or(theme.contact_avatar.height)
- // .unwrap_or(0.);
-
- // MouseEventHandler::new::<ChannelNotes, _>(ix as usize, cx, |state, cx| {
- // let tree_branch = *theme.tree_branch.in_state(is_selected).style_for(state);
- // let row = theme.project_row.in_state(is_selected).style_for(state);
-
- // Flex::<Self>::row()
- // .with_child(render_tree_branch(
- // tree_branch,
- // &row.name.text,
- // false,
- // vec2f(host_avatar_width, theme.row_height),
- // cx.font_cache(),
- // ))
- // .with_child(
- // Svg::new("icons/file.svg")
- // .with_color(theme.channel_hash.color)
- // .constrained()
- // .with_width(theme.channel_hash.width)
- // .aligned()
- // .left(),
- // )
- // .with_child(
- // Label::new("notes", theme.channel_name.text.clone())
- // .contained()
- // .with_style(theme.channel_name.container)
- // .aligned()
- // .left()
- // .flex(1., true),
- // )
- // .constrained()
- // .with_height(theme.row_height)
- // .contained()
- // .with_style(*theme.channel_row.style_for(is_selected, state))
- // .with_padding_left(theme.channel_row.default_style().padding.left)
- // })
- // .on_click(MouseButton::Left, move |_, this, cx| {
- // this.open_channel_notes(&OpenChannelNotes { channel_id }, cx);
- // })
- // .with_cursor_style(CursorStyle::PointingHand)
- // .into_any()
- // }
+ fn render_channel_notes(
+ &self,
+ channel_id: ChannelId,
+ cx: &mut ViewContext<Self>,
+ ) -> impl IntoElement {
+ // enum ChannelNotes {}
+ // let host_avatar_width = theme
+ // .contact_avatar
+ // .width
+ // .or(theme.contact_avatar.height)
+ // .unwrap_or(0.);
+
+ // MouseEventHandler::new::<ChannelNotes, _>(ix as usize, cx, |state, cx| {
+ // let tree_branch = *theme.tree_branch.in_state(is_selected).style_for(state);
+ // let row = theme.project_row.in_state(is_selected).style_for(state);
+
+ // Flex::<Self>::row()
+ // .with_child(render_tree_branch(
+ // tree_branch,
+ // &row.name.text,
+ // false,
+ // vec2f(host_avatar_width, theme.row_height),
+ // cx.font_cache(),
+ // ))
+ // .with_child(
+ // Svg::new("icons/file.svg")
+ // .with_color(theme.channel_hash.color)
+ // .constrained()
+ // .with_width(theme.channel_hash.width)
+ // .aligned()
+ // .left(),
+ // )
+ // .with_child(
+ // Label::new("notes", theme.channel_name.text.clone())
+ // .contained()
+ // .with_style(theme.channel_name.container)
+ // .aligned()
+ // .left()
+ // .flex(1., true),
+ // )
+ // .constrained()
+ // .with_height(theme.row_height)
+ // .contained()
+ // .with_style(*theme.channel_row.style_for(is_selected, state))
+ // .with_padding_left(theme.channel_row.default_style().padding.left)
+ // })
+ // .on_click(MouseButton::Left, move |_, this, cx| {
+ // this.open_channel_notes(&OpenChannelNotes { channel_id }, cx);
+ // })
+ // .with_cursor_style(CursorStyle::PointingHand)
+ // .into_any()
- // fn render_channel_chat(
- // &self,
- // channel_id: ChannelId,
- // theme: &theme::CollabPanel,
- // is_selected: bool,
- // ix: usize,
- // cx: &mut ViewContext<Self>,
- // ) -> AnyElement<Self> {
- // enum ChannelChat {}
- // let host_avatar_width = theme
- // .contact_avatar
- // .width
- // .or(theme.contact_avatar.height)
- // .unwrap_or(0.);
-
- // MouseEventHandler::new::<ChannelChat, _>(ix as usize, cx, |state, cx| {
- // let tree_branch = *theme.tree_branch.in_state(is_selected).style_for(state);
- // let row = theme.project_row.in_state(is_selected).style_for(state);
-
- // Flex::<Self>::row()
- // .with_child(render_tree_branch(
- // tree_branch,
- // &row.name.text,
- // true,
- // vec2f(host_avatar_width, theme.row_height),
- // cx.font_cache(),
- // ))
- // .with_child(
- // Svg::new("icons/conversations.svg")
- // .with_color(theme.channel_hash.color)
- // .constrained()
- // .with_width(theme.channel_hash.width)
- // .aligned()
- // .left(),
- // )
- // .with_child(
- // Label::new("chat", theme.channel_name.text.clone())
- // .contained()
- // .with_style(theme.channel_name.container)
- // .aligned()
- // .left()
- // .flex(1., true),
- // )
- // .constrained()
- // .with_height(theme.row_height)
- // .contained()
- // .with_style(*theme.channel_row.style_for(is_selected, state))
- // .with_padding_left(theme.channel_row.default_style().padding.left)
- // })
- // .on_click(MouseButton::Left, move |_, this, cx| {
- // this.join_channel_chat(&JoinChannelChat { channel_id }, cx);
- // })
- // .with_cursor_style(CursorStyle::PointingHand)
- // .into_any()
- // }
+ div()
+ }
+
+ fn render_channel_chat(
+ &self,
+ channel_id: ChannelId,
+ cx: &mut ViewContext<Self>,
+ ) -> impl IntoElement {
+ // enum ChannelChat {}
+ // let host_avatar_width = theme
+ // .contact_avatar
+ // .width
+ // .or(theme.contact_avatar.height)
+ // .unwrap_or(0.);
+
+ // MouseEventHandler::new::<ChannelChat, _>(ix as usize, cx, |state, cx| {
+ // let tree_branch = *theme.tree_branch.in_state(is_selected).style_for(state);
+ // let row = theme.project_row.in_state(is_selected).style_for(state);
+
+ // Flex::<Self>::row()
+ // .with_child(render_tree_branch(
+ // tree_branch,
+ // &row.name.text,
+ // true,
+ // vec2f(host_avatar_width, theme.row_height),
+ // cx.font_cache(),
+ // ))
+ // .with_child(
+ // Svg::new("icons/conversations.svg")
+ // .with_color(theme.channel_hash.color)
+ // .constrained()
+ // .with_width(theme.channel_hash.width)
+ // .aligned()
+ // .left(),
+ // )
+ // .with_child(
+ // Label::new("chat", theme.channel_name.text.clone())
+ // .contained()
+ // .with_style(theme.channel_name.container)
+ // .aligned()
+ // .left()
+ // .flex(1., true),
+ // )
+ // .constrained()
+ // .with_height(theme.row_height)
+ // .contained()
+ // .with_style(*theme.channel_row.style_for(is_selected, state))
+ // .with_padding_left(theme.channel_row.default_style().padding.left)
+ // })
+ // .on_click(MouseButton::Left, move |_, this, cx| {
+ // this.join_channel_chat(&JoinChannelChat { channel_id }, cx);
+ // })
+ // .with_cursor_style(CursorStyle::PointingHand)
+ // .into_any()
+ div()
+ }
// fn render_channel_invite(
// channel: Arc<Channel>,