Add style for game creation
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 40s
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 40s
This commit is contained in:
@@ -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>
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,6 +41,10 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::deep input[type="number"]::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
::deep textarea {
|
::deep textarea {
|
||||||
resize: vertical;
|
resize: vertical;
|
||||||
min-height: 140px;
|
min-height: 140px;
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|||||||
@@ -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.");
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
public class GlobalConstants
|
public class GlobalConstants
|
||||||
{
|
{
|
||||||
public const string RegexName = @"[\w()\-_ ]*";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
"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'"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user