From 83c1bb07bbb1824419fa3428279558ee8ea77c6c Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 12 Jun 2023 19:55:52 +0200 Subject: [PATCH] Add background to user avatar --- crates/collab_ui/src/collab_titlebar_item.rs | 27 +++++++++++--------- crates/zed/src/zed.rs | 5 ++-- styles/src/styleTree/workspace.ts | 4 +++ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index 54caf9b26f3be9e741b4514a912fb8faed0d7c31..de4bb3e1b5f268d4dc0a0fcb10ceb1fb55e2403b 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -495,27 +495,30 @@ impl CollabTitlebarItem { cx: &mut ViewContext, ) -> AnyElement { let titlebar = &theme.workspace.titlebar; - let avatar_style = &theme.workspace.titlebar.leader_avatar; + let avatar_style = &theme.workspace.titlebar.follower_avatar; + let active = self.user_menu.read(cx).visible(); Stack::new() .with_child( MouseEventHandler::::new(0, cx, |state, _| { - let style = titlebar.call_control.style_for(state, false); + let style = titlebar.call_control.style_for(state, active); - if let Some(avatar_img) = avatar { + let img = if let Some(avatar_img) = avatar { Self::render_face(avatar_img, *avatar_style, Color::transparent_black()) } else { Svg::new("icons/ellipsis_14.svg") .with_color(style.color) - .constrained() - .with_width(style.icon_width) - .aligned() - .constrained() - .with_width(style.button_width) - .with_height(style.button_width) - .contained() - .with_style(style.container) .into_any() - } + }; + + img.constrained() + .with_width(style.icon_width) + .aligned() + .constrained() + .with_width(style.button_width) + .with_height(style.button_width) + .contained() + .with_style(style.container) + .into_any() }) .with_cursor_style(CursorStyle::PointingHand) .on_click(MouseButton::Left, move |_, this, cx| { diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 9f3b1457937ec80d74b9b4d7dd24dd8dd02870e3..8dbc81f62f5ffb3e49ad4adf72a9d3edec908f03 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -20,7 +20,6 @@ use feedback::{ }; use futures::{channel::mpsc, StreamExt}; use gpui::{ - actions, anyhow::{self, Result}, geometry::vector::vec2f, impl_actions, @@ -715,8 +714,8 @@ mod tests { use editor::{scroll::autoscroll::Autoscroll, DisplayPoint, Editor}; use fs::{FakeFs, Fs}; use gpui::{ - elements::Empty, executor::Deterministic, Action, AnyElement, AppContext, AssetSource, - Element, Entity, TestAppContext, View, ViewHandle, + actions, elements::Empty, executor::Deterministic, Action, AnyElement, AppContext, + AssetSource, Element, Entity, TestAppContext, View, ViewHandle, }; use language::LanguageRegistry; use node_runtime::NodeRuntime; diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index bf0c5d3af34824fcb617169790b622b95655afe2..15bcbcc27c33693b0fb808d19732bbe85b42ed8d 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -270,6 +270,10 @@ export default function workspace(colorScheme: ColorScheme) { background: background(layer, "variant", "hovered"), color: foreground(layer, "variant", "hovered"), }, + active: { + background: background(layer, "variant", "active"), + color: foreground(layer, "variant", "active"), + }, }, toggleContactsButton: { margin: { left: itemSpacing },