feat(ui): maximize work console via green traffic-light dot

This commit is contained in:
mika kuns
2026-06-05 10:27:47 +02:00
parent 2dfc4559b1
commit de4ad5dcf3
6 changed files with 79 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
using System.ComponentModel;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
@@ -10,6 +11,8 @@ namespace ClaudeDo.Ui.Views.Islands;
public partial class DetailsIslandView : UserControl
{
private DetailsIslandViewModel? _subscribedVm;
public DetailsIslandView()
{
InitializeComponent();
@@ -18,6 +21,15 @@ public partial class DetailsIslandView : UserControl
private void OnDataContextChanged(object? sender, EventArgs e)
{
if (_subscribedVm is not null)
_subscribedVm.PropertyChanged -= OnVmPropertyChanged;
_subscribedVm = DataContext as DetailsIslandViewModel;
if (_subscribedVm is not null)
{
_subscribedVm.PropertyChanged += OnVmPropertyChanged;
ApplyConsoleMaximized(_subscribedVm.IsConsoleMaximized);
}
if (DataContext is DetailsIslandViewModel vm)
{
vm.ShowDiffModal = async (diffVm) =>
@@ -49,6 +61,24 @@ public partial class DetailsIslandView : UserControl
}
}
private void OnVmPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(DetailsIslandViewModel.IsConsoleMaximized)
&& sender is DetailsIslandViewModel vm)
ApplyConsoleMaximized(vm.IsConsoleMaximized);
}
// Maximized: shrink the description row to its MinHeight (the console fills
// the rest). Restored: back to the 2:1 default. The GridSplitter keeps both
// states draggable; MinHeight stops the console from ever covering it.
private void ApplyConsoleMaximized(bool maximized)
{
var descRow = DetailBodyGrid.RowDefinitions[0];
descRow.Height = maximized
? new GridLength(descRow.MinHeight, GridUnitType.Pixel)
: new GridLength(2, GridUnitType.Star);
}
private async System.Threading.Tasks.Task ShowErrorDialogAsync(string message)
{
var owner = TopLevel.GetTopLevel(this) as Window;