Iceshrimp.NET/Iceshrimp.Frontend/Components/Note/NoteUserInfo.razor
Samuel Proulx 104555f4f2
[frontend/components] Change the role of profile images on notes to a link.
As it can be clicked to view profile. And add display name as alt text for the image.
2024-10-24 20:55:07 +02:00

29 lines
No EOL
978 B
Text

@inject NavigationManager Nav
@if (Indented == false)
{
<img @onclick="OpenProfile" class="user-avatar" src="@AvatarUrl" alt="@(DisplayName ?? Username)" role="link"/>
}
<div class="name-section">
<span class="display-name">@(DisplayName ?? Username)</span>
<span class="identifier">@@@Username@(Host != null ? $"@{Host}" : "")</span>
</div>
@code {
[Parameter] [EditorRequired] public required string AvatarUrl { get; set; }
[Parameter] [EditorRequired] public required string? DisplayName { get; set; }
[Parameter] [EditorRequired] public required string Username { get; set; }
[Parameter] [EditorRequired] public required bool Indented { get; set; }
[Parameter] [EditorRequired] public required string? Host { get; set; }
private void OpenProfile()
{
var path = $"@{Username}";
if (Host?.Length > 0)
{
path += $"@{Host}";
}
Nav.NavigateTo($"/{path}");
}
}