feat(ui-gpui): add pulsing dot via GPUI async runtime (entity-scoped repaint)

This commit is contained in:
Hibryda 2026-03-19 07:51:25 +01:00
parent 3e6307ffd0
commit 57e0e3a087
3 changed files with 116 additions and 2 deletions

View file

@ -10,6 +10,7 @@ use gpui::*;
use crate::state::{AgentStatus, Project, ProjectTab};
use crate::theme;
use crate::components::pulsing_dot::{PulsingDot, DotStatus};
// ── Accent Colors by Index ──────────────────────────────────────────
@ -71,6 +72,8 @@ pub struct ProjectBox {
pub agent_pane: Option<Entity<crate::components::agent_pane::AgentPane>>,
/// Entity handle for the embedded terminal (Model tab)
pub terminal_view: Option<Entity<crate::terminal::renderer::TerminalView>>,
/// Animated status dot
pub status_dot: Option<Entity<PulsingDot>>,
}
impl ProjectBox {
@ -79,11 +82,26 @@ impl ProjectBox {
project,
agent_pane: None,
terminal_view: None,
status_dot: None,
}
}
/// Initialize sub-views. Must be called after the ProjectBox entity is created.
pub fn init_subviews(&mut self, cx: &mut Context<Self>) {
// Create pulsing status dot
let dot_status = match self.project.agent.status {
AgentStatus::Running => DotStatus::Running,
AgentStatus::Idle => DotStatus::Idle,
AgentStatus::Done => DotStatus::Done,
AgentStatus::Error => DotStatus::Error,
};
let status_dot = cx.new(|cx: &mut Context<PulsingDot>| {
let dot = PulsingDot::new(dot_status, 8.0);
dot.start_animation(cx);
dot
});
self.status_dot = Some(status_dot);
// Create agent pane with demo messages
let agent_pane = cx.new(|_cx| {
crate::components::agent_pane::AgentPane::with_demo_messages()
@ -234,8 +252,8 @@ impl Render for ProjectBox {
.rounded(px(2.0))
.bg(accent),
)
// Status dot
.child(project_status_dot(status))
// Animated status dot
.children(self.status_dot.clone())
// Project name
.child(
div()