Merge branch 'main' into cursors

This commit is contained in:
Conrad Irwin 2024-01-18 14:03:27 -07:00
commit bfee008bb2
199 changed files with 3365 additions and 1735 deletions

View file

@ -125,6 +125,23 @@ impl ChatPanel {
open_context_menu: None,
};
if let Some(channel_id) = ActiveCall::global(cx)
.read(cx)
.room()
.and_then(|room| room.read(cx).channel_id())
{
this.select_channel(channel_id, None, cx)
.detach_and_log_err(cx);
if ActiveCall::global(cx)
.read(cx)
.room()
.is_some_and(|room| room.read(cx).contains_guests())
{
cx.emit(PanelEvent::Activate)
}
}
this.subscriptions.push(cx.subscribe(
&ActiveCall::global(cx),
move |this: &mut Self, call, event: &room::Event, cx| match event {

View file

@ -2314,7 +2314,7 @@ impl CollabPanel {
.child(
IconButton::new("channel_chat", IconName::MessageBubbles)
.style(ButtonStyle::Filled)
.size(ButtonSize::Compact)
.shape(ui::IconButtonShape::Square)
.icon_size(IconSize::Small)
.icon_color(if has_messages_notification {
Color::Default
@ -2332,7 +2332,7 @@ impl CollabPanel {
.child(
IconButton::new("channel_notes", IconName::File)
.style(ButtonStyle::Filled)
.size(ButtonSize::Compact)
.shape(ui::IconButtonShape::Square)
.icon_size(IconSize::Small)
.icon_color(if has_notes_notification {
Color::Default

View file

@ -111,7 +111,7 @@ impl ChannelModal {
.detach();
}
fn set_channel_visiblity(&mut self, selection: &Selection, cx: &mut ViewContext<Self>) {
fn set_channel_visibility(&mut self, selection: &Selection, cx: &mut ViewContext<Self>) {
self.channel_store.update(cx, |channel_store, cx| {
channel_store
.set_channel_visibility(
@ -189,7 +189,7 @@ impl Render for ChannelModal {
ui::Selection::Unselected
},
)
.on_click(cx.listener(Self::set_channel_visiblity)),
.on_click(cx.listener(Self::set_channel_visibility)),
)
.child(Label::new("Public").size(LabelSize::Small)),
)

View file

@ -3,7 +3,7 @@ use auto_update::AutoUpdateStatus;
use call::{ActiveCall, ParticipantLocation, Room};
use client::{proto::PeerId, Client, User, UserStore};
use gpui::{
actions, canvas, div, point, px, rems, Action, AnyElement, AppContext, Element, Hsla,
actions, canvas, div, point, px, Action, AnyElement, AppContext, Element, Hsla,
InteractiveElement, IntoElement, Model, ParentElement, Path, Render,
StatefulInteractiveElement, Styled, Subscription, View, ViewContext, VisualContext, WeakView,
WindowBounds,
@ -19,7 +19,7 @@ use ui::{
};
use util::ResultExt;
use vcs_menu::{build_branch_list, BranchList, OpenRecent as ToggleVcsMenu};
use workspace::{notifications::NotifyResultExt, Workspace};
use workspace::{notifications::NotifyResultExt, titlebar_height, Workspace};
const MAX_PROJECT_NAME_LENGTH: usize = 40;
const MAX_BRANCH_NAME_LENGTH: usize = 40;
@ -62,10 +62,7 @@ impl Render for CollabTitlebarItem {
.id("titlebar")
.justify_between()
.w_full()
.h(rems(1.75))
// Set a non-scaling min-height here to ensure the titlebar is
// always at least the height of the traffic lights.
.min_h(px(32.))
.h(titlebar_height(cx))
.map(|this| {
if matches!(cx.window_bounds(), WindowBounds::Fullscreen) {
this.pl_2()
@ -480,14 +477,16 @@ impl CollabTitlebarItem {
return None;
}
const FACEPILE_LIMIT: usize = 3;
let followers = project_id.map_or(&[] as &[_], |id| room.followers_for(peer_id, id));
let extra_count = followers.len().saturating_sub(FACEPILE_LIMIT);
let pile = FacePile::default()
.child(
Avatar::new(user.avatar_uri.clone())
.grayscale(!is_present)
.border_color(if is_speaking {
cx.theme().status().info_border
cx.theme().status().info
} else {
// We draw the border in a transparent color rather to avoid
// the layout shift that would come with adding/removing the border.
@ -502,18 +501,34 @@ impl CollabTitlebarItem {
)
}),
)
.children(followers.iter().filter_map(|follower_peer_id| {
let follower = room
.remote_participants()
.values()
.find_map(|p| (p.peer_id == *follower_peer_id).then_some(&p.user))
.or_else(|| {
(self.client.peer_id() == Some(*follower_peer_id)).then_some(current_user)
})?
.clone();
.children(
followers
.iter()
.take(FACEPILE_LIMIT)
.filter_map(|follower_peer_id| {
let follower = room
.remote_participants()
.values()
.find_map(|p| (p.peer_id == *follower_peer_id).then_some(&p.user))
.or_else(|| {
(self.client.peer_id() == Some(*follower_peer_id))
.then_some(current_user)
})?
.clone();
Some(Avatar::new(follower.avatar_uri.clone()))
}));
Some(Avatar::new(follower.avatar_uri.clone()))
}),
)
.children(if extra_count > 0 {
Some(
div()
.ml_1()
.child(Label::new(format!("+{extra_count}")))
.into_any_element(),
)
} else {
None
});
Some(pile)
}