Skip to content

Commit

Permalink
#325 - Link from connections to user profile.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Sep 21, 2024
1 parent a5fe209 commit 54f31d8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Recollections.Api.Shared/Accounts/ConnectionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Neptuo.Recollections.Accounts;

public class ConnectionModel
{
public string OtherUserId { get; set; }
public string OtherUserName { get; set; }
public Permission? Permission { get; set; }
public ConnectionRole Role { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public async Task<IActionResult> GetListAsync()
.Where(c => c.UserId == userId || c.OtherUserId == userId)
.Select(c => new ConnectionModel()
{
OtherUserId = c.UserId == userId ? c.OtherUser.Id : c.User.Id,
OtherUserName = c.UserId == userId ? c.OtherUser.UserName : c.User.UserName,
Role = c.UserId == userId ? ConnectionRole.Initiator : ConnectionRole.Acceptor,
State = c.State == 1
Expand Down
9 changes: 6 additions & 3 deletions src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@

<div class="row">
<ListView Items="@Items" IsLoading="@IsLoading" EmptyMessage="You don't have any connections..." Context="connection">
<div class="col-sm-12 col-md-3 mb-4">
<div class="col-sm-12 col-md-6 col-lg-4 mb-4">
<div class="card h-100">
<div class="card-body">
<div class="row">
<div class="col">
<h5 class="card-title">
@connection.OtherUserName
<a href="@Navigator.UrlProfile(connection.OtherUserId)">
<Icon Identifier="user" />
@connection.OtherUserName
</a>
</h5>
</div>
<div class="col-auto">
Expand All @@ -57,7 +60,7 @@
}
</div>
</div>
<div class="text-right">
<div class="text-end">
@(connection.Role switch {
ConnectionRole.Initiator => "Initiated by me",
ConnectionRole.Acceptor => "Received",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public partial class Connections
[Inject]
protected Api Api { get; set; }

[Inject]
protected Navigator Navigator { get; set; }

protected Modal ShareModal { get; set; }
protected ConnectionModel ShareConnection { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
&#8226; <a href="@Navigator.UrlAbout()" target="_blank">Recollections</a> by <a href="https://www.neptuo.com" target="_blank">Neptuo</a>
</small>
</span>
<span class="navbar-text text-right">
<span class="navbar-text text-end">
<small>
<span class="versions">
<VersionInfo />
Expand Down

0 comments on commit 54f31d8

Please sign in to comment.