From 2a6781f80f6aedcad55a2ba11380743ab36f06f5 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Thu, 4 Jun 2026 23:21:30 +0200 Subject: [PATCH] feat(ui): add Refine button, icon, and command to task card --- src/ClaudeDo.Localization/locales/de.json | 3 ++- src/ClaudeDo.Localization/locales/en.json | 3 ++- src/ClaudeDo.Ui/Design/IslandStyles.axaml | 3 +++ .../ViewModels/Islands/TaskRowViewModel.cs | 7 ++++++ .../Islands/TasksIslandViewModel.cs | 23 +++++++++++++++++++ .../Views/Islands/TaskRowView.axaml | 15 ++++++++++-- 6 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/ClaudeDo.Localization/locales/de.json b/src/ClaudeDo.Localization/locales/de.json index 46a30ad..5ba4a21 100644 --- a/src/ClaudeDo.Localization/locales/de.json +++ b/src/ClaudeDo.Localization/locales/de.json @@ -111,7 +111,8 @@ "reviewTitle": "Review", "feedbackLabel": "FEEDBACK FÜR DEN AGENTEN", "feedbackPlaceholder": "Was soll der Agent korrigieren?", - "rerun": "Erneut ausführen" + "rerun": "Erneut ausführen", + "refineTip": "Aufgabe mit Claude verfeinern" }, "lists": { "heading": "Listen", diff --git a/src/ClaudeDo.Localization/locales/en.json b/src/ClaudeDo.Localization/locales/en.json index 83f29fe..d2bd8f4 100644 --- a/src/ClaudeDo.Localization/locales/en.json +++ b/src/ClaudeDo.Localization/locales/en.json @@ -111,7 +111,8 @@ "reviewTitle": "Review", "feedbackLabel": "FEEDBACK FOR THE AGENT", "feedbackPlaceholder": "What should the agent fix?", - "rerun": "Re-run" + "rerun": "Re-run", + "refineTip": "Refine this task with Claude" }, "lists": { "heading": "Lists", diff --git a/src/ClaudeDo.Ui/Design/IslandStyles.axaml b/src/ClaudeDo.Ui/Design/IslandStyles.axaml index 76cc491..28335f0 100644 --- a/src/ClaudeDo.Ui/Design/IslandStyles.axaml +++ b/src/ClaudeDo.Ui/Design/IslandStyles.axaml @@ -76,6 +76,9 @@ M3,20 L21,20 M8.4,11 a3.6,3.6 0 1,0 7.2,0 a3.6,3.6 0 1,0 -7.2,0 M12,4.5 L12,3 M6,11 L4.5,11 M18,11 L19.5,11 M7.5,6.5 L6.4,5.4 M16.5,6.5 L17.6,5.4 + + M3,5 L11,5 M3,9 L9,9 M3,13 L7,13 M19,1.8 L19.7,3.9 L21.7,4.6 L19.7,5.3 L19,7.4 L18.3,5.3 L16.3,4.6 L18.3,3.9 Z M18,10.5 L12.2,16.3 M16.6,9.1 L19.4,11.9 M12.2,16.3 L11,18.5 L13.2,17.5 Z + M6 6l12 12M18 6L6 18 diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/TaskRowViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/TaskRowViewModel.cs index d1a212e..85c8071 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/TaskRowViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/TaskRowViewModel.cs @@ -32,6 +32,9 @@ public sealed partial class TaskRowViewModel : ViewModelBase [ObservableProperty] private bool _showListChip = true; [ObservableProperty] private bool _parentFinalized; [ObservableProperty] private int _roadblockCount; + [ObservableProperty] private bool _isRefining; + + public bool CanRefine => Status == TaskStatus.Idle && PlanningPhase == PlanningPhase.None && !IsRefining; public DateTime CreatedAt { get; init; } public string CreatedAtFormatted => CreatedAt == default ? "—" : Loc.T("vm.taskRow.createdPrefix", CreatedAt.ToString("MMM d")); @@ -125,6 +128,7 @@ public sealed partial class TaskRowViewModel : ViewModelBase OnPropertyChanged(nameof(CanOpenPlanningSession)); OnPropertyChanged(nameof(CanRemoveFromQueue)); OnPropertyChanged(nameof(CanSendToQueue)); + OnPropertyChanged(nameof(CanRefine)); } partial void OnParentTaskIdChanged(string? value) @@ -155,8 +159,11 @@ public sealed partial class TaskRowViewModel : ViewModelBase OnPropertyChanged(nameof(CanOpenPlanningSession)); OnPropertyChanged(nameof(CanResumeOrDiscardPlanning)); OnPropertyChanged(nameof(CanQueuePlan)); + OnPropertyChanged(nameof(CanRefine)); } + partial void OnIsRefiningChanged(bool value) => OnPropertyChanged(nameof(CanRefine)); + partial void OnHasQueuedSubtasksChanged(bool value) { OnPropertyChanged(nameof(CanRemoveFromQueue)); diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/TasksIslandViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/TasksIslandViewModel.cs index 0875488..a042289 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/TasksIslandViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/TasksIslandViewModel.cs @@ -82,6 +82,8 @@ public sealed partial class TasksIslandViewModel : ViewModelBase _worker.WorktreeUpdatedEvent += OnWorkerTaskUpdated; _worker.ListUpdatedEvent += OnWorkerListUpdated; _worker.ConnectionRestoredEvent += () => LoadForList(_currentList); + _worker.RefineStartedEvent += OnRefineStarted; + _worker.RefineFinishedEvent += OnRefineFinished; } Loc.LanguageChanged += (_, _) => RefreshLocalizedText(); } @@ -830,6 +832,27 @@ public sealed partial class TasksIslandViewModel : ViewModelBase Regroup(); } + [RelayCommand] + private async Task RefineTask(TaskRowViewModel row) + { + if (row is null || !row.CanRefine) return; + row.IsRefining = true; + try { await _worker!.RefineTaskAsync(row.Id); } + catch { row.IsRefining = false; } + } + + private void OnRefineStarted(string taskId) + { + var row = Items.FirstOrDefault(r => r.Id == taskId); + if (row is not null) row.IsRefining = true; + } + + private void OnRefineFinished(string taskId, bool ok, string? error) + { + var row = Items.FirstOrDefault(r => r.Id == taskId); + if (row is not null) row.IsRefining = false; + } + partial void OnSelectedTaskChanged(TaskRowViewModel? value) { foreach (var i in Items) i.IsSelected = ReferenceEquals(i, value); diff --git a/src/ClaudeDo.Ui/Views/Islands/TaskRowView.axaml b/src/ClaudeDo.Ui/Views/Islands/TaskRowView.axaml index b00e5a7..e812356 100644 --- a/src/ClaudeDo.Ui/Views/Islands/TaskRowView.axaml +++ b/src/ClaudeDo.Ui/Views/Islands/TaskRowView.axaml @@ -69,7 +69,7 @@ Click="OnClearScheduleClick"/> - + + -