From 261490ec740d990043b371d1f78e9d0890b688f2 Mon Sep 17 00:00:00 2001 From: henry Date: Wed, 14 May 2025 01:17:47 -0400 Subject: [PATCH] UI improvements --- .../Components/Pages/Home.razor | 22 +++++++------------ .../Services/AccessQueueManager.cs | 7 +++--- .../Services/IAccessQueueManager.cs | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/AccessQueuePlayground/Components/Pages/Home.razor b/AccessQueuePlayground/Components/Pages/Home.razor index 33cd1d9..b9dc7c2 100644 --- a/AccessQueuePlayground/Components/Pages/Home.razor +++ b/AccessQueuePlayground/Components/Pages/Home.razor @@ -8,7 +8,6 @@ AccessQueue Playground - @if (Status != null) { @@ -23,23 +22,23 @@ - +

Users in queue

- + - + @context.Id - + @(context.LatestResponse?.RequestsAhead ?? 0 + 1) - + @@ -52,7 +51,7 @@ - + @@ -77,19 +76,14 @@ }); } - public void Refresh() - { - Status = Manager.GetStatus(); - } - public void AddUser() { Manager.AddUser(); Status = Manager.GetStatus(); } - public void ToggleUserActive(Guid userId) + public void SetUserActive(Guid userId, bool isActive) { - Manager.ToggleUserActivity(userId); + Manager.SetUserActive(userId, isActive); } } \ No newline at end of file diff --git a/AccessQueuePlayground/Services/AccessQueueManager.cs b/AccessQueuePlayground/Services/AccessQueueManager.cs index 69846b3..724f8f5 100644 --- a/AccessQueuePlayground/Services/AccessQueueManager.cs +++ b/AccessQueuePlayground/Services/AccessQueueManager.cs @@ -32,17 +32,17 @@ namespace AccessQueuePlayground.Services _users[id] = new User { Id = id, - Active = true, + Active = false, }; return id; } - public void ToggleUserActivity(Guid userId) + public void SetUserActive(Guid userId, bool isActive) { var user = _users[userId]; if (user != null) { - user.Active = !user.Active; + user.Active = isActive; } } @@ -76,6 +76,7 @@ namespace AccessQueuePlayground.Services } } } + newStatus.QueuedUsers.Sort((user1, user2) => user1.LatestResponse!.RequestsAhead - user2.LatestResponse!.RequestsAhead); _status = newStatus; NotifyStatusUpdated(); } diff --git a/AccessQueuePlayground/Services/IAccessQueueManager.cs b/AccessQueuePlayground/Services/IAccessQueueManager.cs index 29f6b3f..db1ccb1 100644 --- a/AccessQueuePlayground/Services/IAccessQueueManager.cs +++ b/AccessQueuePlayground/Services/IAccessQueueManager.cs @@ -8,7 +8,7 @@ namespace AccessQueuePlayground.Services public Task RecalculateStatus(); public AccessQueueStatus GetStatus(); public Guid AddUser(); - public void ToggleUserActivity(Guid userId); + public void SetUserActive(Guid userId, bool isActive); } }