@using MatrixRoomUtils.Core.Responses
@using MatrixRoomUtils.Core.StateEventTypes
@using MatrixRoomUtils.Core.Helpers
@ProfileName
@if (ChildContent is not null) {
@ChildContent
}
@code {
[Parameter]
public RenderFragment? ChildContent { get; set; }
[Parameter]
public ProfileResponse User { get; set; }
[Parameter]
public string? UserId { get; set; }
[Parameter]
public string? ProfileAvatar { get; set; } = null;
[Parameter]
public string? ProfileName { get; set; } = null;
private static SemaphoreSlim _semaphoreSlim = new(128);
protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync();
var hs = await MRUStorage.GetCurrentSession();
await _semaphoreSlim.WaitAsync();
if (User == null && UserId == null)
throw new ArgumentNullException(nameof(UserId));
User ??= await hs.GetProfile(UserId);
ProfileAvatar ??= MediaResolver.ResolveMediaUri(hs.FullHomeServerDomain, User.AvatarUrl);
ProfileName ??= User.DisplayName;
_semaphoreSlim.Release();
}
}