use kanban_view::scroll_indicators::{scroll_indicator, ScrollDirection, ScrollIndicator};
use ratatui::style::{Color, Style};
use ratatui::text::{Line, Span};
pub fn indicator_text(indicator: &ScrollIndicator, label: &str) -> String {
let plural = if indicator.is_plural() { "s" } else { "" };
let direction = match indicator.direction {
ScrollDirection::Above => "above",
ScrollDirection::Below => "below",
};
format!(" {} {}{} {}", indicator.count, label, plural, direction)
}
fn render_indicator<'a>(
show: bool,
count: usize,
direction: ScrollDirection,
label: &str,
) -> Option<Line<'a>> {
scroll_indicator(show, count, direction).map(|indicator| {
Line::from(Span::styled(
indicator_text(&indicator, label),
Style::default().fg(Color::DarkGray),
))
})
}
pub fn render_above_indicator<'a>(show: bool, count: usize, label: &str) -> Option<Line<'a>> {
render_indicator(show, count, ScrollDirection::Above, label)
}
pub fn render_below_indicator<'a>(show: bool, count: usize, label: &str) -> Option<Line<'a>> {
render_indicator(show, count, ScrollDirection::Below, label)
}