#[allow(clippy::wildcard_imports)]
use super::*;
pub(in crate::app) fn render_board_input(
app: &App,
f: &mut ratatui::Frame,
area: Rect,
label: &str,
buffer: &str,
) {
let tab_h: u16 = if app.tabs.needs_bar() { TAB_HEIGHT } else { 0 };
if area.height < tab_h + HOVER_HEIGHT + 1 {
return;
}
let view_h: u16 = u16::from(app.view_indicator().is_some());
let band_h = filter_band_height(app);
let filter_h = band_h - view_h;
let input_area = Rect {
y: area.y + area.height - 1,
height: 1,
..area
};
let tabs_area = Rect {
y: area.y,
height: tab_h,
..area
};
let view_area = Rect {
y: area.y + tab_h + HOVER_HEIGHT,
height: view_h,
..area
};
let filter_area = Rect {
y: area.y + tab_h + HOVER_HEIGHT + view_h,
height: filter_h,
..area
};
let content = Rect {
y: area.y + tab_h + HOVER_HEIGHT + band_h,
height: area
.height
.saturating_sub(tab_h + HOVER_HEIGHT + band_h + 1),
..area
};
if tab_h > 0 {
app.tabs.render(f, tabs_area);
for index in 0..app.tabs.len() {
if let Some(rect) = app.tabs.tab_rect(index, tabs_area) {
app.record_region(rect, Action::SwitchBoard(index));
}
}
}
render_hover_line(app, f, area);
if view_h > 0 {
render_view_row(app, f, view_area);
}
if filter_h > 0 {
filter_row(app).render(f, filter_area);
}
let page_cards = board::render(
&app.board,
f,
content,
&app.status_msg,
app.drag_preview_col,
board::BoardDisplay::from(app.active_board_config()),
&app.theme,
Some(&app.wip),
app.capacity_summaries(),
);
app.board_page.set(page_cards);
render_input_line(f, input_area, label, buffer);
}
pub(in crate::app) fn render_detail_input(
app: &App,
f: &mut ratatui::Frame,
area: Rect,
label: &str,
buffer: &str,
) {
if area.height < 2 {
return;
}
let input_area = Rect {
y: area.y + area.height - 1,
height: 1,
..area
};
let content = Rect {
height: area.height - 1,
..area
};
if let Some(ref d) = app.detail {
detail::render(d, f, content, &app.theme);
}
render_input_line(f, input_area, label, buffer);
}
pub(in crate::app) fn render_input_line(
f: &mut ratatui::Frame,
area: Rect,
label: &str,
buffer: &str,
) {
let text = format!("{label}: {buffer}_");
let prompt = Paragraph::new(Line::from(Span::styled(
text,
Style::default().fg(Color::Yellow),
)));
f.render_widget(prompt, area);
}
pub(in crate::app) fn filter_row(app: &App) -> crate::ui::filter_row::FilterRow {
crate::ui::filter_row::FilterRow {
query: app.filter.clone(),
structured: app.structured.clone(),
}
}
pub(in crate::app) fn render_hint(f: &mut ratatui::Frame, area: Rect, app: &App, tag: &str) {
let context = if tag == commandbar::MODE_DETAIL {
if app.related_picker.is_some() {
InputContext::RelatedPicker
} else {
InputContext::Detail
}
} else {
commandbar::hint_context_for_mode(app.top_mode)
};
let bar = commandbar::hint_bar_for_with(&app.bindings, context, app.stats_help_tab());
let para = Paragraph::new(Line::from(Span::styled(
bar,
Style::default().fg(Color::Gray),
)));
f.render_widget(para, area);
}