- Add central icon library (Icon.Sun/Activity/Star/Calendar/Eye/Inbox/Folder/Search/Plus/MoreHorizontal/GitBranch/Copy/Trash/Sort/X/Check) to IslandStyles.axaml - Add list-section-label, search-wrap, kbd, new-list-btn, avatar-circle styles - Add UpperCaseConverter, IconKeyConverter, DotBrushConverter; register in App.axaml - Expose SmartLists / UserLists filtered collections from ListsIslandViewModel - Add DotColorKey (Moss/Peat/Sage rotation) and UserInitials/UserName/MachineName props Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
920 B
C#
29 lines
920 B
C#
using System.Globalization;
|
|
using Avalonia;
|
|
using Avalonia.Data.Converters;
|
|
using Avalonia.Media;
|
|
|
|
namespace ClaudeDo.Ui.Converters;
|
|
|
|
/// <summary>
|
|
/// Converts an icon key string (e.g. "Sun") to the matching StreamGeometry resource "Icon.Sun".
|
|
/// </summary>
|
|
public class IconKeyConverter : IValueConverter
|
|
{
|
|
public static IconKeyConverter Instance { get; } = new();
|
|
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is not string key || string.IsNullOrEmpty(key))
|
|
return null;
|
|
|
|
var resourceKey = $"Icon.{key}";
|
|
if (Application.Current?.TryGetResource(resourceKey, null, out var res) == true)
|
|
return res as StreamGeometry;
|
|
return null;
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
=> throw new NotSupportedException();
|
|
}
|