fix(ui): diff viewer opens non-modal and maximizable

The diff viewer used ShowDialog at both call sites (task details, worktrees
overview), blocking navigation of the rest of the app while open. Switch both
to Window.Show(owner) and reuse the one open window (swap DataContext,
Activate()) instead of stacking a second one on re-open.

Add an opt-in maximize/restore button + double-click-titlebar toggle to
ModalShell (ShowMaximizeButton, default false so other modals are untouched),
wired on for DiffViewerView only. Reuses the existing Icon.WinMax/WinRestore
geometry and OffScreenMargin inset from MainWindow's own maximize handling.

The review gate (Approve & Merge locked until the diff is opened) already
fires DiffViewed before the dialog/window is shown, so it is unaffected by
the modal-to-non-modal change.
This commit is contained in:
mika kuns
2026-08-10 13:46:56 +02:00
parent 6a2a19cc9e
commit f74c7dd70b
7 changed files with 95 additions and 11 deletions
+16 -2
View File
@@ -27,6 +27,7 @@ public sealed class WindowDialogService : IDialogService
{
private readonly Window _owner;
private MissionControlWindow? _missionControl;
private DiffViewerView? _diffViewerWindow;
public WindowDialogService(Window owner) => _owner = owner;
@@ -108,10 +109,23 @@ public sealed class WindowDialogService : IDialogService
};
vm.ShowDiffAction = diffVm =>
{
_ = diffVm.LoadAsync();
// Non-modal: must not block the (still-open) worktrees overview or the main
// window behind it. Reuse the one open window rather than stacking a second.
if (_diffViewerWindow is { } existing)
{
existing.DataContext = diffVm;
diffVm.CloseAction = () => existing.Close();
if (existing.WindowState == WindowState.Minimized)
existing.WindowState = WindowState.Normal;
existing.Activate();
return;
}
var diffDlg = new DiffViewerView { DataContext = diffVm };
diffVm.CloseAction = () => diffDlg.Close();
_ = diffVm.LoadAsync();
_ = diffDlg.ShowDialog(_owner);
diffDlg.Closed += (_, _) => _diffViewerWindow = null;
_diffViewerWindow = diffDlg;
diffDlg.Show(_owner);
};
vm.ConfirmAction = ConfirmAsync;
if (Shell is { } shell)