From ffe0fb9820cd9d0e705a547ac0b5cd760207c8cc Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Wed, 3 Jun 2026 14:27:06 +0200 Subject: [PATCH] Improve Prime Time Picker --- .../Settings/PrimeScheduleRowViewModel.cs | 19 +++++++++++++++++++ .../Views/Modals/SettingsModalView.axaml | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/ClaudeDo.Ui/ViewModels/Modals/Settings/PrimeScheduleRowViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Modals/Settings/PrimeScheduleRowViewModel.cs index 7830488..fe7e140 100644 --- a/src/ClaudeDo.Ui/ViewModels/Modals/Settings/PrimeScheduleRowViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Modals/Settings/PrimeScheduleRowViewModel.cs @@ -1,3 +1,4 @@ +using System.Globalization; using ClaudeDo.Ui.Services; using CommunityToolkit.Mvvm.ComponentModel; @@ -23,8 +24,26 @@ public sealed partial class PrimeScheduleRowViewModel : ViewModelBase public string LastRunLabel => LastRunAt is { } v ? v.LocalDateTime.ToString("g") : "—"; + private static readonly string[] TimeFormats = { @"h\:mm", @"hh\:mm" }; + + public string TimeText + { + get => TimeOfDay.ToString(@"hh\:mm", CultureInfo.InvariantCulture); + set + { + if (TimeSpan.TryParseExact(value, TimeFormats, CultureInfo.InvariantCulture, out var t) + && t >= TimeSpan.Zero && t < TimeSpan.FromDays(1)) + { + TimeOfDay = t; + } + OnPropertyChanged(nameof(TimeText)); + } + } + partial void OnLastRunAtChanged(DateTimeOffset? value) => OnPropertyChanged(nameof(LastRunLabel)); + partial void OnTimeOfDayChanged(TimeSpan value) => OnPropertyChanged(nameof(TimeText)); + public PrimeScheduleRowViewModel(PrimeScheduleDto dto, bool isExisting) { Id = dto.Id; diff --git a/src/ClaudeDo.Ui/Views/Modals/SettingsModalView.axaml b/src/ClaudeDo.Ui/Views/Modals/SettingsModalView.axaml index b185c09..8b137a3 100644 --- a/src/ClaudeDo.Ui/Views/Modals/SettingsModalView.axaml +++ b/src/ClaudeDo.Ui/Views/Modals/SettingsModalView.axaml @@ -224,10 +224,10 @@ - +