UI kit: one shared needs-attention mark, used by the agent chat's badge (no behaviour change) (#5424)

* UI kit: one shared needs-attention mark, used by the agent chat's badge

The agent chat's "waiting" badge becomes `ui_kit::attention_mark` (a count, or
a plain dot) in `ui_kit/attention.rs`, so other things that wait for the user
(linked designs that changed, #5354) share one mark. The count is drawn
exactly as before. No change in behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* UI kit: sort the attention re-export

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ui_kit attention mark: take the corner inset from Tokens::space_3

The inset came from the agent chat panel as plain numbers, which font_sizes_and_dense_form_metrics_come_from_tokens refuses outside theme::Tokens (review on #5424). space_3 is 3.0, so nothing moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Carel Theron <careltheron@Carels-MacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
This commit is contained in:
CarelT
2026-11-04 18:52:05 +00:00
committed by GitHub
parent 6d16fae4ed
commit 8d6c45f640
3 changed files with 32 additions and 9 deletions
+1 -9
View File
@@ -702,15 +702,7 @@ fn strip(app: &mut SolveApp, ui: &mut egui::Ui) {
ui.painter().circle_filled(pos2(r.center().x, button.bottom() + 10.0), 3.5, state_color(state));
let waiting = app.agent_chat.waiting();
if waiting > 0 {
let at = button.right_top() + vec2(-3.0, 3.0);
ui.painter().circle_filled(at, 6.5, t.warning);
ui.painter().text(
at,
Align2::CENTER_CENTER,
waiting.min(9).to_string(),
egui::FontId::proportional(crate::theme::Tokens::get().font_badge),
t.panel,
);
ui_kit::attention_mark(ui.painter(), button, Some(waiting));
}
ui.painter().line_segment(
if app.preferences.agent_chat_side == "left" { [r.right_top(), r.right_bottom()] } else { [r.left_top(), r.left_bottom()] },
+29
View File
@@ -0,0 +1,29 @@
//! One "needs attention" mark: something waits for the user (the agent chat's questions today;
//! other things that wait can use it too). A small count, or a plain dot, on the top-right
//! corner of what it belongs to.
use crate::theme::Tokens;
use egui::{Align2, Painter, Pos2, Rect, vec2};
/// Where the mark sits on `target` (a button's or icon's rect): `space_3` in from its top-right
/// corner. Tokens: space_3.
pub(crate) fn attention_at(target: Rect) -> Pos2 {
let t = Tokens::get();
target.right_top() + vec2(-t.space_3, t.space_3)
}
/// The mark on `target`: a count when there is one (at most 9 shown), else a plain dot.
/// Tokens: warning (the mark), panel (the count's ink), font_badge.
pub(crate) fn attention_mark(painter: &Painter, target: Rect, count: Option<usize>) {
let t = Tokens::get();
let at = attention_at(target);
match count {
Some(n) => {
painter.circle_filled(at, 6.5, t.warning);
painter.text(at, Align2::CENTER_CENTER, n.min(9).to_string(), egui::FontId::proportional(t.font_badge), t.panel);
}
None => {
painter.circle_filled(at, 4.0, t.warning);
painter.circle_stroke(at, 4.0, egui::Stroke::new(1.0, t.panel));
}
}
}
+2
View File
@@ -4,6 +4,7 @@
mod actions;
mod assistant;
mod assistant_entry;
mod attention;
mod checks;
mod choice;
mod color;
@@ -57,6 +58,7 @@ pub(crate) use actions::*;
pub use actions::{Button, button};
pub(crate) use assistant::*;
pub(crate) use assistant_entry::*;
pub(crate) use attention::*;
#[cfg(test)]
pub(crate) use checks::tests::{raster as raster_ui, textures_update as update_test_textures};
#[cfg(test)]