fix(ui): wire delete confirm, close-details, uppercase eyebrow, explorer button

- A1: list-name eyebrow runs through UpperCase converter.
- D2: + Open-in-explorer icon button in AgentStrip (Process.Start on worktree path).
- D4: DeleteTaskCommand prompts inline confirm Window before deleting; shell
  wires Details.CloseDetail to clear Tasks.SelectedTask and Details.DeleteFromList
  to reload the current list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-04-20 11:47:10 +02:00
parent 9b1178ca2f
commit 5acc896d5c
5 changed files with 85 additions and 1 deletions

View File

@@ -78,6 +78,9 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
// Set by the view so OpenWorktreeCommand can show the modal as a dialog // Set by the view so OpenWorktreeCommand can show the modal as a dialog
public Func<WorktreeModalViewModel, System.Threading.Tasks.Task>? ShowWorktreeModal { get; set; } public Func<WorktreeModalViewModel, System.Threading.Tasks.Task>? ShowWorktreeModal { get; set; }
// Set by the view so DeleteTaskCommand can prompt yes/no before deleting
public Func<string, System.Threading.Tasks.Task<bool>>? ConfirmAsync { get; set; }
public DetailsIslandViewModel(IDbContextFactory<ClaudeDoDbContext> dbFactory, WorkerClient worker, IServiceProvider services) public DetailsIslandViewModel(IDbContextFactory<ClaudeDoDbContext> dbFactory, WorkerClient worker, IServiceProvider services)
{ {
_dbFactory = dbFactory; _dbFactory = dbFactory;
@@ -186,10 +189,26 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
private bool CanOpenWorktree() => WorktreePath != null; private bool CanOpenWorktree() => WorktreePath != null;
[RelayCommand(CanExecute = nameof(CanOpenWorktree))]
private void OpenInExplorer()
{
if (WorktreePath == null) return;
try
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
{
FileName = WorktreePath,
UseShellExecute = true,
});
}
catch { /* explorer open is best-effort */ }
}
partial void OnWorktreePathChanged(string? value) partial void OnWorktreePathChanged(string? value)
{ {
OpenDiffCommand.NotifyCanExecuteChanged(); OpenDiffCommand.NotifyCanExecuteChanged();
OpenWorktreeCommand.NotifyCanExecuteChanged(); OpenWorktreeCommand.NotifyCanExecuteChanged();
OpenInExplorerCommand.NotifyCanExecuteChanged();
} }
[RelayCommand] [RelayCommand]
@@ -212,6 +231,11 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
{ {
if (Task == null) return; if (Task == null) return;
var row = Task; var row = Task;
if (ConfirmAsync != null)
{
var ok = await ConfirmAsync($"Delete \"{row.Title}\"? This cannot be undone.");
if (!ok) return;
}
await using var ctx = _dbFactory.CreateDbContext(); await using var ctx = _dbFactory.CreateDbContext();
var repo = new TaskRepository(ctx); var repo = new TaskRepository(ctx);
await repo.DeleteAsync(row.Id); await repo.DeleteAsync(row.Id);

View File

@@ -42,6 +42,12 @@ public sealed partial class IslandsShellViewModel : ViewModelBase
Lists = lists; Tasks = tasks; Details = details; Lists = lists; Tasks = tasks; Details = details;
Lists.SelectionChanged += (_, _) => Tasks.LoadForList(Lists.SelectedList); Lists.SelectionChanged += (_, _) => Tasks.LoadForList(Lists.SelectedList);
Tasks.SelectionChanged += (_, _) => Details.Bind(Tasks.SelectedTask); Tasks.SelectionChanged += (_, _) => Details.Bind(Tasks.SelectedTask);
Details.CloseDetail = () => Tasks.SelectedTask = null;
Details.DeleteFromList = _ =>
{
Tasks.LoadForList(Lists.SelectedList);
return System.Threading.Tasks.Task.CompletedTask;
};
_ = Lists.LoadAsync(); _ = Lists.LoadAsync();
} }
} }

View File

@@ -124,6 +124,10 @@
<StackPanel Orientation="Horizontal" Spacing="6" Margin="0,4,0,0"> <StackPanel Orientation="Horizontal" Spacing="6" Margin="0,4,0,0">
<Button Classes="btn" Content="Open diff" Command="{Binding OpenDiffCommand}"/> <Button Classes="btn" Content="Open diff" Command="{Binding OpenDiffCommand}"/>
<Button Classes="btn" Content="Worktree" Command="{Binding OpenWorktreeCommand}"/> <Button Classes="btn" Content="Worktree" Command="{Binding OpenWorktreeCommand}"/>
<Button Classes="icon-btn" ToolTip.Tip="Open in file explorer"
Command="{Binding OpenInExplorerCommand}">
<TextBlock Text="→" FontFamily="{DynamicResource MonoFont}" FontSize="13"/>
</Button>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@@ -1,5 +1,8 @@
using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Layout;
using Avalonia.Media;
using ClaudeDo.Ui.ViewModels.Islands; using ClaudeDo.Ui.ViewModels.Islands;
using ClaudeDo.Ui.Views.Modals; using ClaudeDo.Ui.Views.Modals;
@@ -32,9 +35,56 @@ public partial class DetailsIslandView : UserControl
var modal = new WorktreeModalView { DataContext = worktreeVm }; var modal = new WorktreeModalView { DataContext = worktreeVm };
await modal.ShowDialog(owner); await modal.ShowDialog(owner);
}; };
vm.ConfirmAsync = ShowConfirmAsync;
} }
} }
private async System.Threading.Tasks.Task<bool> ShowConfirmAsync(string message)
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner == null) return false;
var tcs = new TaskCompletionSource<bool>();
var cancel = new Button { Content = "Cancel", MinWidth = 90 };
var confirm = new Button { Content = "Delete", MinWidth = 90, Classes = { "danger" } };
var dialog = new Window
{
Title = "Confirm",
Width = 360,
SizeToContent = SizeToContent.Height,
CanResize = false,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
ShowInTaskbar = false,
Background = this.FindResource("SurfaceBrush") as IBrush,
Content = new StackPanel
{
Spacing = 16,
Margin = new Thickness(20),
Children =
{
new TextBlock { Text = message, TextWrapping = TextWrapping.Wrap },
new StackPanel
{
Orientation = Orientation.Horizontal,
Spacing = 8,
HorizontalAlignment = HorizontalAlignment.Right,
Children = { cancel, confirm }
}
}
}
};
cancel.Click += (_, _) => { tcs.TrySetResult(false); dialog.Close(); };
confirm.Click += (_, _) => { tcs.TrySetResult(true); dialog.Close(); };
dialog.Closed += (_, _) => tcs.TrySetResult(false);
_ = dialog.ShowDialog(owner);
return await tcs.Task;
}
private void NotesLostFocus(object? sender, RoutedEventArgs e) private void NotesLostFocus(object? sender, RoutedEventArgs e)
{ {
if (DataContext is DetailsIslandViewModel vm) if (DataContext is DetailsIslandViewModel vm)

View File

@@ -46,7 +46,7 @@
Foreground="{DynamicResource TextFaintBrush}" Foreground="{DynamicResource TextFaintBrush}"
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
<!-- current list name --> <!-- current list name -->
<TextBlock Text="{Binding Lists.SelectedList.Name}" <TextBlock Text="{Binding Lists.SelectedList.Name, Converter={StaticResource UpperCase}}"
FontFamily="{DynamicResource MonoFont}" FontFamily="{DynamicResource MonoFont}"
FontSize="11" FontSize="11"
Foreground="{DynamicResource TextDimBrush}" Foreground="{DynamicResource TextDimBrush}"