Add style for game creation
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 40s

This commit is contained in:
2025-04-14 21:03:34 +02:00
parent 3447fa6eb1
commit 1b7a43e2ac
8 changed files with 103 additions and 57 deletions

View File

@@ -72,6 +72,9 @@
<div id="label-description">@ResourcesKey.Description :</div> <div id="label-description">@ResourcesKey.Description :</div>
<InputTextArea class="description" @bind-Value=GameDto.Description /> <InputTextArea class="description" @bind-Value=GameDto.Description />
</div> </div>
<div class="bottom-container">
<ValidationSummary class="invalid-content" />
<div class="buttons"> <div class="buttons">
<button type="reset" class="cancel" @onclick=HandleOnCancel> <button type="reset" class="cancel" @onclick=HandleOnCancel>
@ResourcesKey.Reset @ResourcesKey.Reset
@@ -80,4 +83,5 @@
@ResourcesKey.Save @ResourcesKey.Save
</button> </button>
</div> </div>
</div>
</EditForm> </EditForm>

View File

@@ -1,6 +1,7 @@
.game-form { .game-form {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between;
gap: 20px; gap: 20px;
} }
@@ -35,10 +36,14 @@
color: var(--white); color: var(--white);
} }
::deep input[type="date"]::-webkit-calendar-picker-indicator { ::deep input[type="date"]::-webkit-calendar-picker-indicator {
filter: invert(1); filter: invert(1);
cursor: pointer; cursor: pointer;
} }
::deep input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
}
::deep textarea { ::deep textarea {
resize: vertical; resize: vertical;
@@ -68,6 +73,43 @@
align-content: center; align-content: center;
} }
input[type="number"]::-webkit-inner-spin-button { .bottom-container {
-webkit-appearance: none; margin-top: 8px;
} height: 28px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
::deep .invalid-content {
display: flex;
flex-wrap: wrap;
flex-shrink: 1;
margin: 0;
padding: 0;
list-style: none;
height: auto;
text-wrap: nowrap;
}
::deep .invalid-content li {
margin-right: 8px;
}
.buttons {
height: 100%;
display: flex;
flex-direction: row;
gap: 8px;
}
.buttons button {
border: none;
outline: none;
background: var(--violet);
border-radius: var(--small-radius);
color: var(--white);
font-weight: bold;
padding: 0 10px;
}

View File

@@ -1,5 +1,5 @@
using FluentValidation; using FluentValidation;
using GameIdeas.Shared.Constants; using GameIdeas.Resources;
using GameIdeas.Shared.Dto; using GameIdeas.Shared.Dto;
namespace GameIdeas.BlazorApp.Pages.Games.Components; namespace GameIdeas.BlazorApp.Pages.Games.Components;
@@ -9,17 +9,10 @@ public class GameValidation : AbstractValidator<GameDto>
public GameValidation() public GameValidation()
{ {
RuleFor(g => g.Title) RuleFor(g => g.Title)
.NotEmpty() .NotEmpty().WithMessage(ResourcesKey.InvalidTitle);
.NotNull()
.Matches(GlobalConstants.RegexName);
RuleFor(g => g.ReleaseDate)
.NotEmpty()
.NotNull();
RuleFor(g => g.Interest) RuleFor(g => g.Interest)
.NotNull() .GreaterThanOrEqualTo(1).WithMessage(ResourcesKey.InvalidInterest)
.GreaterThanOrEqualTo(1) .LessThanOrEqualTo(5).WithMessage(ResourcesKey.InvalidInterest);
.LessThanOrEqualTo(5);
} }
} }

View File

@@ -31,16 +31,18 @@ public partial class Popup
{ {
IsOpen = true; IsOpen = true;
await BackdropFilter?.Show()!; await BackdropFilter?.Show()!;
StateChanged?.Invoke(null, IsOpen);
StateHasChanged(); StateHasChanged();
StateChanged?.Invoke(null, IsOpen);
} }
public async Task Close() public async Task Close()
{ {
IsOpen = false; IsOpen = false;
await BackdropFilter?.Hide()!; await BackdropFilter?.Hide()!;
StateChanged?.Invoke(null, IsOpen);
StateHasChanged(); StateHasChanged();
StateChanged?.Invoke(null, IsOpen);
} }
private async Task HandleBackdropFilterClicked() private async Task HandleBackdropFilterClicked()

View File

@@ -93,8 +93,7 @@ public partial class Select<TItem, THeader>
} }
private async Task HandleSubmitAdd() private async Task HandleSubmitAdd()
{ {
if (Regex.IsMatch(AddLabel, GlobalConstants.RegexName) && if (Params.AddItem != null)
Params.AddItem != null)
{ {
Values ??= []; Values ??= [];
Values.Add(Params.AddItem(AddLabel)); Values.Add(Params.AddItem(AddLabel));

View File

@@ -36,6 +36,8 @@ public class Translations (TranslationService translationService)
public string ErrorFetchCategories => translationService.Translate(nameof(ErrorFetchCategories)); public string ErrorFetchCategories => translationService.Translate(nameof(ErrorFetchCategories));
public string PlaceholderAdd => translationService.Translate(nameof(PlaceholderAdd)); public string PlaceholderAdd => translationService.Translate(nameof(PlaceholderAdd));
public string ErrorCreateGame => translationService.Translate(nameof(ErrorCreateGame)); public string ErrorCreateGame => translationService.Translate(nameof(ErrorCreateGame));
public string InvalidTitle => translationService.Translate(nameof(InvalidTitle));
public string InvalidInterest => translationService.Translate(nameof(InvalidInterest));
} }
public static class ResourcesKey public static class ResourcesKey
@@ -80,4 +82,6 @@ public static class ResourcesKey
public static string ErrorFetchCategories => _instance?.ErrorFetchCategories ?? throw new InvalidOperationException("ResourcesKey.ErrorFetchCategories is not initialized."); public static string ErrorFetchCategories => _instance?.ErrorFetchCategories ?? throw new InvalidOperationException("ResourcesKey.ErrorFetchCategories is not initialized.");
public static string PlaceholderAdd => _instance?.PlaceholderAdd ?? throw new InvalidOperationException("ResourcesKey.PlaceholderAdd is not initialized."); public static string PlaceholderAdd => _instance?.PlaceholderAdd ?? throw new InvalidOperationException("ResourcesKey.PlaceholderAdd is not initialized.");
public static string ErrorCreateGame => _instance?.ErrorCreateGame ?? throw new InvalidOperationException("ResourcesKey.ErrorCreateGame is not initialized."); public static string ErrorCreateGame => _instance?.ErrorCreateGame ?? throw new InvalidOperationException("ResourcesKey.ErrorCreateGame is not initialized.");
public static string InvalidTitle => _instance?.InvalidTitle ?? throw new InvalidOperationException("ResourcesKey.InvalidTitle is not initialized.");
public static string InvalidInterest => _instance?.InvalidInterest ?? throw new InvalidOperationException("ResourcesKey.InvalidInterest is not initialized.");
} }

View File

@@ -2,5 +2,6 @@
public class GlobalConstants public class GlobalConstants
{ {
public const string RegexName = @"[\w()\-_ ]*";
} }

View File

@@ -1,36 +1,37 @@
{ {
"GamesIdeas": "Game Ideas", "GamesIdeas": "Game Ideas",
"ManualAdd": "Manuel", "ManualAdd": "Manuel",
"AutoAdd": "Automatique", "AutoAdd": "Automatique",
"Login": "Se connecter", "Login": "Se connecter",
"Logout": "Se déconnecter", "Logout": "Se déconnecter",
"EnterUsername": "Nom d'utilisateur", "EnterUsername": "Nom d'utilisateur",
"EnterPassword": "Mot de passe", "EnterPassword": "Mot de passe",
"UserManager": "Gestion des utilisateurs", "UserManager": "Gestion des utilisateurs",
"Filters": "Les filtres", "Filters": "Les filtres",
"LastAdd": "Les ajouts récents", "LastAdd": "Les ajouts récents",
"Research": "Rechercher", "Research": "Rechercher",
"Platforms": "Plateformes", "Platforms": "Plateformes",
"Tags": "Genres", "Tags": "Genres",
"Publishers": "Editeurs", "Publishers": "Editeurs",
"Developers": "Développeurs", "Developers": "Développeurs",
"StorageSize": "Taille d'espace", "StorageSize": "Taille d'espace",
"StorageSizeMo": "Taille d'espace en Mo", "StorageSizeMo": "Taille d'espace en Mo",
"LastModification": "Dernière modifications", "LastModification": "Dernière modifications",
"ReleaseDate": "Date de parution", "ReleaseDate": "Date de parution",
"Title": "Titre", "Title": "Titre",
"Interest": "Intérêt", "Interest": "Intérêt",
"Properties": "Propriétés", "Properties": "Propriétés",
"Description": "Description", "Description": "Description",
"Save": "Enregister", "Save": "Enregister",
"Reset": "Annuler", "Reset": "Annuler",
"ErrorWhenPostingData": "Erreur lors de la requête POST", "ErrorWhenPostingData": "Erreur lors de la requête POST",
"ErrorWhenPutingData": "Erreur lors de la requête PUT", "ErrorWhenPutingData": "Erreur lors de la requête PUT",
"ErrorWhenDeletingData": "Erreur lors de la requête DELETE", "ErrorWhenDeletingData": "Erreur lors de la requête DELETE",
"ErrorWhenFetchingData": "Erreur lors de la requête GET", "ErrorWhenFetchingData": "Erreur lors de la requête GET",
"RequestFailedStatusFormat": "Erreur lors de la réponse, code {0}", "RequestFailedStatusFormat": "Erreur lors de la réponse, code {0}",
"ErrorFetchCategories": "Erreur lors de la récupération des catégories", "ErrorFetchCategories": "Erreur lors de la récupération des catégories",
"PlaceholderAdd": "Ajouter un nouveau", "PlaceholderAdd": "Ajouter un nouveau",
"ErrorCreateGame": "Erreur lors de la Création d'un jeu" "ErrorCreateGame": "Erreur lors de la Création d'un jeu",
"InvalidTitle": "Le titre est incorrect",
"InvalidInterest": "L'interêt est incorrect'"
} }