fix(ui): wire details-island buttons and drop dead handlers
- Bind star button to ToggleStarCommand; wrap header and subtask done-check ellipses in buttons (ToggleDone / ToggleSubtaskDone). - Wire AgentStrip copy-path button to clipboard handler. - Remove dead Notes/PromptInput/ApproveMerge/ShowWorktreeModal code with no UI bindings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,8 +31,6 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
[ObservableProperty] private string _editableDescription = "";
|
[ObservableProperty] private string _editableDescription = "";
|
||||||
[ObservableProperty] private bool _isEditingDescription;
|
[ObservableProperty] private bool _isEditingDescription;
|
||||||
[ObservableProperty] private bool _isDescriptionExpanded = true;
|
[ObservableProperty] private bool _isDescriptionExpanded = true;
|
||||||
[ObservableProperty] private string _notes = "";
|
|
||||||
[ObservableProperty] private string _promptInput = "";
|
|
||||||
|
|
||||||
public bool IsDescriptionEditorVisible => IsDescriptionExpanded && IsEditingDescription;
|
public bool IsDescriptionEditorVisible => IsDescriptionExpanded && IsEditingDescription;
|
||||||
public bool IsDescriptionPreviewVisible => IsDescriptionExpanded && !IsEditingDescription;
|
public bool IsDescriptionPreviewVisible => IsDescriptionExpanded && !IsEditingDescription;
|
||||||
@@ -175,10 +173,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
// Set by the view so OpenDiffCommand can show the modal as a dialog
|
// Set by the view so OpenDiffCommand can show the modal as a dialog
|
||||||
public Func<DiffModalViewModel, System.Threading.Tasks.Task>? ShowDiffModal { get; set; }
|
public Func<DiffModalViewModel, System.Threading.Tasks.Task>? ShowDiffModal { get; set; }
|
||||||
|
|
||||||
// Set by the view so OpenWorktreeCommand can show the modal as a dialog
|
// Set by the view so OpenDiff can pass through merge requests from the diff modal
|
||||||
public Func<WorktreeModalViewModel, System.Threading.Tasks.Task>? ShowWorktreeModal { get; set; }
|
|
||||||
|
|
||||||
// Set by the view so ApproveMergeCommand can show the modal as a dialog
|
|
||||||
public Func<MergeModalViewModel, System.Threading.Tasks.Task>? ShowMergeModal { get; set; }
|
public Func<MergeModalViewModel, System.Threading.Tasks.Task>? ShowMergeModal { get; set; }
|
||||||
|
|
||||||
// Set by the view so DeleteTaskCommand can prompt yes/no before deleting
|
// Set by the view so DeleteTaskCommand can prompt yes/no before deleting
|
||||||
@@ -223,7 +218,6 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
DequeueCommand.NotifyCanExecuteChanged();
|
DequeueCommand.NotifyCanExecuteChanged();
|
||||||
ResetAndRetryCommand.NotifyCanExecuteChanged();
|
ResetAndRetryCommand.NotifyCanExecuteChanged();
|
||||||
ContinueCommand.NotifyCanExecuteChanged();
|
ContinueCommand.NotifyCanExecuteChanged();
|
||||||
ApproveMergeCommand.NotifyCanExecuteChanged();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -427,7 +421,6 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
_subscribedTaskId = null;
|
_subscribedTaskId = null;
|
||||||
EditableTitle = "";
|
EditableTitle = "";
|
||||||
EditableDescription = "";
|
EditableDescription = "";
|
||||||
Notes = "";
|
|
||||||
Model = null;
|
Model = null;
|
||||||
WorktreePath = null;
|
WorktreePath = null;
|
||||||
WorktreeStateLabel = null;
|
WorktreeStateLabel = null;
|
||||||
@@ -473,7 +466,6 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
_suppressDescSave = true;
|
_suppressDescSave = true;
|
||||||
try { EditableDescription = entity.Description ?? ""; }
|
try { EditableDescription = entity.Description ?? ""; }
|
||||||
finally { _suppressDescSave = false; }
|
finally { _suppressDescSave = false; }
|
||||||
Notes = entity.Notes ?? "";
|
|
||||||
Model = entity.Model;
|
Model = entity.Model;
|
||||||
WorktreePath = entity.Worktree?.Path;
|
WorktreePath = entity.Worktree?.Path;
|
||||||
WorktreeBaseCommit = entity.Worktree?.BaseCommit;
|
WorktreeBaseCommit = entity.Worktree?.BaseCommit;
|
||||||
@@ -737,29 +729,55 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
OpenDiffCommand.NotifyCanExecuteChanged();
|
OpenDiffCommand.NotifyCanExecuteChanged();
|
||||||
OpenWorktreeCommand.NotifyCanExecuteChanged();
|
OpenWorktreeCommand.NotifyCanExecuteChanged();
|
||||||
ApproveMergeCommand.NotifyCanExecuteChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void OnWorktreeStateLabelChanged(string? value)
|
|
||||||
{
|
|
||||||
ApproveMergeCommand.NotifyCanExecuteChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private async System.Threading.Tasks.Task SendPromptAsync()
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(PromptInput) || Task == null) return;
|
|
||||||
Log.Add(new LogLineViewModel { Kind = LogKind.Msg, Text = $"[you] {PromptInput}" });
|
|
||||||
// TODO: WorkerClient has no SendPromptAsync — no matching hub method found.
|
|
||||||
// When the worker gains a "SendPrompt" hub method, call:
|
|
||||||
// await _worker.SendPromptAsync(Task.Id, PromptInput);
|
|
||||||
PromptInput = "";
|
|
||||||
await System.Threading.Tasks.Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void CloseDetails() => CloseDetail?.Invoke();
|
private void CloseDetails() => CloseDetail?.Invoke();
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async System.Threading.Tasks.Task ToggleStarAsync()
|
||||||
|
{
|
||||||
|
if (Task is null) return;
|
||||||
|
Task.IsStarred = !Task.IsStarred;
|
||||||
|
await using var ctx = _dbFactory.CreateDbContext();
|
||||||
|
var repo = new TaskRepository(ctx);
|
||||||
|
var entity = await repo.GetByIdAsync(Task.Id);
|
||||||
|
if (entity is null) return;
|
||||||
|
entity.IsStarred = Task.IsStarred;
|
||||||
|
await repo.UpdateAsync(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async System.Threading.Tasks.Task ToggleDoneAsync()
|
||||||
|
{
|
||||||
|
if (Task is null) return;
|
||||||
|
Task.Done = !Task.Done;
|
||||||
|
await using var ctx = _dbFactory.CreateDbContext();
|
||||||
|
var repo = new TaskRepository(ctx);
|
||||||
|
var entity = await repo.GetByIdAsync(Task.Id);
|
||||||
|
if (entity is null) return;
|
||||||
|
entity.Status = Task.Done
|
||||||
|
? ClaudeDo.Data.Models.TaskStatus.Done
|
||||||
|
: ClaudeDo.Data.Models.TaskStatus.Idle;
|
||||||
|
Task.Status = entity.Status;
|
||||||
|
AgentStatusLabel = entity.Status.ToString();
|
||||||
|
await repo.UpdateAsync(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async System.Threading.Tasks.Task ToggleSubtaskDoneAsync(SubtaskRowViewModel? row)
|
||||||
|
{
|
||||||
|
if (row is null) return;
|
||||||
|
row.Done = !row.Done;
|
||||||
|
await using var ctx = _dbFactory.CreateDbContext();
|
||||||
|
var repo = new SubtaskRepository(ctx);
|
||||||
|
var subs = await repo.GetByTaskIdAsync(Task?.Id ?? "");
|
||||||
|
var entity = subs.FirstOrDefault(s => s.Id == row.Id);
|
||||||
|
if (entity is null) return;
|
||||||
|
entity.Completed = row.Done;
|
||||||
|
await repo.UpdateAsync(entity);
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private async System.Threading.Tasks.Task DeleteTaskAsync()
|
private async System.Threading.Tasks.Task DeleteTaskAsync()
|
||||||
{
|
{
|
||||||
@@ -813,30 +831,6 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
NewSubtaskTitle = "";
|
NewSubtaskTitle = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private async System.Threading.Tasks.Task SaveNotesAsync()
|
|
||||||
{
|
|
||||||
if (Task == null) return;
|
|
||||||
await using var ctx = _dbFactory.CreateDbContext();
|
|
||||||
var repo = new TaskRepository(ctx);
|
|
||||||
var entity = await repo.GetByIdAsync(Task.Id);
|
|
||||||
if (entity == null) return;
|
|
||||||
entity.Notes = Notes;
|
|
||||||
await repo.UpdateAsync(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand(CanExecute = nameof(CanMerge))]
|
|
||||||
private async System.Threading.Tasks.Task ApproveMergeAsync()
|
|
||||||
{
|
|
||||||
if (Task == null || ShowMergeModal == null) return;
|
|
||||||
var vm = _services.GetRequiredService<MergeModalViewModel>();
|
|
||||||
await vm.InitializeAsync(Task.Id, Task.Title);
|
|
||||||
await ShowMergeModal(vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CanMerge() =>
|
|
||||||
Task != null && _worker.IsConnected && WorktreePath != null && WorktreeStateLabel == "Active";
|
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private async System.Threading.Tasks.Task StopAsync()
|
private async System.Threading.Tasks.Task StopAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
<Button Grid.Column="2"
|
<Button Grid.Column="2"
|
||||||
Classes="icon-btn"
|
Classes="icon-btn"
|
||||||
ToolTip.Tip="Copy path"
|
ToolTip.Tip="Copy path"
|
||||||
|
Click="OnCopyWorktreePathClick"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
<PathIcon Data="{StaticResource Icon.Copy}" Width="11" Height="11"/>
|
<PathIcon Data="{StaticResource Icon.Copy}" Width="11" Height="11"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,8 +1,19 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input.Platform;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using ClaudeDo.Ui.ViewModels.Islands;
|
||||||
|
|
||||||
namespace ClaudeDo.Ui.Views.Islands;
|
namespace ClaudeDo.Ui.Views.Islands;
|
||||||
|
|
||||||
public partial class AgentStripView : UserControl
|
public partial class AgentStripView : UserControl
|
||||||
{
|
{
|
||||||
public AgentStripView() { InitializeComponent(); }
|
public AgentStripView() { InitializeComponent(); }
|
||||||
|
|
||||||
|
private async void OnCopyWorktreePathClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (DataContext is not DetailsIslandViewModel vm) return;
|
||||||
|
var clipboard = TopLevel.GetTopLevel(this)?.Clipboard;
|
||||||
|
if (clipboard is null || string.IsNullOrEmpty(vm.WorktreePath)) return;
|
||||||
|
await clipboard.SetTextAsync(vm.WorktreePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,13 +38,16 @@
|
|||||||
<!-- ── Header (sticky top): check · eyebrow · title · status · star · gear ── -->
|
<!-- ── Header (sticky top): check · eyebrow · title · status · star · gear ── -->
|
||||||
<Border DockPanel.Dock="Top" Classes="island-header">
|
<Border DockPanel.Dock="Top" Classes="island-header">
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
|
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
|
||||||
<Ellipse Grid.Column="0"
|
<Button Grid.Column="0" Classes="flat"
|
||||||
Classes="task-check"
|
Command="{Binding ToggleDoneCommand}"
|
||||||
|
Padding="0"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Margin="0,2,10,0">
|
||||||
|
<Ellipse Classes="task-check"
|
||||||
Classes.done="{Binding Task.Done}"
|
Classes.done="{Binding Task.Done}"
|
||||||
Width="18" Height="18"
|
Width="18" Height="18"
|
||||||
VerticalAlignment="Top"
|
|
||||||
Margin="0,2,10,0"
|
|
||||||
Cursor="Hand"/>
|
Cursor="Hand"/>
|
||||||
|
</Button>
|
||||||
<StackPanel Grid.Column="1" Spacing="0">
|
<StackPanel Grid.Column="1" Spacing="0">
|
||||||
<TextBlock Text="{Binding TaskIdBadge}"
|
<TextBlock Text="{Binding TaskIdBadge}"
|
||||||
FontFamily="{DynamicResource MonoFont}" FontSize="10"
|
FontFamily="{DynamicResource MonoFont}" FontSize="10"
|
||||||
@@ -62,6 +65,8 @@
|
|||||||
<Button Grid.Column="2"
|
<Button Grid.Column="2"
|
||||||
Classes="icon-btn star-btn"
|
Classes="icon-btn star-btn"
|
||||||
Classes.on="{Binding Task.IsStarred}"
|
Classes.on="{Binding Task.IsStarred}"
|
||||||
|
Command="{Binding ToggleStarCommand}"
|
||||||
|
ToolTip.Tip="Star"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Margin="6,0,0,0">
|
Margin="6,0,0,0">
|
||||||
<PathIcon Data="{StaticResource Icon.Star}" Width="14" Height="14"/>
|
<PathIcon Data="{StaticResource Icon.Star}" Width="14" Height="14"/>
|
||||||
@@ -176,13 +181,17 @@
|
|||||||
<Border Classes="subtask-row"
|
<Border Classes="subtask-row"
|
||||||
Classes.done="{Binding Done}">
|
Classes.done="{Binding Done}">
|
||||||
<Grid ColumnDefinitions="Auto,*">
|
<Grid ColumnDefinitions="Auto,*">
|
||||||
<Ellipse Grid.Column="0"
|
<Button Grid.Column="0" Classes="flat"
|
||||||
Classes="task-check"
|
Padding="0"
|
||||||
|
Margin="0,0,8,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{Binding $parent[ItemsControl].((vm:DetailsIslandViewModel)DataContext).ToggleSubtaskDoneCommand}"
|
||||||
|
CommandParameter="{Binding}">
|
||||||
|
<Ellipse Classes="task-check"
|
||||||
Classes.done="{Binding Done}"
|
Classes.done="{Binding Done}"
|
||||||
Width="16" Height="16"
|
Width="16" Height="16"
|
||||||
VerticalAlignment="Center"
|
Cursor="Hand"/>
|
||||||
Cursor="Hand"
|
</Button>
|
||||||
Margin="0,0,8,0"/>
|
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
Classes="subtask-title"
|
Classes="subtask-title"
|
||||||
Text="{Binding Title}"
|
Text="{Binding Title}"
|
||||||
|
|||||||
@@ -30,14 +30,6 @@ public partial class DetailsIslandView : UserControl
|
|||||||
await modal.ShowDialog(owner);
|
await modal.ShowDialog(owner);
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.ShowWorktreeModal = async (worktreeVm) =>
|
|
||||||
{
|
|
||||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
|
||||||
if (owner == null) return;
|
|
||||||
var modal = new WorktreeModalView { DataContext = worktreeVm };
|
|
||||||
await modal.ShowDialog(owner);
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.ShowMergeModal = async (mergeVm) =>
|
vm.ShowMergeModal = async (mergeVm) =>
|
||||||
{
|
{
|
||||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||||
@@ -143,12 +135,6 @@ public partial class DetailsIslandView : UserControl
|
|||||||
return await tcs.Task;
|
return await tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NotesLostFocus(object? sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (DataContext is DetailsIslandViewModel vm)
|
|
||||||
vm.SaveNotesCommand.Execute(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OnCopyDescriptionClick(object? sender, RoutedEventArgs e)
|
private async void OnCopyDescriptionClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext is not DetailsIslandViewModel vm) return;
|
if (DataContext is not DetailsIslandViewModel vm) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user