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

namespace ClaudeDo.Ui.Views.Islands;

public partial class NotesEditorView : UserControl
{
    public NotesEditorView() => InitializeComponent();

    private void OnBulletLostFocus(object? sender, RoutedEventArgs e)
    {
        if (sender is TextBox { DataContext: NoteBulletViewModel bullet }
            && DataContext is NotesEditorViewModel vm
            && vm.CommitBulletCommand.CanExecute(bullet))
            vm.CommitBulletCommand.Execute(bullet);
    }
}
