use crate::ui::{Model, theme};
pub fn waiting(model: &Model) -> u64 {
model
.folded()
.iter()
.filter(|server| !matches!(server.held(), crate::ui::Held::Unheld(_)))
.flat_map(crate::ui::model::Server::workspaces)
.map(|workspace| workspace.attention)
.sum()
}
pub const WAITING_HELP: &str = "opens the queue of every conversation that is asking";
pub fn door(ui: &mut egui::Ui, model: &Model) -> bool {
let asking = waiting(model);
if asking == 0 {
return false;
}
let ink = theme::accent(theme::State::Attention);
let seat = theme::paint::link(ui, &format!("{asking} waiting"), ink, WAITING_HELP);
crate::ui::act::tag(&seat, &[crate::verbs::ATTENTION.word]);
seat.clicked()
}