Implementing auto refresh

This commit is contained in:
Marco De Araujo 2025-12-24 19:05:20 -04:00
parent 4f9ced3e29
commit 2819df185e
7 changed files with 27 additions and 23 deletions

View file

@ -30,7 +30,7 @@ pub fn render_monitor_list(frame: &mut Frame, area: Rect, state: &DashboardViewS
Constraint::Length(MAX_NAME_LENGTH as u16),
Constraint::Length(10),
Constraint::Length(10),
Constraint::Length(STATUS_LINE_LENGTH as u16 + 16),
Constraint::Length(STATUS_LINE_LENGTH as u16 + 8),
];
let available_height = area.height.saturating_sub(2);
@ -118,26 +118,11 @@ fn create_status_line_spans(status_history: &[MonitorStatus]) -> Line<'_> {
.take(STATUS_LINE_LENGTH)
.collect();
spans.push(Span::styled(
"(1h)",
Style::default()
.fg(Color::Gray)
.add_modifier(Modifier::ITALIC),
));
spans.push(Span::raw(" "));
for status in recent_status.iter().rev() {
let c = get_status_char(status);
let color = get_status_color(status);
spans.push(Span::styled(c.to_string(), Style::default().fg(color)));
}
spans.push(Span::raw(" "));
spans.push(Span::styled(
t("now"),
Style::default()
.fg(Color::Gray)
.add_modifier(Modifier::ITALIC),
));
Line::from(spans)
}