@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; }
[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();
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();
}
}