codetether_agent/tui/ui/webview/
layout.rs1use ratatui::layout::{Constraint, Direction, Layout, Rect};
2
3use super::layout_mode::ChatLayoutMode;
4
5pub fn webview_main_chunks(area: Rect) -> Vec<Rect> {
7 Layout::default()
8 .direction(Direction::Vertical)
9 .constraints([
10 Constraint::Length(3),
11 Constraint::Min(1),
12 Constraint::Length(3),
13 Constraint::Length(1),
14 ])
15 .split(area)
16 .to_vec()
17}
18
19pub fn webview_body_chunks(area: Rect, show_inspector: bool) -> Vec<Rect> {
21 let cs = if show_inspector {
22 vec![
23 Constraint::Length(26),
24 Constraint::Min(40),
25 Constraint::Length(30),
26 ]
27 } else {
28 vec![Constraint::Length(26), Constraint::Min(40)]
29 };
30 Layout::default()
31 .direction(Direction::Horizontal)
32 .constraints(cs)
33 .split(area)
34 .to_vec()
35}
36
37pub fn is_webview(mode: ChatLayoutMode) -> bool {
38 mode == ChatLayoutMode::Webview
39}