[frontend] Allow opening user profile from UserProfileCard

This commit is contained in:
Lilian 2024-07-09 02:37:07 +02:00
parent d36a9ec235
commit bf186a9f22
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View file

@ -1,9 +1,10 @@
@inject ApiService Api;
@using Iceshrimp.Frontend.Core.Services
@using Iceshrimp.Shared.Schemas.Web
@inject NavigationManager NavigationManager;
@if (UserProfile != null)
{
<div class="profile-card">
<div @onclick="Open" class="profile-card">
<div class="header">
<div>
<img class="avatar" src="@User.AvatarUrl"/>
@ -34,4 +35,11 @@
{
UserProfile = await Api.Users.GetUserProfile(User.Id);
}
private void Open()
{
var username = $"@{User.Username}";
if (User.Host != null) username += $"@{User.Host}";
NavigationManager.NavigateTo($"/{username}");
}
}

View file

@ -19,7 +19,7 @@
border-radius: 1rem;
background-color: var(--foreground-color);
max-width: 45rem;
margin: 1rem auto auto;
margin-top: 1rem;
width: 100%;
}