chore(ui): remove unused CheckboxBorderConverter, DateOnlyToDateTimeConverter, StatusColorConverter/ConnectionColorConverter
This commit is contained in:
@@ -84,9 +84,9 @@ single-task and planning unit-merge conflicts. Full detail →
|
|||||||
|
|
||||||
## Converters
|
## Converters
|
||||||
|
|
||||||
In `Converters/` — grep rather than list: status/connection colors, log-level brush, dot brush,
|
In `Converters/` — grep rather than list: log-level brush, dot brush,
|
||||||
status equality, icon key, checkbox border, strike/italic/opacity toggles, null→bool,
|
status equality, icon key, strike/italic/opacity toggles, null→bool,
|
||||||
uppercase, `DateOnly`↔`DateTime`.
|
uppercase.
|
||||||
|
|
||||||
## Dialog Pattern
|
## Dialog Pattern
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace ClaudeDo.Ui.Converters;
|
|
||||||
|
|
||||||
public sealed class CheckboxBorderConverter : IValueConverter
|
|
||||||
{
|
|
||||||
public static readonly CheckboxBorderConverter Instance = new();
|
|
||||||
|
|
||||||
private static readonly ISolidColorBrush Gray = new SolidColorBrush(Color.Parse("#475569"));
|
|
||||||
private static readonly ISolidColorBrush Orange = new SolidColorBrush(Color.Parse("#e67e22"));
|
|
||||||
private static readonly ISolidColorBrush Green = new SolidColorBrush(Color.Parse("#3d9474"));
|
|
||||||
private static readonly ISolidColorBrush Red = new SolidColorBrush(Color.Parse("#ef4444"));
|
|
||||||
|
|
||||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
return value?.ToString()?.ToLowerInvariant() switch
|
|
||||||
{
|
|
||||||
"running" => Orange,
|
|
||||||
"done" => Green,
|
|
||||||
"failed" => Red,
|
|
||||||
_ => Gray, // manual, queued
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
=> throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using System.Globalization;
|
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
|
|
||||||
namespace ClaudeDo.Ui.Converters;
|
|
||||||
|
|
||||||
public sealed class DateOnlyToDateTimeConverter : IValueConverter
|
|
||||||
{
|
|
||||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
if (value is DateOnly d)
|
|
||||||
return d.ToDateTime(TimeOnly.MinValue);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
if (value is DateTime dt)
|
|
||||||
return DateOnly.FromDateTime(dt);
|
|
||||||
if (value is DateTimeOffset dto)
|
|
||||||
return DateOnly.FromDateTime(dto.LocalDateTime);
|
|
||||||
return DateOnly.FromDateTime(DateTime.Today);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
using System.Globalization;
|
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace ClaudeDo.Ui.Converters;
|
|
||||||
|
|
||||||
public class StatusColorConverter : IValueConverter
|
|
||||||
{
|
|
||||||
public static StatusColorConverter Instance { get; } = new();
|
|
||||||
|
|
||||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
var status = value?.ToString()?.ToLowerInvariant();
|
|
||||||
return status switch
|
|
||||||
{
|
|
||||||
"queued" => Brushes.DodgerBlue,
|
|
||||||
"running" => Brushes.Orange,
|
|
||||||
"waitingforreview" => Brushes.MediumPurple,
|
|
||||||
"waiting_for_review" => Brushes.MediumPurple,
|
|
||||||
"waitingforchildren" => Brushes.DarkOrange,
|
|
||||||
"done" => Brushes.Green,
|
|
||||||
"failed" => Brushes.Red,
|
|
||||||
"manual" => Brushes.Gray,
|
|
||||||
_ => Brushes.Transparent,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
=> throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ConnectionColorConverter : IValueConverter
|
|
||||||
{
|
|
||||||
public static ConnectionColorConverter Instance { get; } = new();
|
|
||||||
|
|
||||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
var text = value?.ToString();
|
|
||||||
return text == "Online" ? Brushes.Green : Brushes.Red;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
=> throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user