@if (!string.IsNullOrWhiteSpace(User?.AvatarUrl)) {
}
else {
)
}
@User?.DisplayName
@if (ChildContent is not null) {
@ChildContent
}
@code {
[Parameter]
public RenderFragment? ChildContent { get; set; }
[Parameter]
public UserProfileResponse? User { get; set; }
[Parameter]
public string UserId { get; set; }
[Parameter]
public AuthenticatedHomeserverGeneric _homeserver { get; set; }
private static SvgIdenticonGenerator _identiconGenerator = new();
protected override async Task OnInitializedAsync() {
// _homeserver = await sessionStore.GetCurrentHomeserver(navigateOnFailure: true);
// if (_homeserver is null) return;
if (User == null) {
if (UserId == null) {
throw new ArgumentNullException(nameof(UserId));
}
try {
User = await _homeserver.GetProfileAsync(UserId);
}
catch (Exception) {
User = new() {
DisplayName = UserId
};
}
}
await base.OnInitializedAsync();
}
}