feat: store toasts and alerts in the layout state #6

Closed
reya wants to merge 7 commits from root into master
Showing only changes of commit b5ce99f4e6 - Show all commits
+9 -15
View File
@@ -290,21 +290,15 @@ impl RenderOnce for Shell {
});
// Wraps the layout in a window frame
let mut shell = frame(layout, window, cx);
#[cfg(feature = "toast")]
{
let toasts = state.read(cx).toasts.clone();
shell = shell.child(ToastsView::new((id.clone(), "toasts"), toasts));
}
#[cfg(feature = "alert")]
{
let alerts = state.read(cx).alerts.clone();
shell = shell.child(AlertsView::new((id, "alerts"), alerts));
}
shell
frame(layout, window, cx)
.when(cfg!(feature = "toast"), |this| {
let toasts = state.read(cx).toasts.clone();
this.child(ToastsView::new((id.clone(), "toasts"), toasts))
})
.when(cfg!(feature = "alert"), |this| {
let alerts = state.read(cx).alerts.clone();
this.child(AlertsView::new((id, "alerts"), alerts))
})
}
}