[frontend/components] Refactor NoteUserInfo
This commit is contained in:
parent
f04572fc4f
commit
c14daf2531
2 changed files with 10 additions and 17 deletions
|
@ -5,12 +5,7 @@
|
||||||
@inject ComposeService ComposeService
|
@inject ComposeService ComposeService
|
||||||
@inject SessionService Session;
|
@inject SessionService Session;
|
||||||
<div class="note-header">
|
<div class="note-header">
|
||||||
<NoteUserInfo
|
<NoteUserInfo User="@Note.User" Indented="Indented"/>
|
||||||
AvatarUrl="@Note.User.AvatarUrl"
|
|
||||||
DisplayName="@Note.User.DisplayName"
|
|
||||||
Username="@Note.User.Username"
|
|
||||||
Host="@Note.User.Host"
|
|
||||||
Indented="Indented"/>
|
|
||||||
<NoteMetadata
|
<NoteMetadata
|
||||||
Visibility="@Note.Visibility"
|
Visibility="@Note.Visibility"
|
||||||
InstanceName="@Note.User.InstanceName"
|
InstanceName="@Note.User.InstanceName"
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
|
@using Iceshrimp.Shared.Schemas.Web
|
||||||
@inject NavigationManager Nav
|
@inject NavigationManager Nav
|
||||||
|
|
||||||
@if (Indented == false)
|
@if (Indented == false)
|
||||||
{
|
{
|
||||||
<img @onclick="OpenProfile" class="user-avatar" src="@AvatarUrl" alt="@(DisplayName ?? Username)" role="link"/>
|
<img @onclick="OpenProfile" class="user-avatar" src="@(User.AvatarUrl ?? $"/identicon/{User.Id}")" alt="@(User.DisplayName ?? User.Username)" role="link"/>
|
||||||
}
|
}
|
||||||
<div class="name-section">
|
<div class="name-section">
|
||||||
<span class="display-name">@(DisplayName ?? Username)</span>
|
<span class="display-name"><UserDisplayName User="@User"/></span>
|
||||||
<span class="identifier">@@@Username@(Host != null ? $"@{Host}" : "")</span>
|
<span class="identifier">@@@User.Username@(User.Host != null ? $"@{User.Host}" : "")</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] [EditorRequired] public required string AvatarUrl { get; set; }
|
[Parameter] [EditorRequired] public required UserResponse User { 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 bool Indented { get; set; }
|
||||||
[Parameter] [EditorRequired] public required string? Host { get; set; }
|
|
||||||
|
|
||||||
private void OpenProfile()
|
private void OpenProfile()
|
||||||
{
|
{
|
||||||
var path = $"@{Username}";
|
var path = $"@{User.Username}";
|
||||||
if (Host?.Length > 0)
|
if (User.Host?.Length > 0)
|
||||||
{
|
{
|
||||||
path += $"@{Host}";
|
path += $"@{User.Host}";
|
||||||
}
|
}
|
||||||
|
|
||||||
Nav.NavigateTo($"/{path}");
|
Nav.NavigateTo($"/{path}");
|
||||||
|
|
Loading…
Add table
Reference in a new issue