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

View File

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

View File

@ -49,7 +49,7 @@ pub fn time_distance_summary(
(false, false) => None, (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 { pub fn time_distance_detail(record: ft_core::TimeDistance) -> gtk::Box {

View File

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

View File

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