Display seen status of messages
This commit is contained in:
parent
6166c5e366
commit
de569211f6
2 changed files with 29 additions and 0 deletions
24
src/ui/chat/tree/widgets/seen.rs
Normal file
24
src/ui/chat/tree/widgets/seen.rs
Normal 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()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue