facett-toast — design note
Status: builds (egui 0.33) + 3 tests green. In ordning/crates/widgets/facett-toast; destined for facett.
What it is
A toast/snackbar overlay: timed notifications (assignment, @mention, SLA breach) stacked top-right and auto-dismissed. Levels Info/Success/Warn/Error (colored). A toast may link a case (click → navigate).
API
let mut toasts = Toasts::new();
toasts.push("Assigned to you", Level::Info, 4.0);
toasts.push_case("SLA breach on BL-12", Level::Error, 8.0, Some("BL-12".into()));
// each frame:
toasts.tick(dt_seconds); // host supplies the delta — widget never reads the clock
toasts.ui(ctx); // paints an Area overlay (uses Context, not Ui)
if let Some(case) = toasts.take_clicked_case() { /* navigate */ }
Design decisions
- Host-driven time (
tick(dt)) → deterministic + testable; no clock reads. - Policy is the host's — the digest/quiet-hours rules (manual ch.09) decide whether to push a toast; this widget only renders what it's given. Keeps the policy testable separately from the UI.
- Uses an egui
Areaanchored RIGHT_TOP so it floats over whatever facet is showing. state_jsonexposes the live toasts (id/text/level/remaining/case).
TODO on move
- Theme colors from
facett_core::theme(); slide-in/out animation; max-stack with "+N more".