crates/collab_ui2/src/notification_panel.rs 🔗
@@ -231,77 +231,66 @@ impl NotificationPanel {
Some(
div()
+ .id(ix)
.child(
- ButtonLike::new(ix)
+ h_stack()
+ .children(actor.map(|actor| Avatar::new(actor.avatar_uri.clone())))
.child(
- h_stack()
- .children(actor.map(|actor| Avatar::new(actor.avatar_uri.clone())))
- .child(
- v_stack().child(Label::new(text)).child(
- h_stack()
- .child(Label::new(format_timestamp(
- timestamp,
- now,
- self.local_timezone,
- )))
- .children(if let Some(is_accepted) = response {
- Some(div().child(Label::new(if is_accepted {
- "You accepted"
- } else {
- "You declined"
- })))
- } else if needs_response {
- Some(
- h_stack()
- .child(
- Button::new("decline", "Decline")
- .on_click({
- let notification =
- notification.clone();
- let view = cx.view().clone();
- move |_, cx| {
- view.update(cx, |this, cx| {
+ v_stack().child(Label::new(text)).child(
+ h_stack()
+ .child(Label::new(format_timestamp(
+ timestamp,
+ now,
+ self.local_timezone,
+ )))
+ .children(if let Some(is_accepted) = response {
+ Some(div().child(Label::new(if is_accepted {
+ "You accepted"
+ } else {
+ "You declined"
+ })))
+ } else if needs_response {
+ Some(
+ h_stack()
+ .child(Button::new("decline", "Decline").on_click(
+ {
+ let notification = notification.clone();
+ let view = cx.view().clone();
+ move |_, cx| {
+ view.update(cx, |this, cx| {
this.respond_to_notification(
notification.clone(),
false,
cx,
)
});
- }
- }),
- )
- .child(
- Button::new("accept", "Accept")
- .on_click({
- let notification =
- notification.clone();
- let view = cx.view().clone();
- move |_, cx| {
- view.update(cx, |this, cx| {
+ }
+ },
+ ))
+ .child(Button::new("accept", "Accept").on_click({
+ let notification = notification.clone();
+ let view = cx.view().clone();
+ move |_, cx| {
+ view.update(cx, |this, cx| {
this.respond_to_notification(
notification.clone(),
true,
cx,
)
});
- }
- }),
- ),
- )
- } else {
- None
- }),
- ),
- ),
- )
- .disabled(!can_navigate)
- .on_click({
- let notification = notification.clone();
- cx.listener(move |this, _, cx| {
- this.did_click_notification(¬ification, cx)
- })
- }),
+ }
+ })),
+ )
+ } else {
+ None
+ }),
+ ),
+ ),
)
+ .on_click({
+ let notification = notification.clone();
+ cx.listener(move |this, _, cx| this.did_click_notification(¬ification, cx))
+ })
.into_any(),
)
}