feat(ui): open Weekly Report modal from the menu

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-03 09:56:32 +02:00
parent 74fc39f1a6
commit b748c1569e
4 changed files with 31 additions and 0 deletions

View File

@@ -107,6 +107,8 @@ sealed class Program
sc.AddTransient<ListSettingsModalViewModel>();
sc.AddTransient<RepoImportModalViewModel>();
sc.AddTransient<Func<RepoImportModalViewModel>>(sp => () => sp.GetRequiredService<RepoImportModalViewModel>());
sc.AddTransient<WeeklyReportModalViewModel>();
sc.AddTransient<Func<WeeklyReportModalViewModel>>(sp => () => sp.GetRequiredService<WeeklyReportModalViewModel>());
// Islands shell VMs
sc.AddSingleton<ListsIslandViewModel>(sp =>

View File

@@ -34,6 +34,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase
private readonly WorkerLocator _workerLocator = null!;
private readonly IDbContextFactory<ClaudeDoDbContext>? _dbFactory;
private readonly Func<WorktreesOverviewModalViewModel> _worktreesOverviewVmFactory = () => null!;
private readonly Func<WeeklyReportModalViewModel> _weeklyReportVmFactory = () => null!;
private readonly Func<MergeModalViewModel> _mergeVmFactory = () => null!;
private readonly Func<RepoImportModalViewModel>? _repoImportVmFactory;
@@ -51,6 +52,9 @@ public sealed partial class IslandsShellViewModel : ViewModelBase
// Set by MainWindow to open the global worktrees overview dialog.
public Func<WorktreesOverviewModalViewModel, Task>? ShowWorktreesOverviewModal { get; set; }
// Set by MainWindow to open the weekly report dialog.
public Func<WeeklyReportModalViewModel, Task>? ShowWeeklyReportModal { get; set; }
// Set by MainWindow to open the worker-connection help dialog.
public Func<WorkerConnectionModalViewModel, Task>? ShowWorkerConnectionModal { get; set; }
@@ -178,6 +182,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase
WorkerLocator workerLocator,
IDbContextFactory<ClaudeDoDbContext> dbFactory,
Func<WorktreesOverviewModalViewModel> worktreesOverviewVmFactory,
Func<WeeklyReportModalViewModel> weeklyReportVmFactory,
Func<MergeModalViewModel> mergeVmFactory,
Func<RepoImportModalViewModel> 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()
{

View File

@@ -65,6 +65,7 @@
Command="{Binding RestartWorkerCommand}"/>
<MenuItem Header="Worktrees…"
Command="{Binding OpenWorktreesOverviewGlobalCommand}"/>
<MenuItem Header="Wochenbericht…" Command="{Binding OpenWeeklyReportCommand}"/>
<MenuItem Header="About…" Command="{Binding OpenAboutCommand}"/>
<MenuItem Header="Add repos as lists…" Command="{Binding OpenRepoImportCommand}"/>
</MenuItem>

View File

@@ -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 };