[frontend/components] Use a single component for display names with emoji rendering
This commit is contained in:
parent
53c3fc9edc
commit
cfcccf7654
7 changed files with 19 additions and 13 deletions
|
@ -7,14 +7,7 @@
|
|||
<div class="renote-info">
|
||||
<span class="user">
|
||||
<Icon Name="Icons.Repeat"/> Renoted by
|
||||
@if (NoteResponse.User.DisplayName != null)
|
||||
{
|
||||
@NoteResponse.User.DisplayName
|
||||
}
|
||||
else
|
||||
{
|
||||
@NoteResponse.User.Username
|
||||
}
|
||||
<UserDisplayName User="@NoteResponse.User"/>
|
||||
</span>
|
||||
<span class="metadata">
|
||||
<NoteMetadata Visibility="NoteResponse.Visibility" InstanceName="@null" CreatedAt="DateTime.Parse(NoteResponse.CreatedAt)"/>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div @onclick="() => OpenProfile(el.Username, el.Host)" class="detail-entry">
|
||||
<img class="icon" src="@el.AvatarUrl"/>
|
||||
<div class="name-section">
|
||||
<div class="displayname">@(el.DisplayName ?? el.Username)</div>
|
||||
<div class="displayname"><UserDisplayName User="@el"/></div>
|
||||
<div class="username">@@@el.Username@(el.Host != null ? $"@{el.Host}" : "")</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div @onclick="() => OpenProfile(el.Username, el.Host)" class="detail-entry">
|
||||
<img class="icon" src="@el.AvatarUrl"/>
|
||||
<div class="name-section">
|
||||
<div class="displayname">@(el.DisplayName ?? el.Username)</div>
|
||||
<div class="displayname"><UserDisplayName User="@el"/></div>
|
||||
<div class="username">@@@el.Username@(el.Host != null ? $"@{el.Host}" : "")</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class="notification-body">
|
||||
@if (NotificationResponse is { User: not null })
|
||||
{
|
||||
<span @onclick="OpenProfile" class="display-name">@(NotificationResponse.User.DisplayName ?? NotificationResponse.User.Username)</span>
|
||||
<span @onclick="OpenProfile" class="display-name"><UserDisplayName User="@NotificationResponse.User"/></span>
|
||||
}
|
||||
|
||||
@if (NotificationResponse is { Note: not null, Type: "like", User: not null })
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div @onclick="() => OpenProfile(el.Username, el.Host)" class="detail-entry">
|
||||
<img class="icon" src="@el.AvatarUrl"/>
|
||||
<div class="name-section">
|
||||
<div class="displayname">@(el.DisplayName ?? el.Username)</div>
|
||||
<div class="displayname"><UserDisplayName User="@el"/></div>
|
||||
<div class="username">@@@el.Username@(el.Host != null ? $"@{el.Host}" : "")</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
13
Iceshrimp.Frontend/Components/UserDisplayName.razor
Normal file
13
Iceshrimp.Frontend/Components/UserDisplayName.razor
Normal file
|
@ -0,0 +1,13 @@
|
|||
@using Iceshrimp.Shared.Schemas.Web
|
||||
@if (User.DisplayName != null && User.Emojis.Count != 0)
|
||||
{
|
||||
<MfmText Text="@User.DisplayName" Emoji="@User.Emojis" Simple="@true"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
@(User.DisplayName ?? User.Username)
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] [EditorRequired] public required UserResponse User { get; set; }
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
</div>
|
||||
<div class="name-section">
|
||||
<div class="name">
|
||||
@(User.DisplayName ?? User.Username)
|
||||
<UserDisplayName User="@User"/>
|
||||
</div>
|
||||
<div class="identifier">
|
||||
@@@User.Username
|
||||
|
|
Loading…
Add table
Reference in a new issue