Fix borked layout

This commit is contained in:
Julia 2023-12-12 17:22:49 -05:00
parent 01d4e711d8
commit 51ceb52931

View file

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