fix(ui): wire modal delegates from DetailsIslandView owner

Moved ShowDiffModal/ShowWorktreeModal delegate wiring from
AgentStripView (child, possibly detached) to DetailsIslandView
(the VM's DataContext owner). TopLevel is resolved at invocation
time, not at wiring time, so attachment order no longer matters.
AgentStripView reduced to InitializeComponent() only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-04-20 11:00:45 +02:00
parent 95146518b2
commit 279f2c7598
2 changed files with 30 additions and 31 deletions

View File

@@ -1,8 +1,36 @@
using Avalonia.Controls;
using ClaudeDo.Ui.ViewModels.Islands;
using ClaudeDo.Ui.Views.Modals;
namespace ClaudeDo.Ui.Views.Islands;
public partial class DetailsIslandView : UserControl
{
public DetailsIslandView() { InitializeComponent(); }
public DetailsIslandView()
{
InitializeComponent();
DataContextChanged += OnDataContextChanged;
}
private void OnDataContextChanged(object? sender, EventArgs e)
{
if (DataContext is DetailsIslandViewModel vm)
{
vm.ShowDiffModal = async (diffVm) =>
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner == null) return;
var modal = new DiffModalView { DataContext = diffVm };
await modal.ShowDialog(owner);
};
vm.ShowWorktreeModal = async (worktreeVm) =>
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner == null) return;
var modal = new WorktreeModalView { DataContext = worktreeVm };
await modal.ShowDialog(owner);
};
}
}
}