use gtk4 as gtk;

use chrono::NaiveTime;

use crate::model::time;

pub fn time_entry(time: Option<NaiveTime>) -> gtk::Entry {
    entry(&time.map(time::pprint).unwrap_or_else(|| "".to_string()))
}

pub fn entry(text: &str) -> gtk::Entry {
    gtk::Entry::builder().text(text).margin_bottom(10).build()
}

pub fn label(text: &str) -> gtk::Label {
    gtk::Label::builder()
        .label(text)
        .halign(gtk::Align::Start)
        .margin_bottom(5)
        .build()
}