feat(daily-prep): reuse SessionTerminal for prep log; fix invisible Sort icon; add Broom/List icons

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-04 09:08:04 +02:00
parent fab17720cc
commit f7d1b37343
4 changed files with 54 additions and 43 deletions

View File

@@ -1,30 +1,50 @@
using System.Collections;
using System.Collections.Specialized;
using Avalonia;
using Avalonia.Controls;
using ClaudeDo.Ui.ViewModels.Islands;
namespace ClaudeDo.Ui.Views.Islands;
public partial class SessionTerminalView : UserControl
{
public static readonly StyledProperty<IEnumerable?> EntriesProperty =
AvaloniaProperty.Register<SessionTerminalView, IEnumerable?>(nameof(Entries));
public static readonly StyledProperty<string?> LabelProperty =
AvaloniaProperty.Register<SessionTerminalView, string?>(nameof(Label));
public static readonly StyledProperty<bool> IsRunningProperty =
AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsRunning));
public static readonly StyledProperty<bool> IsDoneProperty =
AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsDone));
public static readonly StyledProperty<bool> IsFailedProperty =
AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsFailed));
public IEnumerable? Entries { get => GetValue(EntriesProperty); set => SetValue(EntriesProperty, value); }
public string? Label { get => GetValue(LabelProperty); set => SetValue(LabelProperty, value); }
public bool IsRunning { get => GetValue(IsRunningProperty); set => SetValue(IsRunningProperty, value); }
public bool IsDone { get => GetValue(IsDoneProperty); set => SetValue(IsDoneProperty, value); }
public bool IsFailed { get => GetValue(IsFailedProperty); set => SetValue(IsFailedProperty, value); }
private INotifyCollectionChanged? _subscribedCollection;
public SessionTerminalView() { InitializeComponent(); }
private DetailsIslandViewModel? _boundVm;
protected override void OnDataContextChanged(EventArgs e)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnDataContextChanged(e);
if (_boundVm is not null)
_boundVm.Log.CollectionChanged -= OnLogChanged;
_boundVm = DataContext as DetailsIslandViewModel;
if (_boundVm is not null)
_boundVm.Log.CollectionChanged += OnLogChanged;
base.OnPropertyChanged(change);
if (change.Property != EntriesProperty) return;
if (_subscribedCollection is not null)
_subscribedCollection.CollectionChanged -= OnEntriesChanged;
_subscribedCollection = change.NewValue as INotifyCollectionChanged;
if (_subscribedCollection is not null)
_subscribedCollection.CollectionChanged += OnEntriesChanged;
}
private void OnLogChanged(object? sender, NotifyCollectionChangedEventArgs e)
private void OnEntriesChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action != NotifyCollectionChangedAction.Add) return;
// Scroll after the next layout pass so the freshly-added (wrapping) line
// is measured first — otherwise ScrollToEnd stops short and clips it.
EventHandler? handler = null;
handler = (_, _) =>
{