diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-26 17:10:28 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-26 17:10:28 +0300 |
| commit | 3750e0bae21c54da3947d337584f180a21d0bc67 (patch) | |
| tree | 4542d8af76b4fee0c428ca5e9378a06946ef62ca /src/ui/sidebar.rs | |
| parent | 1b980eaa9d4cbc050b6b81525e4b6b72ae853be5 (diff) | |
feat: add pane metadata reporting
refs #36
Diffstat (limited to 'src/ui/sidebar.rs')
| -rw-r--r-- | src/ui/sidebar.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ui/sidebar.rs b/src/ui/sidebar.rs index 1e932503..4c68aeb4 100644 --- a/src/ui/sidebar.rs +++ b/src/ui/sidebar.rs @@ -26,6 +26,7 @@ pub(crate) struct AgentPanelEntry { pub state: AgentState, pub seen: bool, pub custom_status: Option<String>, + pub state_labels: std::collections::HashMap<String, String>, } fn sidebar_section_heights(total_h: u16, split_ratio: f32) -> (u16, u16) { @@ -153,6 +154,7 @@ fn agent_panel_entries_with_runtimes( state: detail.state, seen: detail.seen, custom_status: detail.custom_status, + state_labels: detail.state_labels, }) .collect() } @@ -175,12 +177,23 @@ fn agent_panel_entries_with_runtimes( state: detail.state, seen: detail.seen, custom_status: detail.custom_status, + state_labels: detail.state_labels, }) }) .collect(), } } +pub(super) fn agent_panel_status_key(state: AgentState, seen: bool) -> &'static str { + match (state, seen) { + (AgentState::Idle, false) => "done", + (AgentState::Idle, true) => "idle", + (AgentState::Working, _) => "working", + (AgentState::Blocked, _) => "blocked", + (AgentState::Unknown, _) => "unknown", + } +} + fn truncate_text(text: &str, max_width: usize) -> String { let len = text.chars().count(); if len <= max_width { @@ -1090,7 +1103,11 @@ fn render_agent_detail( let (icon, icon_style) = agent_icon(detail.state, detail.seen, app.spinner_tick, p); let label_color = state_label_color(detail.state, detail.seen, p); - let label = state_label(detail.state, detail.seen); + let label = detail + .state_labels + .get(agent_panel_status_key(detail.state, detail.seen)) + .map(String::as_str) + .unwrap_or_else(|| state_label(detail.state, detail.seen)); let row_style = if is_active { Style::default().bg(p.surface_dim) @@ -1334,6 +1351,7 @@ mod tests { state: AgentState::Idle, seen: true, custom_status: None, + state_labels: std::collections::HashMap::new(), }; let label = format_agent_panel_primary_label(&entry, 18); |
