An AI agent built to do Ralph loops - plan mode for planning and ralph mode for implementing.
at main 53 lines 1.7 kB view raw
1use ratatui::{ 2 Frame, 3 layout::{Constraint, Direction, Layout}, 4 style::{Color, Style}, 5 text::{Line, Span}, 6 widgets::Paragraph, 7}; 8 9use crate::tui::views::{draw_dashboard, draw_execution, draw_planning}; 10use crate::tui::widgets::{TabBar, draw_help, draw_side_panel}; 11use crate::tui::{ActiveTab, App}; 12 13pub fn draw(frame: &mut Frame, app: &mut App) { 14 let chunks = Layout::default() 15 .direction(Direction::Vertical) 16 .constraints([ 17 Constraint::Length(1), // Tab bar 18 Constraint::Min(0), // Main content 19 Constraint::Length(1), // Status bar 20 ]) 21 .split(frame.area()); 22 23 // Tab bar 24 frame.render_widget(TabBar::new(app.active_tab), chunks[0]); 25 26 // Main content area 27 match app.active_tab { 28 ActiveTab::Dashboard => { 29 draw_dashboard(frame, chunks[1], &app.dashboard); 30 } 31 ActiveTab::Planning => { 32 draw_planning(frame, chunks[1], &mut app.planning, app.spinner.current()); 33 } 34 ActiveTab::Execution => { 35 draw_execution(frame, chunks[1], &mut app.execution, app.spinner.current()); 36 } 37 } 38 39 // Side panel (rendered on top of main content) 40 draw_side_panel(frame, chunks[1], &app.side_panel); 41 42 // Help overlay (rendered on top of everything) 43 if app.help.visible { 44 draw_help(frame, frame.area()); 45 } 46 47 // Status bar 48 let status = Line::from(vec![Span::raw( 49 " q quit │ 1/2/3 switch tabs │ Tab cycle │ ? help ", 50 )]); 51 let status_bar = Paragraph::new(status).style(Style::default().bg(Color::DarkGray)); 52 frame.render_widget(status_bar, chunks[2]); 53}