diff --git a/crates/collab_ui2/src/notifications/incoming_call_notification.rs b/crates/collab_ui2/src/notifications/incoming_call_notification.rs index 53ff51d1cd8bd641cd46b90a508616968fa4de80..d5bdf4ff446887cd69cfe96676aec6964b9e0c24 100644 --- a/crates/collab_ui2/src/notifications/incoming_call_notification.rs +++ b/crates/collab_ui2/src/notifications/incoming_call_notification.rs @@ -2,12 +2,14 @@ use crate::notification_window_options; use call::{ActiveCall, IncomingCall}; use futures::StreamExt; use gpui::{ - div, px, red, AppContext, Div, Element, ParentElement, Render, RenderOnce, Styled, ViewContext, + img, px, AppContext, Div, ParentElement, Render, RenderOnce, Styled, ViewContext, VisualContext as _, WindowHandle, }; +use settings::Settings; use std::sync::{Arc, Weak}; +use theme::ThemeSettings; use ui::prelude::*; -use ui::{h_stack, v_stack, Avatar, Button, Label}; +use ui::{h_stack, v_stack, Button, Label}; use util::ResultExt; use workspace::AppState; @@ -112,36 +114,52 @@ impl IncomingCallNotification { state: Arc::new(IncomingCallNotificationState::new(call, app_state)), } } - fn render_caller(&self, cx: &mut ViewContext) -> impl Element { - h_stack() - .child(Avatar::new(self.state.call.calling_user.avatar_uri.clone())) - .child( - v_stack() - .child(Label::new(format!( - "{} is sharing a project in Zed", - self.state.call.calling_user.github_login - ))) - .child(self.render_buttons(cx)), - ) - } - - fn render_buttons(&self, cx: &mut ViewContext) -> impl Element { - h_stack() - .child(Button::new("accept", "Accept").render(cx).on_click({ - let state = self.state.clone(); - move |_, cx| state.respond(true, cx) - })) - .child(Button::new("decline", "Decline").render(cx).on_click({ - let state = self.state.clone(); - move |_, cx| state.respond(false, cx) - })) - } } impl Render for IncomingCallNotification { type Element = Div; fn render(&mut self, cx: &mut ViewContext) -> Self::Element { - div().bg(red()).flex_none().child(self.render_caller(cx)) + // TODO: Is there a better place for us to initialize the font? + let (ui_font, ui_font_size) = { + let theme_settings = ThemeSettings::get_global(cx); + ( + theme_settings.ui_font.family.clone(), + theme_settings.ui_font_size.clone(), + ) + }; + + cx.set_rem_size(ui_font_size); + + h_stack() + .font(ui_font) + .text_ui() + .justify_between() + .size_full() + .overflow_hidden() + .elevation_3(cx) + .p_2() + .gap_2() + .child( + img(self.state.call.calling_user.avatar_uri.clone()) + .w_12() + .h_12() + .rounded_full(), + ) + .child(v_stack().overflow_hidden().child(Label::new(format!( + "{} is sharing a project in Zed", + self.state.call.calling_user.github_login + )))) + .child( + v_stack() + .child(Button::new("accept", "Accept").render(cx).on_click({ + let state = self.state.clone(); + move |_, cx| state.respond(true, cx) + })) + .child(Button::new("decline", "Decline").render(cx).on_click({ + let state = self.state.clone(); + move |_, cx| state.respond(false, cx) + })), + ) } } diff --git a/crates/collab_ui2/src/notifications/project_shared_notification.rs b/crates/collab_ui2/src/notifications/project_shared_notification.rs index 2dc0dee6f47e8a9dfc4dcf9fef957cc75147a3d2..707e961423472ddb8b032a253bb20ff66f2adbaa 100644 --- a/crates/collab_ui2/src/notifications/project_shared_notification.rs +++ b/crates/collab_ui2/src/notifications/project_shared_notification.rs @@ -23,7 +23,7 @@ pub fn init(app_state: &Arc, cx: &mut AppContext) { } => { let window_size = Size { width: px(400.), - height: px(96.), + height: px(72.), }; for screen in cx.displays() { @@ -139,35 +139,33 @@ impl Render for ProjectSharedNotification { .text_ui() .justify_between() .size_full() + .overflow_hidden() .elevation_3(cx) .p_2() .gap_2() .child( - h_stack() - .gap_2() - .child( - img(self.owner.avatar_uri.clone()) - .w_16() - .h_16() - .rounded_full(), - ) - .child( - v_stack() - .child(Label::new(self.owner.github_login.clone())) - .child(Label::new(format!( - "is sharing a project in Zed{}", - if self.worktree_root_names.is_empty() { - "" - } else { - ":" - } - ))) - .children(if self.worktree_root_names.is_empty() { - None - } else { - Some(Label::new(self.worktree_root_names.join(", "))) - }), - ), + img(self.owner.avatar_uri.clone()) + .w_12() + .h_12() + .rounded_full(), + ) + .child( + v_stack() + .overflow_hidden() + .child(Label::new(self.owner.github_login.clone())) + .child(Label::new(format!( + "is sharing a project in Zed{}", + if self.worktree_root_names.is_empty() { + "" + } else { + ":" + } + ))) + .children(if self.worktree_root_names.is_empty() { + None + } else { + Some(Label::new(self.worktree_root_names.join(", "))) + }), ) .child( v_stack()