Hugely improve the historical view formatting

This commit is contained in:
Savanni D'Gerinel 2024-02-19 17:56:48 -05:00
parent c24a5f515f
commit a5d51dab70
5 changed files with 17 additions and 21 deletions

View File

@ -3,7 +3,7 @@
}
.welcome__title {
font-size: larger;
font-size: x-large;
padding: 8px;
}
@ -28,21 +28,14 @@
.date-range-picker__date-field {
margin: 8px;
font-size: x-large;
}
.date-range-picker__search-button {
margin: 8px;
font-size: x-large;
}
.date-range-picker__range-button {
margin: 8px;
font-size: x-large;
}
.date-field > label {
font-size: x-large;
}
.date-field__year {
@ -61,11 +54,14 @@
padding: 8px;
}
.day-summary__date {
font-size: larger;
.day-summary > *:not(:last-child) {
margin-bottom: 8px;
}
.day-summary__date {
font-size: x-large;
}
.day-summary__weight {
margin: 4px;
}

View File

@ -91,17 +91,16 @@ impl DaySummary {
if let Some(w) = view_model.weight() {
label.set_label(&w.to_string())
}
row.append(&label);
self.append(&label);
let label = gtk::Label::builder()
.halign(gtk::Align::Start)
.css_classes(["day-summary__weight"])
.css_classes(["day-summary__steps"])
.build();
if let Some(s) = view_model.steps() {
label.set_label(&format!("{} steps", s));
}
row.append(&label);
row.append(&label);
self.append(&row);

View File

@ -49,7 +49,7 @@ pub fn time_distance_summary(
(false, false) => None,
};
text.map(|text| gtk::Label::new(Some(&text)))
text.map(|text| gtk::Label::builder().halign(gtk::Align::Start).label(&text).build())
}
pub fn time_distance_detail(record: ft_core::TimeDistance) -> gtk::Box {

View File

@ -79,12 +79,12 @@ impl TimeFormatter {
match parts.len() {
0 => Err(ParseError),
1 => Err(ParseError),
2 => Ok(TimeFormatter(
chrono::NaiveTime::from_hms_opt(parts[0], parts[1], 0).unwrap(),
)),
3 => Ok(TimeFormatter(
chrono::NaiveTime::from_hms_opt(parts[0], parts[1], parts[2]).unwrap(),
)),
2 => chrono::NaiveTime::from_hms_opt(parts[0], parts[1], 0)
.map(|v| TimeFormatter(v))
.ok_or(ParseError),
3 => chrono::NaiveTime::from_hms_opt(parts[0], parts[1], parts[2])
.map(|v| TimeFormatter(v))
.ok_or(ParseError),
_ => Err(ParseError),
}
}

View File

@ -55,6 +55,7 @@ impl ObjectSubclass for HistoricalViewPrivate {
list_view: gtk::ListView::builder()
.factory(&factory)
.single_click_activate(true)
.show_separators(true)
.build(),
date_range_picker,
};