Run code clean and fix messages (#45)
All checks were successful
Game Ideas deploy / build-test-deploy (push) Successful in 1m13s

Reviewed-on: #45
This commit was merged in pull request #45.
This commit is contained in:
2025-05-07 01:28:37 +02:00
parent b58ffe10e0
commit 58da2e6843
38 changed files with 150 additions and 155 deletions

View File

@@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.JSInterop;
using System.Security.Claims;
namespace GameIdeas.BlazorApp.Pages.Games.Components;
@@ -21,7 +20,7 @@ public partial class GameCreationForm
[Parameter] public CategoriesDto? Categories { get; set; }
[Parameter] public EventCallback OnSubmit { get; set; }
private GameDetailDto GameDto = new();
private readonly GameDetailDto GameDto = new();
private EditContext? EditContext;
private readonly SelectTheme Theme = SelectTheme.Creation;
private readonly SliderParams SliderParams = new() { Gap = 1, Min = 1, Max = 5 };

View File

@@ -4,7 +4,7 @@
@inherits GameBase
<div class="row">
<img class="icon" src="~/icon.png" />
<img class="icon" src="icon.png" />
<a class="title" href="@($"/Detail/{GameDto.Id}")">@GameDto.Title</a>

View File

@@ -80,9 +80,20 @@
fill: var(--white);
}
@media screen and (max-width: 700px) {
.release-date {
display: none;
grid-column: span;
}
.row {
grid-template-columns: auto 3fr 3fr 30px 30px !important;
}
}
@media screen and (max-width: 1000px) {
.row {
grid-template-columns: 48px 3fr 2fr 3fr 30px 30px;
grid-template-columns: auto 3fr 2fr 3fr 30px 30px;
}
.tags, .storage {

View File

@@ -26,7 +26,7 @@ public partial class Games
GameFilter.SortType = Filter.GameFilter.SortTypes
.First(st => st.SortType == SortType.Ascending);
GameFilter.SortProperty= Filter.GameFilter.GameProperties
GameFilter.SortProperty = Filter.GameFilter.GameProperties
.First(gp => gp.PropertyName == nameof(GameIdeas.Shared.Model.Game.Title));
await HandleFetchDatas();

View File

@@ -26,7 +26,7 @@ public class GameGateway(IHttpClientService httpClientService) : IGameGateway
try
{
var result = await httpClientService.FetchDataAsync<CategoriesDto>(Endpoints.Category.AllCategories);
return result ?? throw new InvalidOperationException(ResourcesKey.ErrorFetchCategories);
}
catch (Exception)

View File

@@ -10,9 +10,9 @@ public partial class Login
[Parameter] public IAuthGateway AuthGateway { get; set; } = default!;
private EditContext? EditContext;
private UserDto UserDto = new();
private readonly UserDto UserDto = new();
private bool IsLoading = false;
private LoginValidator Validator = new();
private readonly LoginValidator Validator = new();
protected override void OnInitialized()
{
EditContext = new EditContext(UserDto);

View File

@@ -1,5 +1,4 @@
using FluentValidation;
using GameIdeas.BlazorApp.Shared.Components.Select;
using GameIdeas.BlazorApp.Shared.Components.Select.Models;
using GameIdeas.Shared.Dto;
using Microsoft.AspNetCore.Components;

View File

@@ -37,36 +37,36 @@ public class UserGateway(IHttpClientService httpClient) : IUserGateway
public async Task<IEnumerable<RoleDto>> GetRoles()
{
try
{
return await httpClient.FetchDataAsync<IEnumerable<RoleDto>>(Endpoints.User.Roles)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchRoles);
}
catch (Exception)
{
throw new RoleNotFoundException(ResourcesKey.ErrorFetchRoles);
try
{
return await httpClient.FetchDataAsync<IEnumerable<RoleDto>>(Endpoints.User.Roles)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchRoles);
}
catch (Exception)
{
throw new RoleNotFoundException(ResourcesKey.ErrorFetchRoles);
}
}
public async Task<UserListDto> GetUsers(UserFilterParams filterParams, int currentPage)
{
try
{
UserFilterDto filter = new()
{
CurrentPage = currentPage,
Name = filterParams.Name,
RoleIds = filterParams.Roles?.Select(r => r.Id)
};
try
{
UserFilterDto filter = new()
{
CurrentPage = currentPage,
Name = filterParams.Name,
RoleIds = filterParams.Roles?.Select(r => r.Id)
};
var url = Endpoints.User.Fetch(filter);
return await httpClient.FetchDataAsync<UserListDto>(url)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchUsers);
}
catch (Exception)
{
throw new UserNotFoundException(ResourcesKey.ErrorFetchUsers);
}
var url = Endpoints.User.Fetch(filter);
return await httpClient.FetchDataAsync<UserListDto>(url)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchUsers);
}
catch (Exception)
{
throw new UserNotFoundException(ResourcesKey.ErrorFetchUsers);
}
}
public async Task<IdDto> UpdateUser(UserDto user)

View File

@@ -17,10 +17,10 @@ public partial class Users
private Popup? Popup;
private bool IsLoading = false;
private UserFilterParams FilterParams = new();
private readonly UserFilterParams FilterParams = new();
private UserListDto UserList = new();
private IEnumerable<RoleDto> Roles = [];
private int CurrentPage = 1;
private readonly int CurrentPage = 1;
private UserDto UserAdd = new();
private UserDto? UserDelete;
private string? currentUserId;
@@ -34,7 +34,7 @@ public partial class Users
NavigationManager.NavigateTo("/Unauthorized");
return;
}
await FetchData();
await base.OnInitializedAsync();
@@ -57,7 +57,7 @@ public partial class Users
}
finally
{
IsLoading = false;
IsLoading = false;
}
}