Display seen status of messages

This commit is contained in:
Joscha 2022-08-08 15:13:55 +02:00
parent 6166c5e366
commit de569211f6
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,24 @@
use crossterm::style::{ContentStyle, Stylize};
use crate::ui::widgets::background::Background;
use crate::ui::widgets::empty::Empty;
use crate::ui::widgets::text::Text;
use crate::ui::widgets::BoxedWidget;
const UNSEEN: &str = "*";
const WIDTH: u16 = 1;
fn seen_style() -> ContentStyle {
ContentStyle::default().black().on_green()
}
pub fn widget(seen: bool) -> BoxedWidget {
if seen {
Empty::new().width(WIDTH).into()
} else {
let style = seen_style();
Background::new(Text::new((UNSEEN, style)))
.style(style)
.into()
}
}