feat(attachments): drag-and-drop file attachments on the detail pane
Drop a file anywhere on the detail pane to attach it: pane-wide drop target with a 'Drop to attach' hover overlay (Copy cursor, gated on an idle selected task), an explicit lingering confirmation/error line, plus an Attachments list with size, remove, and an Add file… picker in the DETAILS card. ComposedPreview now shows the reference files too. en/de keys added.
This commit is contained in:
@@ -2,6 +2,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Input.Platform;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
namespace ClaudeDo.Ui.Views.Islands.Detail;
|
||||
@@ -34,4 +35,32 @@ public partial class DescriptionStepsCard : UserControl
|
||||
&& vm.CommitSubtaskEditCommand.CanExecute(row))
|
||||
vm.CommitSubtaskEditCommand.Execute(row);
|
||||
}
|
||||
|
||||
private async void OnAddFileClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is not DetailsIslandViewModel vm) return;
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
if (topLevel is null) return;
|
||||
|
||||
var picked = await topLevel.StorageProvider.OpenFilePickerAsync(
|
||||
new FilePickerOpenOptions { AllowMultiple = true });
|
||||
|
||||
if (picked.Count == 0) return;
|
||||
|
||||
var files = new List<(string FileName, System.IO.Stream Content)>();
|
||||
foreach (var item in picked)
|
||||
{
|
||||
var stream = await item.OpenReadAsync();
|
||||
files.Add((item.Name, stream));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await vm.AddFilesAsync(files);
|
||||
}
|
||||
finally
|
||||
{
|
||||
foreach (var (_, s) in files) await s.DisposeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user