using Avalonia.Controls;
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using ClaudeDo.Ui.ViewModels.Islands;

namespace ClaudeDo.Ui.Views.Islands;

public partial class AgentStripView : UserControl
{
    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);
    }
}
