From c36393efca6f04df6de66a028f98d05cc54d15b9 Mon Sep 17 00:00:00 2001 From: Avii Date: Sun, 9 Aug 2026 22:07:37 +0200 Subject: [PATCH] 1786306057 --- dashboard/src/ui.rs | 17 ++++++++++++++++- dashboard/ui/calendar.slint | 21 ++++++++++++++++----- dashboard/ui/climate.slint | 36 +++++++++++++++++++++++++++++++++++- dashboard/ui/main.slint | 8 ++++++++ 4 files changed, 75 insertions(+), 7 deletions(-) diff --git a/dashboard/src/ui.rs b/dashboard/src/ui.rs index 3ecddc1..f33fe68 100644 --- a/dashboard/src/ui.rs +++ b/dashboard/src/ui.rs @@ -102,7 +102,22 @@ pub fn apply_calendars(app: &Weak, entities: Vec) { let mut entities = entities.clone(); entities.sort_by_key(|a| a.sort_epoch); - let entities = entities.iter().map(Into::into).collect::>(); + let entities: Vec = entities.iter().map(Into::into).collect::>(); + + if let Some(event) = &entities.first() { + app.set_next_event_date(slint::format!( + "NEXT / {} / {}", + event.date.to_uppercase(), + event.calendar.to_uppercase() + )); + app.set_next_event_time(event.time.clone()); + app.set_next_event_summary(event.summary.clone()); + } else { + app.set_next_event_date("NEXT EVENT".into()); + app.set_next_event_time("".into()); + app.set_next_event_summary("NO UPCOMING EVENTS".into()); + } + app.set_calendar_events(ModelRc::new(VecModel::::from(entities))); }) { eprintln!("Failed to upgrade in event loop.\n\t{:?}", err); diff --git a/dashboard/ui/calendar.slint b/dashboard/ui/calendar.slint index 0771dcd..c8f967a 100644 --- a/dashboard/ui/calendar.slint +++ b/dashboard/ui/calendar.slint @@ -27,12 +27,23 @@ export component Calendar inherits Rectangle { text: event.date; supporting-text: event.summary; height: 72px; + VerticalLayout { + alignment: center; + horizontal_stretch: 1; + MaterialText { + text: event.time; + horizontal-alignment: right; + color: MaterialPalette.on_surface; + overflow: elide; + style: MaterialTypography.title_medium; + } - MaterialText { - text: event.time; - color: MaterialPalette.on_surface; - overflow: elide; - style: MaterialTypography.title_medium; + MaterialText { + text: ""; + horizontal-alignment: right; + overflow: elide; + style: MaterialTypography.body_medium; + } } } diff --git a/dashboard/ui/climate.slint b/dashboard/ui/climate.slint index e2517ee..7c16050 100644 --- a/dashboard/ui/climate.slint +++ b/dashboard/ui/climate.slint @@ -7,6 +7,9 @@ import { SegmentedButton, MaterialPalette, FilledButton, + MaterialText, + MaterialTypography, + MaterialStyleMetrics, } from "material/material.slint"; export struct WeatherData { @@ -33,6 +36,10 @@ export component Climate inherits Rectangle { in property <[ThermostatData]> thermostats; in property is-night; + in property next-event-date; + in property next-event-time; + in property next-event-summary; + property icon-index: weather.icon-index == 1 && is-night ? 2 : weather.icon-index; callback set_temperature(string, float); @@ -53,7 +60,34 @@ export component Climate inherits Rectangle { VerticalLayout { HorizontalLayout { - Rectangle { } + Vertical { + ListTile { + avatar_icon: Icons.event_upcoming; + avatar_foreground: Palette.foreground; + text: next-event-date; + supporting-text: next-event-summary; + height: 72px; + enabled: false; + VerticalLayout { + alignment: center; + horizontal_stretch: 1; + MaterialText { + text: next-event-time; + color: MaterialPalette.on_surface; + overflow: elide; + horizontal-alignment: right; + style: MaterialTypography.title_medium; + } + + MaterialText { + text: ""; + overflow: elide; + horizontal-alignment: right; + style: MaterialTypography.body_medium; + } + } + } + } Vertical { Text { diff --git a/dashboard/ui/main.slint b/dashboard/ui/main.slint index 879867c..2505f46 100644 --- a/dashboard/ui/main.slint +++ b/dashboard/ui/main.slint @@ -131,10 +131,14 @@ export component AppWindow inherits Window { in property <[ThermostatData]> thermostats; in property weather; in property is-night; + callback set_temperature(string, float); callback toggle_thermostat(string); in property <[CalendarEventData]> calendar-events; + in property next-event-date; + in property next-event-time; + in property next-event-summary; in property <[ThermometerData]> thermometers; @@ -175,6 +179,10 @@ export component AppWindow inherits Window { width: (root.width / 4) * 3; VerticalLayout { if tab-bar.current-index == 0: Climate { + next-event-date: next-event-date; + next-event-time: next-event-time; + next-event-summary: next-event-summary; + thermostats: thermostats; is-night: is-night; weather: weather;