List actions for ListDetailsEntries

This commit is contained in:
Nate Butler 2023-10-19 20:17:41 -04:00
parent 32028fbbb1
commit 0609628645
2 changed files with 19 additions and 10 deletions

View file

@ -509,13 +509,23 @@ impl<S: 'static + Send + Sync> ListDetailsEntry<S> {
.relative() .relative()
.group("") .group("")
.bg(item_bg) .bg(item_bg)
.p_1() .px_1()
.py_1_5()
.w_full() .w_full()
.line_height(relative(1.2)) .line_height(relative(1.2))
.child(Label::new(self.label.clone()).color(label_color)) .child(Label::new(self.label.clone()).color(label_color))
.when(self.meta.is_some(), |this| { .when(self.meta.is_some(), |this| {
this.child(Label::new(self.meta.clone().unwrap()).color(LabelColor::Muted)) 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),
),
)
} }
} }

View file

@ -326,12 +326,9 @@ pub fn static_players_with_call_status() -> Vec<PlayerWithCallStatus> {
pub fn static_new_notification_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> { pub fn static_new_notification_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
vec![ vec![
ListEntry::new(Label::new( ListDetailsEntry::new("maxdeviant invited you to join a stream in #design.")
"maxdeviant invited you to join a stream in #design.", .meta("4 people in stream."),
)) ListDetailsEntry::new("nathansobo accepted your contact request."),
.set_left_icon(Icon::FileLock.into()),
ListEntry::new(Label::new("nathansobo accepted your contact request."))
.set_left_icon(Icon::FileToml.into()),
] ]
.into_iter() .into_iter()
.map(From::from) .map(From::from)
@ -340,12 +337,14 @@ pub fn static_new_notification_items<S: 'static + Send + Sync + Clone>() -> Vec<
pub fn static_read_notification_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> { pub fn static_read_notification_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
vec![ vec![
ListDetailsEntry::new("mikaylamaki added you as a contact.") ListDetailsEntry::new("mikaylamaki added you as a contact.").actions(vec![
.actions(vec![Button::new("Decline"), Button::new("Accept")]), Button::new("Decline"),
Button::new("Accept").variant(crate::ButtonVariant::Filled),
]),
ListDetailsEntry::new("maxdeviant invited you to a stream in #design.") ListDetailsEntry::new("maxdeviant invited you to a stream in #design.")
.seen(true) .seen(true)
.meta("This stream has ended."), .meta("This stream has ended."),
ListDetailsEntry::new("nathansobo accepted your contact request."), ListDetailsEntry::new("as-cii accepted your contact request."),
] ]
.into_iter() .into_iter()
.map(From::from) .map(From::from)