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

namespace ClaudeDo.Ui.Views.Islands.Detail;

public partial class TaskHeaderBar : UserControl
{
    public TaskHeaderBar()
    {
        InitializeComponent();
    }

    private async void OnTaskIdTapped(object? sender, TappedEventArgs e)
    {
        if (DataContext is not DetailsIslandViewModel vm || vm.Task is null) return;
        var clipboard = TopLevel.GetTopLevel(this)?.Clipboard;
        if (clipboard is null) return;
        await clipboard.SetTextAsync(vm.Task.Id);
    }
}
