From b748c1569ee3cd0f36d0fb010974d5cd4bf2c4d0 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Wed, 3 Jun 2026 09:56:32 +0200 Subject: [PATCH] feat(ui): open Weekly Report modal from the menu Co-Authored-By: Claude Sonnet 4.6 --- src/ClaudeDo.App/Program.cs | 2 ++ .../ViewModels/IslandsShellViewModel.cs | 22 +++++++++++++++++++ src/ClaudeDo.Ui/Views/MainWindow.axaml | 1 + src/ClaudeDo.Ui/Views/MainWindow.axaml.cs | 6 +++++ 4 files changed, 31 insertions(+) diff --git a/src/ClaudeDo.App/Program.cs b/src/ClaudeDo.App/Program.cs index e63687b..6536cde 100644 --- a/src/ClaudeDo.App/Program.cs +++ b/src/ClaudeDo.App/Program.cs @@ -107,6 +107,8 @@ sealed class Program sc.AddTransient(); sc.AddTransient(); sc.AddTransient>(sp => () => sp.GetRequiredService()); + sc.AddTransient(); + sc.AddTransient>(sp => () => sp.GetRequiredService()); // Islands shell VMs sc.AddSingleton(sp => diff --git a/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs b/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs index ca50168..2f2875a 100644 --- a/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs @@ -34,6 +34,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase private readonly WorkerLocator _workerLocator = null!; private readonly IDbContextFactory? _dbFactory; private readonly Func _worktreesOverviewVmFactory = () => null!; + private readonly Func _weeklyReportVmFactory = () => null!; private readonly Func _mergeVmFactory = () => null!; private readonly Func? _repoImportVmFactory; @@ -51,6 +52,9 @@ public sealed partial class IslandsShellViewModel : ViewModelBase // Set by MainWindow to open the global worktrees overview dialog. public Func? ShowWorktreesOverviewModal { get; set; } + // Set by MainWindow to open the weekly report dialog. + public Func? ShowWeeklyReportModal { get; set; } + // Set by MainWindow to open the worker-connection help dialog. public Func? ShowWorkerConnectionModal { get; set; } @@ -178,6 +182,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase WorkerLocator workerLocator, IDbContextFactory dbFactory, Func worktreesOverviewVmFactory, + Func weeklyReportVmFactory, Func mergeVmFactory, Func repoImportVmFactory) { @@ -187,6 +192,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase _workerLocator = workerLocator; _dbFactory = dbFactory; _worktreesOverviewVmFactory = worktreesOverviewVmFactory; + _weeklyReportVmFactory = weeklyReportVmFactory; _mergeVmFactory = mergeVmFactory; _repoImportVmFactory = repoImportVmFactory; Lists.SelectionChanged += (_, _) => Tasks.LoadForList(Lists.SelectedList); @@ -324,6 +330,22 @@ public sealed partial class IslandsShellViewModel : ViewModelBase finally { _worktreesOverviewOpen = false; } } + private bool _weeklyReportOpen; + + [RelayCommand] + private async Task OpenWeeklyReport() + { + if (ShowWeeklyReportModal is null || _weeklyReportOpen) return; + _weeklyReportOpen = true; + try + { + var vm = _weeklyReportVmFactory(); + await vm.InitializeAsync(); + await ShowWeeklyReportModal(vm); + } + finally { _weeklyReportOpen = false; } + } + [RelayCommand] private async Task CheckForUpdatesAsync() { diff --git a/src/ClaudeDo.Ui/Views/MainWindow.axaml b/src/ClaudeDo.Ui/Views/MainWindow.axaml index ef81bce..1c3b191 100644 --- a/src/ClaudeDo.Ui/Views/MainWindow.axaml +++ b/src/ClaudeDo.Ui/Views/MainWindow.axaml @@ -65,6 +65,7 @@ Command="{Binding RestartWorkerCommand}"/> + diff --git a/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs b/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs index 21398d4..0581d82 100644 --- a/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs +++ b/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs @@ -52,6 +52,12 @@ public partial class MainWindow : Window aboutVm.CloseAction = () => { dlg.Close(); tcs.TrySetResult(true); }; await dlg.ShowDialog(this); }; + vm.ShowWeeklyReportModal = async (modal) => + { + var dlg = new WeeklyReportModalView { DataContext = modal }; + modal.CloseAction = () => dlg.Close(); + await dlg.ShowDialog(this); + }; vm.ShowWorktreesOverviewModal = async (modal) => { var dlg = new WorktreesOverviewModalView { DataContext = modal };