Implement chat and markdown views, enhance status bar, and add workflow panel
- Added `chat.rs` for rendering chat messages with timestamps and roles. - Introduced `markdown.rs` for rendering markdown content with styling. - Created `status.rs` to display the application status bar with session and message counts. - Developed `workflow.rs` to show the current workflow status, including tool calls and active jobs. - Established a `theme.rs` for centralized color management across the UI. - Updated `mod.rs` to include new modules and manage rendering logic.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::style::{Style, Modifier};
|
||||
use ratatui::text::{Line, Span};
|
||||
use ratatui::widgets::Block;
|
||||
use ratatui::Frame;
|
||||
use super::theme::Theme;
|
||||
|
||||
pub fn draw_status_bar(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
|
||||
let mode_str = state.mode.name();
|
||||
let mode_color = match state.mode {
|
||||
crate::app::state::types::AgentMode::Auto => Theme::MODE_AUTO,
|
||||
crate::app::state::types::AgentMode::Normal => Theme::MODE_NORMAL,
|
||||
crate::app::state::types::AgentMode::Plan => Theme::MODE_PLAN,
|
||||
crate::app::state::types::AgentMode::Yolo => Theme::MODE_YOLO,
|
||||
};
|
||||
|
||||
let mode_indicator = if state.mode.auto_approve() {
|
||||
"AUTO-APPROVE (UNRESTRICTED)".to_string()
|
||||
} else {
|
||||
format!("{}-APPROVE (RESTRICTED)", mode_str.to_uppercase())
|
||||
};
|
||||
|
||||
let session_count = state.sessions.len();
|
||||
let msg_count = state.transcript_cache.messages.len();
|
||||
|
||||
let left_text = Span::styled(
|
||||
" [zesdex] ",
|
||||
Style::default()
|
||||
.fg(Theme::TEXT)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
);
|
||||
|
||||
let center_text = Span::styled(
|
||||
format!(" | STATUS: {} | PROTOCOL: ZERO-STUBS ACTIVE ", mode_indicator),
|
||||
Style::default().fg(mode_color),
|
||||
);
|
||||
|
||||
let right_text = Span::styled(
|
||||
format!(" | MSG: {} | SESS: {} ", msg_count, session_count),
|
||||
Style::default().fg(Theme::DIM),
|
||||
);
|
||||
|
||||
let line = Line::from(vec![left_text, center_text, right_text]);
|
||||
|
||||
let block = Block::default()
|
||||
.style(
|
||||
Style::default()
|
||||
.bg(Theme::STATUS_BAR_BG)
|
||||
.fg(Theme::TEXT),
|
||||
);
|
||||
|
||||
let paragraph = ratatui::widgets::Paragraph::new(line).block(block);
|
||||
frame.render_widget(paragraph, area);
|
||||
}
|
||||
Reference in New Issue
Block a user