Fix microphone and speaking styles

This commit is contained in:
Mikayla Maki 2023-06-28 08:41:31 -07:00
parent c381e8821c
commit 9ab0efa1f8
No known key found for this signature in database
3 changed files with 23 additions and 10 deletions

View file

@ -668,6 +668,7 @@ impl CollabTitlebarItem {
avatar_img, avatar_img,
*avatar_style, *avatar_style,
Color::transparent_black(), Color::transparent_black(),
None
)); ));
}; };
@ -846,17 +847,20 @@ impl CollabTitlebarItem {
let leader_style = theme.titlebar.leader_avatar; let leader_style = theme.titlebar.leader_avatar;
let follower_style = theme.titlebar.follower_avatar; let follower_style = theme.titlebar.follower_avatar;
let mut background_color = if muted { let microphone_state = if muted {
gpui::color::Color::red() Some(theme.titlebar.muted)
} else if speaking { } else if speaking {
gpui::color::Color::green() Some(theme.titlebar.speaking)
} else { } else {
theme None
.titlebar
.container
.background_color
.unwrap_or_default()
}; };
let mut background_color = theme
.titlebar
.container
.background_color
.unwrap_or_default();
if let Some(replica_id) = replica_id { if let Some(replica_id) = replica_id {
if followed_by_self { if followed_by_self {
let selection = theme.editor.replica_selection_style(replica_id).selection; let selection = theme.editor.replica_selection_style(replica_id).selection;
@ -872,6 +876,7 @@ impl CollabTitlebarItem {
avatar.clone(), avatar.clone(),
Self::location_style(workspace, location, leader_style, cx), Self::location_style(workspace, location, leader_style, cx),
background_color, background_color,
microphone_state
)) ))
.with_children( .with_children(
(|| { (|| {
@ -903,6 +908,7 @@ impl CollabTitlebarItem {
avatar.clone(), avatar.clone(),
follower_style, follower_style,
background_color, background_color,
None
)) ))
})) }))
})() })()
@ -1021,12 +1027,13 @@ impl CollabTitlebarItem {
avatar: Arc<ImageData>, avatar: Arc<ImageData>,
avatar_style: AvatarStyle, avatar_style: AvatarStyle,
background_color: Color, background_color: Color,
microphone_state: Option<Color>
) -> AnyElement<V> { ) -> AnyElement<V> {
Image::from_data(avatar) Image::from_data(avatar)
.with_style(avatar_style.image) .with_style(avatar_style.image)
.aligned() .aligned()
.contained() .contained()
.with_background_color(background_color) .with_background_color(microphone_state.unwrap_or(background_color))
.with_corner_radius(avatar_style.outer_corner_radius) .with_corner_radius(avatar_style.outer_corner_radius)
.constrained() .constrained()
.with_width(avatar_style.outer_width) .with_width(avatar_style.outer_width)

View file

@ -132,6 +132,8 @@ pub struct Titlebar {
pub sign_in_button: Toggleable<Interactive<ContainedText>>, pub sign_in_button: Toggleable<Interactive<ContainedText>>,
pub outdated_warning: ContainedText, pub outdated_warning: ContainedText,
pub share_button: Toggleable<Interactive<ContainedText>>, pub share_button: Toggleable<Interactive<ContainedText>>,
pub muted: Color,
pub speaking: Color,
pub screen_share_button: Toggleable<Interactive<IconButton>>, pub screen_share_button: Toggleable<Interactive<IconButton>>,
pub toggle_contacts_button: Toggleable<Interactive<IconButton>>, pub toggle_contacts_button: Toggleable<Interactive<IconButton>>,
pub toggle_microphone_button: Toggleable<Interactive<IconButton>>, pub toggle_microphone_button: Toggleable<Interactive<IconButton>>,
@ -146,6 +148,7 @@ pub struct UserMenu {
pub user_menu_button_online: UserMenuButton, pub user_menu_button_online: UserMenuButton,
pub user_menu_button_offline: UserMenuButton, pub user_menu_button_offline: UserMenuButton,
} }
#[derive(Clone, Deserialize, Default, JsonSchema)] #[derive(Clone, Deserialize, Default, JsonSchema)]
pub struct UserMenuButton { pub struct UserMenuButton {
pub user_menu: Toggleable<Interactive<Icon>>, pub user_menu: Toggleable<Interactive<Icon>>,

View file

@ -57,6 +57,9 @@ function call_controls(theme: ColorScheme) {
}, },
active_color: 'accent' active_color: 'accent'
}), }),
muted: foreground(theme.lowest, "negative"),
speaking: foreground(theme.lowest, "accent"),
} }
} }
@ -153,7 +156,7 @@ function user_menu(theme: ColorScheme) {
} }
export function titlebar(theme: ColorScheme) { export function titlebar(theme: ColorScheme) {
const avatarWidth = 18 const avatarWidth = 15
const avatarOuterWidth = avatarWidth + 4 const avatarOuterWidth = avatarWidth + 4
const followerAvatarWidth = 14 const followerAvatarWidth = 14
const followerAvatarOuterWidth = followerAvatarWidth + 4 const followerAvatarOuterWidth = followerAvatarWidth + 4