Layout using new algorithm and new blocks

This commit is contained in:
Joscha 2022-07-31 19:57:45 +02:00
parent 6f4d94afa5
commit ae8ec70e5e
7 changed files with 459 additions and 254 deletions

View file

@ -1,8 +1,8 @@
use crossterm::style::{ContentStyle, Stylize};
use time::format_description::FormatItem;
use time::macros::format_description;
use time::OffsetDateTime;
use crate::euph::api::Time;
use crate::ui::widgets::background::Background;
use crate::ui::widgets::text::Text;
use crate::ui::widgets::BoxedWidget;
@ -18,9 +18,9 @@ fn style_inverted() -> ContentStyle {
ContentStyle::default().black().on_white()
}
pub fn widget(time: Option<Time>, highlighted: bool) -> BoxedWidget {
pub fn widget(time: Option<OffsetDateTime>, highlighted: bool) -> BoxedWidget {
let text = if let Some(time) = time {
time.0.format(TIME_FORMAT).expect("could not format time")
time.format(TIME_FORMAT).expect("could not format time")
} else {
TIME_EMPTY.to_string()
};