Upgrading footer

This commit is contained in:
Marco De Araujo 2025-12-29 06:50:18 -04:00
parent 63496cfc93
commit f4dca93598
5 changed files with 47 additions and 22 deletions

View file

@ -2,28 +2,43 @@ use ratatui::{
Frame,
layout::{Alignment, Rect},
style::{Color, Modifier, Style},
text::Span,
text::{Line, Span},
widgets::{Block, Borders, Paragraph},
};
use crate::i18n::t;
use chrono::Local;
pub fn render_footer(frame: &mut Frame, area: Rect) {
pub fn render_footer(frame: &mut Frame, area: Rect, seconds_until_update: u64) {
let now = Local::now();
let datatime_str = now.format("%Y-%m-%d %H:%M:%S").to_string();
let countdown_str = format!("{}s", seconds_until_update);
let footer = Paragraph::new(Span::styled(
datatime_str,
Style::default()
.fg(Color::Gray)
.add_modifier(Modifier::BOLD),
))
.block(
Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(Color::Blue)),
)
.alignment(Alignment::Center);
let text = Line::from(vec![
Span::styled(
datatime_str,
Style::default()
.fg(Color::Gray)
.add_modifier(Modifier::BOLD),
),
Span::raw(" | "),
Span::styled(
countdown_str,
Style::default()
.fg(Color::Yellow)
.add_modifier(Modifier::BOLD),
),
Span::raw(" | "),
Span::styled(t("key-to-exit"), Style::default().fg(Color::Gray)),
]);
let footer = Paragraph::new(text)
.block(
Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(Color::Blue)),
)
.alignment(Alignment::Center);
frame.render_widget(footer, area);
}

View file

@ -3,7 +3,7 @@ use crate::ui::dashboard::model::DashboardViewState;
use ratatui::{
Frame,
layout::{Alignment, Rect},
style::{Color, Style, Stylize},
style::{Color, Style},
text::{Line, Span},
widgets::{Block, Borders, Paragraph},
};