From 40eb979924c24565b7523775454b7bfe7ce34d38 Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Mon, 27 Jul 2026 12:52:42 +0200 Subject: [PATCH] refactor(ui): scope "Let Claude handle it" to a single list --- src/ClaudeDo.Localization/locales/de.json | 7 ++---- src/ClaudeDo.Localization/locales/en.json | 7 ++---- .../Islands/ListsIslandViewModel.cs | 12 ---------- .../MergeHelperSelectionModalViewModel.cs | 23 ++++++------------- .../Views/Islands/ListsIslandView.axaml | 11 ++------- .../Modals/MergeHelperSelectionModal.axaml | 10 ++------ ...MergeHelperSelectionModalViewModelTests.cs | 13 +++++------ 7 files changed, 21 insertions(+), 62 deletions(-) diff --git a/src/ClaudeDo.Localization/locales/de.json b/src/ClaudeDo.Localization/locales/de.json index f41e2bb4..3c01c959 100644 --- a/src/ClaudeDo.Localization/locales/de.json +++ b/src/ClaudeDo.Localization/locales/de.json @@ -175,8 +175,7 @@ "contextOpenTerminal": "Im Terminal öffnen", "contextLetClaude": "Claude machen lassen", "newList": "Neue Liste", - "addReposTip": "Repos als Listen hinzufügen", - "letClaudeAllTip": "Claude machen lassen (alle Listen)" + "addReposTip": "Repos als Listen hinzufügen" }, "details": { "pickUpInTerminalTip": "Diese Sitzung im Terminal fortsetzen", @@ -371,7 +370,6 @@ "mergeHelper": { "title": "CLAUDE MACHEN LASSEN", "windowTitle": "Claude machen lassen", - "scopeAll": "Alle Listen", "scopeList": "Liste: {0}", "confirm": "Claude machen lassen", "cancel": "Abbrechen", @@ -379,8 +377,7 @@ "selectNone": "Keine auswählen", "empty": "Keine Aufgaben zu übergeben — alles erledigt oder abgebrochen.", "columnTask": "AUFGABE", - "columnStatus": "STATUS", - "columnList": "LISTE" + "columnStatus": "STATUS" }, "unfinishedPlanning": { "title": "UNVOLLENDETE PLANUNGSSITZUNG", diff --git a/src/ClaudeDo.Localization/locales/en.json b/src/ClaudeDo.Localization/locales/en.json index a5baca26..5979f9e2 100644 --- a/src/ClaudeDo.Localization/locales/en.json +++ b/src/ClaudeDo.Localization/locales/en.json @@ -175,8 +175,7 @@ "contextOpenTerminal": "Open in Terminal", "contextLetClaude": "Let Claude handle it", "newList": "New list", - "addReposTip": "Add repos as lists", - "letClaudeAllTip": "Let Claude handle it (all lists)" + "addReposTip": "Add repos as lists" }, "details": { "pickUpInTerminalTip": "Pick up this session in a terminal", @@ -371,7 +370,6 @@ "mergeHelper": { "title": "LET CLAUDE HANDLE IT", "windowTitle": "Let Claude handle it", - "scopeAll": "All lists", "scopeList": "List: {0}", "confirm": "Let Claude handle it", "cancel": "Cancel", @@ -379,8 +377,7 @@ "selectNone": "Select none", "empty": "No tasks to hand over — everything is done or cancelled.", "columnTask": "TASK", - "columnStatus": "STATUS", - "columnList": "LIST" + "columnStatus": "STATUS" }, "unfinishedPlanning": { "title": "UNFINISHED PLANNING SESSION", diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs index 2e959a36..3a10af6d 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs @@ -100,18 +100,6 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable LetClaudeHandleRequested?.Invoke(new MergeHelperRequest(rawId, ids)); } - [RelayCommand] - private async Task LetClaudeHandleAllAsync() - { - if (Dialogs is null || _services is null) return; - var vm = _services.GetRequiredService(); - vm.Configure(null, null); - await vm.LoadAsync(); - var ids = await Dialogs.ShowMergeHelperSelectionAsync(vm); - if (ids is { Count: > 0 }) - LetClaudeHandleRequested?.Invoke(new MergeHelperRequest(null, ids)); - } - [RelayCommand] private void OpenInExplorer(ListNavItemViewModel? row) { diff --git a/src/ClaudeDo.Ui/ViewModels/Modals/MergeHelperSelectionModalViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Modals/MergeHelperSelectionModalViewModel.cs index 857710a9..72d24c00 100644 --- a/src/ClaudeDo.Ui/ViewModels/Modals/MergeHelperSelectionModalViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Modals/MergeHelperSelectionModalViewModel.cs @@ -14,7 +14,6 @@ public sealed partial class MergeHelperTaskRowViewModel : ViewModelBase public required string Id { get; init; } public required string Title { get; init; } public required string StatusText { get; init; } - public required string ListName { get; init; } [ObservableProperty] private bool _isSelected; } @@ -27,12 +26,11 @@ public sealed partial class MergeHelperTaskRowViewModel : ViewModelBase public sealed partial class MergeHelperSelectionModalViewModel : ViewModelBase { private readonly IDbContextFactory _dbFactory; - private string? _listId; + private string _listId = ""; public ObservableCollection Tasks { get; } = new(); [ObservableProperty] private string _scopeLabel = ""; - [ObservableProperty] private bool _isGlobal; public bool HasTasks => Tasks.Count > 0; public bool CanConfirm => Tasks.Any(t => t.IsSelected); @@ -43,13 +41,10 @@ public sealed partial class MergeHelperSelectionModalViewModel : ViewModelBase public MergeHelperSelectionModalViewModel(IDbContextFactory dbFactory) => _dbFactory = dbFactory; - public void Configure(string? listId, string? listName) + public void Configure(string listId, string listName) { _listId = listId; - IsGlobal = listId is null; - ScopeLabel = listId is null - ? Loc.T("modals.mergeHelper.scopeAll") - : Loc.T("modals.mergeHelper.scopeList", listName ?? ""); + ScopeLabel = Loc.T("modals.mergeHelper.scopeList", listName); } public async Task LoadAsync(CancellationToken ct = default) @@ -58,14 +53,11 @@ public sealed partial class MergeHelperSelectionModalViewModel : ViewModelBase Tasks.Clear(); await using var ctx = await _dbFactory.CreateDbContextAsync(ct); - var query = ctx.Tasks.AsNoTracking() - .Where(t => t.Status != TaskStatus.Done && t.Status != TaskStatus.Cancelled); - if (_listId is not null) - query = query.Where(t => t.ListId == _listId); - - var candidates = await query + var candidates = await ctx.Tasks.AsNoTracking() + .Where(t => t.Status != TaskStatus.Done && t.Status != TaskStatus.Cancelled) + .Where(t => t.ListId == _listId) .OrderBy(t => t.SortOrder).ThenBy(t => t.CreatedAt) - .Select(t => new { t.Id, t.Title, t.Status, ListName = t.List.Name }) + .Select(t => new { t.Id, t.Title, t.Status }) .ToListAsync(ct); foreach (var c in candidates) @@ -75,7 +67,6 @@ public sealed partial class MergeHelperSelectionModalViewModel : ViewModelBase Id = c.Id, Title = c.Title, StatusText = c.Status.ToString(), - ListName = c.ListName, IsSelected = IsTickedByDefault(c.Status), }; row.PropertyChanged += OnRowChanged; diff --git a/src/ClaudeDo.Ui/Views/Islands/ListsIslandView.axaml b/src/ClaudeDo.Ui/Views/Islands/ListsIslandView.axaml index 679781db..8b03f562 100644 --- a/src/ClaudeDo.Ui/Views/Islands/ListsIslandView.axaml +++ b/src/ClaudeDo.Ui/Views/Islands/ListsIslandView.axaml @@ -181,8 +181,8 @@ - - + + - diff --git a/src/ClaudeDo.Ui/Views/Modals/MergeHelperSelectionModal.axaml b/src/ClaudeDo.Ui/Views/Modals/MergeHelperSelectionModal.axaml index 09a431e3..78cd2a76 100644 --- a/src/ClaudeDo.Ui/Views/Modals/MergeHelperSelectionModal.axaml +++ b/src/ClaudeDo.Ui/Views/Modals/MergeHelperSelectionModal.axaml @@ -38,12 +38,10 @@ - - @@ -54,7 +52,7 @@ - + @@ -65,10 +63,6 @@ HorizontalAlignment="Left" VerticalAlignment="Center"> - diff --git a/tests/ClaudeDo.Ui.Tests/ViewModels/MergeHelperSelectionModalViewModelTests.cs b/tests/ClaudeDo.Ui.Tests/ViewModels/MergeHelperSelectionModalViewModelTests.cs index 187989b3..1558103d 100644 --- a/tests/ClaudeDo.Ui.Tests/ViewModels/MergeHelperSelectionModalViewModelTests.cs +++ b/tests/ClaudeDo.Ui.Tests/ViewModels/MergeHelperSelectionModalViewModelTests.cs @@ -74,11 +74,12 @@ public class MergeHelperSelectionModalViewModelTests : IDisposable { await SeedAllStatusesAsync(); var vm = BuildVm(); - vm.Configure(null, null); + vm.Configure("L1", "Work"); await vm.LoadAsync(); Assert.DoesNotContain(vm.Tasks, t => t.Id is "t-done" or "t-cancelled"); - Assert.Equal(7, vm.Tasks.Count); + Assert.DoesNotContain(vm.Tasks, t => t.Id == "t-other-list"); + Assert.Equal(6, vm.Tasks.Count); Assert.True(vm.Tasks.Single(t => t.Id == "t-idle").IsSelected); Assert.True(vm.Tasks.Single(t => t.Id == "t-queued").IsSelected); @@ -98,8 +99,6 @@ public class MergeHelperSelectionModalViewModelTests : IDisposable Assert.Single(vm.Tasks); Assert.Equal("t-other-list", vm.Tasks[0].Id); - Assert.Equal("Home", vm.Tasks[0].ListName); - Assert.False(vm.IsGlobal); Assert.Contains("Home", vm.ScopeLabel); } @@ -108,7 +107,7 @@ public class MergeHelperSelectionModalViewModelTests : IDisposable { await SeedAllStatusesAsync(); var vm = BuildVm(); - vm.Configure(null, null); + vm.Configure("L1", "Work"); await vm.LoadAsync(); Assert.True(vm.CanConfirm); @@ -129,7 +128,7 @@ public class MergeHelperSelectionModalViewModelTests : IDisposable { await SeedAllStatusesAsync(); var vm = BuildVm(); - vm.Configure(null, null); + vm.Configure("L1", "Work"); await vm.LoadAsync(); vm.SelectNoneCommand.Execute(null); @@ -152,7 +151,7 @@ public class MergeHelperSelectionModalViewModelTests : IDisposable { await SeedAllStatusesAsync(); var vm = BuildVm(); - vm.Configure(null, null); + vm.Configure("L1", "Work"); await vm.LoadAsync(); var closed = false;