@if (!IsLoading)
{
- @foreach (var user in UserList.Users ?? [])
+ @if (UserList.UsersCount != 0)
{
-
+
@string.Format(ResourcesKey.UsersNumberFormat, UserList.UsersCount)
+
+ @foreach (var user in UserList.Users ?? [])
+ {
+
+ }
+ }
+ else
+ {
+
@ResourcesKey.NoUsers
}
}
else
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs
index 7bd0a6b..5eefe30 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs
@@ -36,18 +36,17 @@ public partial class Users
}
- await FetchData();
+ await FetchUsers();
+ await FetchRoles();
await base.OnInitializedAsync();
}
- private async Task FetchData(bool fetchRoles = true)
+ private async Task FetchUsers(bool displayLoading = true)
{
try
{
- IsLoading = true;
-
- if (fetchRoles)
- Roles = await UserGateway.GetRoles();
+ IsLoading = displayLoading;
+ StateHasChanged();
UserList = await UserGateway.GetUsers(FilterParams, CurrentPage);
}
@@ -58,6 +57,27 @@ public partial class Users
finally
{
IsLoading = false;
+ StateHasChanged();
+ }
+ }
+
+ private async Task FetchRoles()
+ {
+ try
+ {
+ IsLoading = true;
+ StateHasChanged();
+
+ Roles = await UserGateway.GetRoles();
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ finally
+ {
+ IsLoading = false;
+ StateHasChanged();
}
}
@@ -66,9 +86,10 @@ public partial class Users
try
{
IsLoading = true;
+ StateHasChanged();
await UserGateway.CreateUser(user);
- await FetchData(false);
+ await FetchUsers();
}
catch (Exception)
{
@@ -77,9 +98,9 @@ public partial class Users
finally
{
IsLoading = false;
+ StateHasChanged();
+ UserAdd = new();
}
-
- UserAdd = new();
}
private async Task HandleUpdateUser(UserDto user)
@@ -87,9 +108,10 @@ public partial class Users
try
{
IsLoading = true;
+ StateHasChanged();
await UserGateway.UpdateUser(user);
- await FetchData(false);
+ await FetchUsers();
}
catch (Exception)
{
@@ -98,6 +120,7 @@ public partial class Users
finally
{
IsLoading = false;
+ StateHasChanged();
}
}
@@ -113,9 +136,10 @@ public partial class Users
try
{
IsLoading = true;
+ StateHasChanged();
await UserGateway.DeleteUser(UserDelete.Id);
- await FetchData(false);
+ await FetchUsers();
}
catch (Exception)
{
@@ -124,6 +148,7 @@ public partial class Users
finally
{
IsLoading = false;
+ StateHasChanged();
}
UserDelete = null;
@@ -134,7 +159,7 @@ public partial class Users
}
private async Task HandleFilterChanged()
{
- await FetchData(false);
+ await FetchUsers(false);
}
private void HandleCancelPopupClicked()
{
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor.css
index 6eee889..a0d9070 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor.css
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor.css
@@ -19,13 +19,3 @@
height: 60px;
animation: spin 1s linear infinite;
}
-
-@keyframes spin {
- 0% {
- transform: rotate(0deg);
- }
-
- 100% {
- transform: rotate(360deg);
- }
-}
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/GameBaseComponent.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/GameBaseComponent.cs
index 54fee3a..dfa22a0 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/GameBaseComponent.cs
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/GameBaseComponent.cs
@@ -24,6 +24,7 @@ public class GameBaseComponent : ComponentBase
try
{
IsLoading = true;
+ StateHasChanged();
Categories = await GameGateway.FetchCategories();
}
@@ -34,6 +35,7 @@ public class GameBaseComponent : ComponentBase
finally
{
IsLoading = false;
+ StateHasChanged();
}
}
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css
index 62963d5..4ccc405 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css
@@ -26,7 +26,7 @@
height: 100%;
width: 100%;
padding: 0;
- min-width: 0;
+ min-width: 0;
}
.clear-icon {
@@ -34,6 +34,7 @@
min-width: 18px;
height: 18px;
width: 18px;
+ z-index: 800;
}
.clear-icon:hover {
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Models/SelectParams.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Models/SelectParams.cs
index 24b788a..39bf705 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Models/SelectParams.cs
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Models/SelectParams.cs
@@ -4,8 +4,10 @@ public class SelectParams
{
public List Items { get; set; } = [];
public Func GetItemLabel { get; set; } = _ => string.Empty;
+ public Func? GetItemOrder { get; set; }
public List Headers { get; set; } = [];
public Func GetHeaderLabel { get; set; } = _ => string.Empty;
+ public Func? GetHeaderOrder { get; set; }
public Func? AddItem { get; set; }
}
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor
index 1ab6f65..c4cdad9 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor
@@ -27,7 +27,7 @@
@if (Params.Headers != null)
{
- @foreach (var header in (HeaderValues ?? []).UnionBy(Params.Headers, Params.GetHeaderLabel))
+ @foreach (var header in GetHeaders())
{
await ValuesChanged.InvokeAsync(Values);
}
}
+
+ private List GetHeaders() => [.. (HeaderValues ?? [])
+ .UnionBy(Params.Headers, Params.GetHeaderLabel)
+ .OrderBy(Params.GetHeaderOrder ?? Params.GetHeaderLabel)];
+
+ private List GetItems() => [.. (Values ?? [])
+ .UnionBy(Params.Items, Params.GetItemLabel)
+ .OrderBy(Params.GetItemOrder ?? Params.GetItemLabel)];
}
\ No newline at end of file
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css
index 4faecde..5353fb6 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css
@@ -22,8 +22,6 @@
overflow: hidden;
display: flex;
flex-direction: column;
- animation-name: fade-in;
- animation-duration: 0.2s;
}
.line {
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor
index 383fdb8..9184918 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor
@@ -5,12 +5,12 @@
@typeparam TItem
-