LogKindForegroundConverter drives the log message foreground via a local binding (beats the dim local value), so user messages render in the accent color instead of vanishing into the transcript. Adds a small stop (Icon.Stop) button next to Send in both composers (SessionTerminalView + WorkConsole) wired to InterruptInteractiveCommand → InterruptInteractiveSessionAsync. Adds session.composer.interrupt (en/de).
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System.Globalization;
|
|
using Avalonia;
|
|
using Avalonia.Data.Converters;
|
|
using Avalonia.Media;
|
|
using Avalonia.Styling;
|
|
using ClaudeDo.Ui.ViewModels.Islands;
|
|
|
|
namespace ClaudeDo.Ui.Converters;
|
|
|
|
public sealed class LogKindForegroundConverter : IValueConverter
|
|
{
|
|
private static IBrush? Resolve(string key)
|
|
{
|
|
if (Application.Current is { } app &&
|
|
app.Resources.TryGetResource(key, app.ActualThemeVariant, out var res) &&
|
|
res is IBrush brush)
|
|
{
|
|
return brush;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
var key = value is LogKind kind ? kind switch
|
|
{
|
|
LogKind.Sys => "TextMuteBrush",
|
|
LogKind.Tool => "SageBrush",
|
|
LogKind.Claude => "TextBrush",
|
|
LogKind.Stdout => "TextDimBrush",
|
|
LogKind.Stderr => "BloodBrush",
|
|
LogKind.Done => "MossBrightBrush",
|
|
LogKind.Msg => "TextDimBrush",
|
|
LogKind.User => "AccentBrush",
|
|
_ => "TextDimBrush",
|
|
} : "TextDimBrush";
|
|
|
|
return Resolve(key) ?? AvaloniaProperty.UnsetValue;
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
|
throw new NotSupportedException();
|
|
}
|