diff --git a/src/TeamsISO.App/App.xaml b/src/TeamsISO.App/App.xaml index abef318..0c6fdab 100644 --- a/src/TeamsISO.App/App.xaml +++ b/src/TeamsISO.App/App.xaml @@ -4,7 +4,7 @@ - + diff --git a/src/TeamsISO.App/Converters/InitialsConverter.cs b/src/TeamsISO.App/Converters/InitialsConverter.cs new file mode 100644 index 0000000..448c807 --- /dev/null +++ b/src/TeamsISO.App/Converters/InitialsConverter.cs @@ -0,0 +1,30 @@ +using System.Globalization; +using System.Windows.Data; + +namespace TeamsISO.App.Converters; + +/// +/// Converts a display name to up to two uppercase initials for an avatar bubble. +/// "Brendon Power" → "BP". "(Local)" → "L". Falls back to "·" for empty inputs. +/// +public sealed class InitialsConverter : IValueConverter +{ + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + var s = value as string; + if (string.IsNullOrWhiteSpace(s)) return "·"; + + // Strip surrounding parens / punctuation that would otherwise become + // useless initials (e.g. "(Local)" should yield "L", not "("). + var cleaned = new string(s.Where(c => char.IsLetterOrDigit(c) || char.IsWhiteSpace(c)).ToArray()).Trim(); + if (cleaned.Length == 0) return "·"; + + var parts = cleaned.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + if (parts.Length == 0) return "·"; + if (parts.Length == 1) return char.ToUpperInvariant(parts[0][0]).ToString(); + return $"{char.ToUpperInvariant(parts[0][0])}{char.ToUpperInvariant(parts[^1][0])}"; + } + + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + => throw new NotSupportedException(); +} diff --git a/src/TeamsISO.App/MainWindow.xaml b/src/TeamsISO.App/MainWindow.xaml index dda478a..9f8fd2c 100644 --- a/src/TeamsISO.App/MainWindow.xaml +++ b/src/TeamsISO.App/MainWindow.xaml @@ -4,9 +4,9 @@ xmlns:vm="clr-namespace:TeamsISO.App.ViewModels" xmlns:conv="clr-namespace:TeamsISO.App.Converters" Title="TeamsISO" - Height="760" Width="1180" - MinHeight="600" MinWidth="960" - Background="{DynamicResource Stone.Canvas}" + Height="780" Width="1280" + MinHeight="640" MinWidth="1080" + Background="{DynamicResource Wd.Canvas}" UseLayoutRounding="True" TextOptions.TextFormattingMode="Ideal" TextOptions.TextRenderingMode="ClearType"> @@ -14,294 +14,259 @@ + - + + + + + + - - - - + + + + + + + + - - - - - - - + + - - - - - - - - - - + + +