feat(ui): drag a task into Mission Control to queue it
This commit is contained in:
@@ -5,6 +5,7 @@ using Avalonia.Interactivity;
|
||||
using Avalonia.VisualTree;
|
||||
using ClaudeDo.Ui.ViewModels;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
using ClaudeDo.Ui.Views.Islands;
|
||||
|
||||
namespace ClaudeDo.Ui.Views.MissionControl;
|
||||
|
||||
@@ -23,15 +24,28 @@ public partial class MissionControlView : UserControl
|
||||
|
||||
private void OnPaneDragOver(object? sender, DragEventArgs e)
|
||||
{
|
||||
e.DragEffects = (e.DataTransfer?.Contains(PaneFormat) ?? false)
|
||||
? DragDropEffects.Move
|
||||
: DragDropEffects.None;
|
||||
var dt = e.DataTransfer;
|
||||
var accept = (dt?.Contains(PaneFormat) ?? false)
|
||||
|| (dt?.Contains(TasksIslandView.TaskRowFormat) ?? false);
|
||||
e.DragEffects = accept ? DragDropEffects.Move : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void OnPaneDrop(object? sender, DragEventArgs e)
|
||||
{
|
||||
if (DataContext is not MissionControlViewModel vm) return;
|
||||
var draggedId = e.DataTransfer?.TryGetValue(PaneFormat);
|
||||
var dt = e.DataTransfer;
|
||||
if (dt is null) return;
|
||||
|
||||
// A task dragged from the main app → queue it.
|
||||
var taskId = dt.TryGetValue(TasksIslandView.TaskRowFormat);
|
||||
if (!string.IsNullOrEmpty(taskId))
|
||||
{
|
||||
_ = vm.EnqueueTaskAsync(taskId);
|
||||
return;
|
||||
}
|
||||
|
||||
// A pane dragged within the grid → reorder.
|
||||
var draggedId = dt.TryGetValue(PaneFormat);
|
||||
if (string.IsNullOrEmpty(draggedId)) return;
|
||||
if (e.Source is not Avalonia.Visual src) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user