From 0609628645e50d9080c3317c6941a22b8430a13f Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 19 Oct 2023 20:17:41 -0400 Subject: [PATCH] List actions for ListDetailsEntries --- crates/ui2/src/components/list.rs | 12 +++++++++++- crates/ui2/src/static_data.rs | 17 ++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rs index f17480714b..e2c30b6bfa 100644 --- a/crates/ui2/src/components/list.rs +++ b/crates/ui2/src/components/list.rs @@ -509,13 +509,23 @@ impl ListDetailsEntry { .relative() .group("") .bg(item_bg) - .p_1() + .px_1() + .py_1_5() .w_full() .line_height(relative(1.2)) .child(Label::new(self.label.clone()).color(label_color)) .when(self.meta.is_some(), |this| { this.child(Label::new(self.meta.clone().unwrap()).color(LabelColor::Muted)) }) + .child( + h_stack().gap_1().justify_end().children( + self.actions + .take() + .unwrap_or_default() + .into_iter() + .map(|action| action), + ), + ) } } diff --git a/crates/ui2/src/static_data.rs b/crates/ui2/src/static_data.rs index 9cc7396248..3eb6fa88fb 100644 --- a/crates/ui2/src/static_data.rs +++ b/crates/ui2/src/static_data.rs @@ -326,12 +326,9 @@ pub fn static_players_with_call_status() -> Vec { pub fn static_new_notification_items() -> Vec> { vec![ - ListEntry::new(Label::new( - "maxdeviant invited you to join a stream in #design.", - )) - .set_left_icon(Icon::FileLock.into()), - ListEntry::new(Label::new("nathansobo accepted your contact request.")) - .set_left_icon(Icon::FileToml.into()), + ListDetailsEntry::new("maxdeviant invited you to join a stream in #design.") + .meta("4 people in stream."), + ListDetailsEntry::new("nathansobo accepted your contact request."), ] .into_iter() .map(From::from) @@ -340,12 +337,14 @@ pub fn static_new_notification_items() -> Vec< pub fn static_read_notification_items() -> Vec> { vec![ - ListDetailsEntry::new("mikaylamaki added you as a contact.") - .actions(vec![Button::new("Decline"), Button::new("Accept")]), + ListDetailsEntry::new("mikaylamaki added you as a contact.").actions(vec![ + Button::new("Decline"), + Button::new("Accept").variant(crate::ButtonVariant::Filled), + ]), ListDetailsEntry::new("maxdeviant invited you to a stream in #design.") .seen(true) .meta("This stream has ended."), - ListDetailsEntry::new("nathansobo accepted your contact request."), + ListDetailsEntry::new("as-cii accepted your contact request."), ] .into_iter() .map(From::from)