| 23 | const ART: &str = include_str!("ascii_dancer.txt"); |
| 24 | |
| 25 | fn draw(frame: &mut Frame, elapsed: Duration, status: &str) { |
| 26 | let area = frame.area(); |
| 27 | let rows = Layout::vertical([ |
| 28 | Constraint::Length(3), |
| 29 | Constraint::Min(1), |
| 30 | Constraint::Length(3), |
| 31 | ]) |
| 32 | .split(area); |
| 33 | frame.render_widget( |
| 34 | Paragraph::new(format!( |
| 35 | "Agent mode / importing {:.1}s", |
| 36 | elapsed.as_secs_f64() |
| 37 | )) |
| 38 | .centered() |
| 39 | .block( |
| 40 | Block::bordered() |
| 41 | .title(" ATOMIC / AGENT MODE ") |
| 42 | .border_style(Style::default().fg(Color::Cyan)), |
| 43 | ), |
| 44 | rows[0], |
| 45 | ); |
| 46 | dance(frame, rows[1], elapsed); |
| 47 | frame.render_widget( |
| 48 | Paragraph::new(if status.is_empty() { |
| 49 | "Import is running. Keep dancing..." |
| 50 | } else { |
| 51 | status |
| 52 | }) |
| 53 | .wrap(Wrap { trim: true }) |
| 54 | .style(Style::default().fg(Color::Gray)) |
| 55 | .block( |
| 56 | Block::bordered() |
| 57 | .title(" Import status ") |
| 58 | .border_style(Style::default().fg(Color::DarkGray)), |
| 59 | ), |
| 60 | rows[2], |
| 61 | ); |
| 62 | } |
| 63 | |
| 64 | fn dance(frame: &mut Frame, area: Rect, elapsed: Duration) { |
| 65 | if area.width < 4 || area.height < 3 { |