From 54f31d83dbcfce680a4de46314fdf04ba9ea84be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Sat, 21 Sep 2024 19:43:41 +0200 Subject: [PATCH] #325 - Link from connections to user profile. --- src/Recollections.Api.Shared/Accounts/ConnectionModel.cs | 1 + .../Accounts/Controllers/ConnectionsController.cs | 1 + .../Accounts/Pages/Connections.razor | 9 ++++++--- .../Accounts/Pages/Connections.razor.cs | 3 +++ .../Commons/Layouts/MainLayout.razor | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Recollections.Api.Shared/Accounts/ConnectionModel.cs b/src/Recollections.Api.Shared/Accounts/ConnectionModel.cs index d72b8ef..220bc07 100644 --- a/src/Recollections.Api.Shared/Accounts/ConnectionModel.cs +++ b/src/Recollections.Api.Shared/Accounts/ConnectionModel.cs @@ -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; } diff --git a/src/Recollections.Api/Accounts/Controllers/ConnectionsController.cs b/src/Recollections.Api/Accounts/Controllers/ConnectionsController.cs index 92019f1..d8d62c3 100644 --- a/src/Recollections.Api/Accounts/Controllers/ConnectionsController.cs +++ b/src/Recollections.Api/Accounts/Controllers/ConnectionsController.cs @@ -40,6 +40,7 @@ public async Task 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 diff --git a/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor b/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor index 2289107..2205be2 100644 --- a/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor +++ b/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor @@ -24,13 +24,16 @@
-
+
- @connection.OtherUserName + + + @connection.OtherUserName +
@@ -57,7 +60,7 @@ }
-
+
@(connection.Role switch { ConnectionRole.Initiator => "Initiated by me", ConnectionRole.Acceptor => "Received", diff --git a/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor.cs b/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor.cs index 1f33004..1b1ea50 100644 --- a/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor.cs +++ b/src/Recollections.Blazor.UI/Accounts/Pages/Connections.razor.cs @@ -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; } diff --git a/src/Recollections.Blazor.UI/Commons/Layouts/MainLayout.razor b/src/Recollections.Blazor.UI/Commons/Layouts/MainLayout.razor index 0114664..c306fe8 100644 --- a/src/Recollections.Blazor.UI/Commons/Layouts/MainLayout.razor +++ b/src/Recollections.Blazor.UI/Commons/Layouts/MainLayout.razor @@ -13,7 +13,7 @@ • Recollections by Neptuo - +