diff --git a/crates/ui2/src/components/notification.rs b/crates/ui2/src/components/notification.rs index b4f6b10d285662eab6787920d44f35fdb08ddf57..a934262d19b6ec017bcc69bc7cd15ff7399b17f2 100644 --- a/crates/ui2/src/components/notification.rs +++ b/crates/ui2/src/components/notification.rs @@ -1,7 +1,9 @@ -use gpui3::{div, Element, ParentElement, StyleHelpers, ViewContext}; +use std::marker::PhantomData; + +use gpui3::{Element, ParentElement, StyleHelpers, ViewContext}; use crate::{ - h_stack, v_stack, Button, Icon, IconButton, IconElement, Label, ThemeColor, Toast, ToastOrigin, + h_stack, v_stack, Icon, IconButton, IconElement, Label, ThemeColor, Toast, ToastOrigin, }; /// Notification toasts are used to display a message @@ -9,26 +11,27 @@ use crate::{ /// /// To simply convey information, use a Status. pub struct NotificationToast { + state_type: PhantomData, left_icon: Option, title: String, message: String, - primary_action: Button, - secondary_action: Option>, + // primary_action: Button, + // secondary_action: Option>, } impl NotificationToast { pub fn new( title: impl Into, message: impl Into, - actions: Vec>, - primary_action: Button, + // primary_action: Button, ) -> Self { Self { + state_type: PhantomData, left_icon: None, title: title.into(), message: message.into(), - primary_action, - secondary_action: None, + // primary_action, + // secondary_action: None, } } @@ -37,10 +40,10 @@ impl NotificationToast { self } - pub fn set_secondary_action(mut self, action: Button) -> Self { - self.secondary_action = Some(action); - self - } + // pub fn set_secondary_action(mut self, action: Button) -> Self { + // self.secondary_action = Some(action); + // self + // } fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { let color = ThemeColor::new(cx); @@ -80,6 +83,6 @@ impl NotificationToast { ), ); - Toast::new(ToastOrigin::BottomRight) + Toast::new(ToastOrigin::BottomRight).child(notification) } } diff --git a/crates/ui2/src/components/notification_project_share.rs b/crates/ui2/src/components/notification_project_share.rs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/crates/ui2/src/components/workspace.rs b/crates/ui2/src/components/workspace.rs index 6faaa164d75dc655cf0911fe276a490676c406b5..9cdbb4683f8342c6f4aedee5136433c86cbac1d5 100644 --- a/crates/ui2/src/components/workspace.rs +++ b/crates/ui2/src/components/workspace.rs @@ -1,13 +1,13 @@ use chrono::DateTime; use gpui3::{px, relative, rems, view, Context, Size, View}; -use crate::prelude::*; use crate::{ hello_world_rust_editor_with_status_example, random_players_with_call_status, theme, v_stack, AssistantPanel, ChatMessage, ChatPanel, CollabPanel, EditorPane, Label, LanguageSelector, Livestream, Pane, PaneGroup, Panel, PanelAllowedSides, PanelSide, ProjectPanel, SplitDirection, StatusBar, Terminal, TitleBar, Toast, ToastOrigin, }; +use crate::{prelude::*, NotificationToast}; #[derive(Clone)] pub struct Workspace { @@ -266,7 +266,11 @@ impl Workspace { .filter(|_| self.is_language_selector_open()), ) .child(Toast::new(ToastOrigin::Bottom).child(Label::new("A toast"))) - .child(Toast::new(ToastOrigin::BottomRight).child(Label::new("Another toast"))) + // .child(Toast::new(ToastOrigin::BottomRight).child(Label::new("Another toast"))) + .child(NotificationToast::new( + "A notification", + "This is a notification", + )) } }