@using MatrixRoomUtils.Core.Responses
@profileName
@if (ChildContent != null) { @ChildContent }
@code { [Parameter] public RenderFragment? ChildContent { get; set; } [Parameter] public ProfileResponse User { get; set; } [Parameter] public string UserId { get; set; } private string? profileAvatar { get; set; } = "/icon-192.png"; private string? profileName { get; set; } = "Loading..."; private static SemaphoreSlim _semaphoreSlim = new(8); protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); await _semaphoreSlim.WaitAsync(); if (User == null) { if (UserId == null) { throw new ArgumentNullException(nameof(UserId)); } User = await RuntimeCache.CurrentHomeServer.GetProfile(UserId); } // UserId = User.; profileAvatar = RuntimeCache.CurrentHomeServer.ResolveMediaUri(User.AvatarUrl); profileName = User.DisplayName; _semaphoreSlim.Release(); if (Random.Shared.Next(100) == 1) await LocalStorageWrapper.SaveCacheToLocalStorage(LocalStorage); } }