Show badge when there are pending contact requests

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-05-11 17:39:03 +02:00
parent c71b264786
commit 933a1f2cd6
17 changed files with 241 additions and 42 deletions

View file

@ -10,14 +10,14 @@ use gpui::{
geometry::{rect::RectF, vector::vec2f},
impl_actions,
platform::CursorStyle,
Element, ElementBox, Entity, LayoutContext, ModelHandle, MutableAppContext, RenderContext,
Subscription, View, ViewContext, ViewHandle, WeakViewHandle,
AppContext, Element, ElementBox, Entity, LayoutContext, ModelHandle, MutableAppContext,
RenderContext, Subscription, View, ViewContext, ViewHandle, WeakViewHandle,
};
use serde::Deserialize;
use settings::Settings;
use std::sync::Arc;
use theme::IconButton;
use workspace::{AppState, JoinProject, Workspace};
use workspace::{sidebar::SidebarItem, AppState, JoinProject, Workspace};
impl_actions!(
contacts_panel,
@ -599,6 +599,16 @@ impl ContactsPanel {
}
}
impl SidebarItem for ContactsPanel {
fn should_show_badge(&self, cx: &AppContext) -> bool {
!self
.user_store
.read(cx)
.incoming_contact_requests()
.is_empty()
}
}
fn render_icon_button(style: &IconButton, svg_path: &'static str) -> impl Element {
Svg::new(svg_path)
.with_color(style.color)