@using System.Text @using HopFrame.Core.Config @using HopFrame.Core.Services HopFrame @if (Config.DisplayUserInfo) { } @inject HopFrameConfig Config @inject IHopFrameAuthHandler Handler @code { private string? _displayName; private string? _initials; protected override async Task OnInitializedAsync() { if (Config.DisplayUserInfo) { _displayName = await Handler.GetCurrentUserDisplayNameAsync(); _initials = GetInitials(_displayName); } } private static string GetInitials(string input) { if (string.IsNullOrEmpty(input)) return string.Empty; StringBuilder initials = new StringBuilder(); string[] words = input.Split([' ', '.', '_'], StringSplitOptions.RemoveEmptyEntries); foreach (string word in words) { if (!string.IsNullOrEmpty(word) && char.IsLetter(word[0])) initials.Append(word[0]); } return initials.ToString().ToUpper(); } }