Skip to content

Commit 643c0c2

Browse files
committed
BAT-6 Refactor footer layout in board.rs for improved rendering order
This commit modifies the layout handling in the `draw` function of `board.rs` by changing the order of the footer components. The input area is now rendered before the status and hint areas, enhancing the clarity of the UI structure. Additionally, a documentation comment has been added to clarify the purpose of the `split_footer` function.
1 parent 7fb0911 commit 643c0c2

1 file changed

Lines changed: 19 additions & 18 deletions

File tree

src/ui/board.rs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fn split_main(area: Rect) -> (Rect, Rect, Rect) {
2222
(rows[0], rows[1], rows[2])
2323
}
2424

25+
/// Footer: command row (top), status (middle), keys hint (bottom).
2526
fn split_footer(footer: Rect) -> (Rect, Rect, Rect) {
2627
let chunks = Layout::default()
2728
.direction(Direction::Vertical)
@@ -48,7 +49,7 @@ pub fn command_cursor_position(term_area: Rect, app: &App) -> Option<(u16, u16)>
4849
return None;
4950
}
5051
let (_, _, footer) = split_main(term_area);
51-
let (_, _, input_outer) = split_footer(footer);
52+
let (input_outer, _, _) = split_footer(footer);
5253
let block = Block::default()
5354
.borders(Borders::ALL)
5455
.title(input_block_title(app));
@@ -116,23 +117,7 @@ pub fn draw(f: &mut Frame, app: &App) {
116117
Color::Green,
117118
);
118119

119-
let (hint_area, status_area, input_area) = split_footer(footer_area);
120-
121-
let hint = Paragraph::new(
122-
" s start | d done | b back | a Done view | Tab | g stats | q | : command | Esc ",
123-
)
124-
.style(Style::default().fg(Color::DarkGray))
125-
.block(Block::default().borders(Borders::ALL));
126-
f.render_widget(hint, hint_area);
127-
128-
let status_text = app
129-
.status_line
130-
.as_deref()
131-
.unwrap_or("");
132-
let status = Paragraph::new(status_text)
133-
.style(Style::default().fg(Color::DarkGray))
134-
.block(Block::default().borders(Borders::NONE));
135-
f.render_widget(status, status_area);
120+
let (input_area, status_area, hint_area) = split_footer(footer_area);
136121

137122
let input_label = input_block_title(app);
138123
let prompt = if app.command_focused {
@@ -157,6 +142,22 @@ pub fn draw(f: &mut Frame, app: &App) {
157142
.title(input_label),
158143
);
159144
f.render_widget(input, input_area);
145+
146+
let status_text = app
147+
.status_line
148+
.as_deref()
149+
.unwrap_or("");
150+
let status = Paragraph::new(status_text)
151+
.style(Style::default().fg(Color::DarkGray))
152+
.block(Block::default().borders(Borders::NONE));
153+
f.render_widget(status, status_area);
154+
155+
let hint = Paragraph::new(
156+
" s start | d done | b back | a Done view | Tab | g stats | q | : command | Esc ",
157+
)
158+
.style(Style::default().fg(Color::DarkGray))
159+
.block(Block::default().borders(Borders::ALL));
160+
f.render_widget(hint, hint_area);
160161
}
161162

162163
fn render_column(

0 commit comments

Comments
 (0)