1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! The toast stack every panel page renders, with or without the shell.
use topcoat::{
Result,
context::Cx,
view::{BoxView, ViewExt, view},
};
use crate::{
notification::{LiveToast, live_toast, live_toaster, take_notification},
panel::Panel,
};
impl Panel {
/// The toast stack, a polite live region fixed bottom-right: the flash cookie's toast beside
/// `live_toaster`, the page-owned in-place transport. It hoists, so it renders in a page body.
pub(super) async fn toaster(cx: &Cx) -> Result<BoxView<'_>> {
let notification_view: BoxView<'_> = match take_notification(cx) {
Some(notification) => {
crate::notification::render_notification(cx, notification, Default::default())
.await?
}
// No placeholder: the toaster's `<ol>` permits only `li`/`script`/`template` children.
None => ().boxed(),
};
// The page owns the live-toast signals; the same helper resolves the same handles here.
let LiveToast {
status: toast_status,
title: toast_title,
description: toast_description,
serial: toast_serial,
} = live_toast(cx);
Ok(view! {
tablo_ui::toaster(
label: crate::t!(cx, "tablo-notifications"),
(notification_view)
live_toaster(
status: $(toast_status),
title: $(toast_title),
description: $(toast_description),
serial: $(toast_serial)
)
)
}
.boxed())
}
}