diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj b/src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj index c1da829..0388002 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj @@ -8,6 +8,8 @@ + + @@ -15,6 +17,7 @@ + diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/AccountSetting.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/AccountSetting.cs index 067f14c..3773818 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/AccountSetting.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/AccountSetting.cs @@ -2,7 +2,6 @@ namespace GameIdeas.BlazorApp.Pages.Games; public enum AccountSetting { - Login, Logout } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Program.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Program.cs index d68b7f2..3331e0c 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Program.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Program.cs @@ -1,5 +1,6 @@ using System.Net.Http.Json; using GameIdeas.BlazorApp; +using GameIdeas.BlazorApp.Services; using GameIdeas.Resources; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; @@ -21,6 +22,8 @@ builder.Services.AddHttpClient( client.Timeout = TimeSpan.FromMinutes(3); }); +builder.Services.AddScoped(); + builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Services/AuthentificationService.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Services/AuthentificationService.cs new file mode 100644 index 0000000..380b679 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Services/AuthentificationService.cs @@ -0,0 +1,21 @@ +namespace GameIdeas.BlazorApp.Services; + +public class AuthentificationService +{ + private bool isLogin; + + public bool IsLogin + { + get { return isLogin; } + } + + public void Login() + { + isLogin = true; + } + + public void Logout() + { + isLogin = false; + } +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Dropdown/DropdownContent.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Dropdown/DropdownContent.razor.css index ce1ae28..253d8f6 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Dropdown/DropdownContent.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Dropdown/DropdownContent.razor.css @@ -5,7 +5,8 @@ border-radius: var(--small-radius); position: fixed; animation-name: fade-in; - animation-duration: 0.4s + animation-duration: 0.4s; + margin-top: 4px; } .drowdown-element { diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/AccountSettings.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/AccountSettings.razor index 8f8fd1c..578eead 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/AccountSettings.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/AccountSettings.razor @@ -1,6 +1,46 @@ - diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/HeaderBase.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/HeaderBase.razor.cs index 8f651e4..220b578 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/HeaderBase.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/HeaderBase.razor.cs @@ -17,19 +17,30 @@ public partial class HeaderBase new AddTypeParams(AddType.Auto, ResourcesKey.AutoAdd) ]; + private AccountSettings? AccountSettings; + private void HandleIconClicked() { throw new NotImplementedException(); } + private async Task HandleMoreButton() { if (DropdownAdd != null) { await DropdownAdd.OpenAsync(); } + + AccountSettings?.Close(); } + private async Task HandleAddTypeClickedAsync(AddTypeParams value) { await AddTypeChanged.InvokeAsync(value.AddType); } + + private void HandleAccountClicked() + { + AccountSettings?.Toggle(); + } } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/LoginValidator.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/LoginValidator.cs new file mode 100644 index 0000000..931bd7b --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/LoginValidator.cs @@ -0,0 +1,18 @@ +using FluentValidation; +using GameIdeas.Shared.Dto; + +namespace GameIdeas.BlazorApp.Shared.Headers; + +public class LoginValidator : AbstractValidator +{ + public LoginValidator() + { + RuleFor(dto => dto.Username) + .NotNull() + .NotEmpty(); + + RuleFor(dto => dto.Password) + .NotNull() + .NotEmpty(); + } +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css index 71a3c17..a0059cc 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css @@ -3,6 +3,7 @@ :root { --background: linear-gradient(180deg, #2B1D3D 0%, #171229 100%); --violet: #A380D1; + --violet-selected: #8266a7; --red: #FF5E51; --yellow: #FFC107; --green: #43F8C0; @@ -30,38 +31,16 @@ html, body, #app { overflow: hidden; } -h1:focus { - outline: none; -} - -a, .btn-link { - color: #0071c1; -} - -.btn-primary { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; -} - -.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { - box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; -} - -.content { - padding-top: 1.1rem; -} - .valid.modified:not([type=checkbox]) { - outline: 1px solid #26b050; + border: 2px solid var(--green); } .invalid { - outline: 1px solid red; + border: 2px solid var(--red) !important; } .validation-message { - color: red; + color: var(--red); } #blazor-error-ui { @@ -142,7 +121,17 @@ code { text-align: start; } +:focus-visible { + outline: none; +} + @keyframes fade-in { 0% {opacity: 0} 100% {opacity: 1} +} + +@keyframes loading { + to { + transform: rotate(360deg); + } } \ No newline at end of file diff --git a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs index f8e8d9b..2509e89 100644 --- a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs +++ b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs @@ -8,6 +8,8 @@ public class Translations (TranslationService translationService) public string AutoAdd => translationService.Translate(nameof(AutoAdd)); public string Login => translationService.Translate(nameof(Login)); public string Logout => translationService.Translate(nameof(Logout)); + public string EnterUsername => translationService.Translate(nameof(EnterUsername)); + public string EnterPassword => translationService.Translate(nameof(EnterPassword)); } public static class ResourcesKey @@ -24,4 +26,6 @@ public static class ResourcesKey public static string AutoAdd => _instance?.AutoAdd ?? throw new InvalidOperationException("ResourcesKey.AutoAdd is not initialized."); public static string Login => _instance?.Login ?? throw new InvalidOperationException("ResourcesKey.Login is not initialized."); public static string Logout => _instance?.Logout ?? throw new InvalidOperationException("ResourcesKey.Logout is not initialized."); + public static string EnterUsername => _instance?.EnterUsername ?? throw new InvalidOperationException("ResourcesKey.EnterUsername is not initialized."); + public static string EnterPassword => _instance?.EnterPassword ?? throw new InvalidOperationException("ResourcesKey.EnterPassword is not initialized."); } \ No newline at end of file diff --git a/src/GameIdeas/GameIdeas.Shared/Dto/LoginDto.cs b/src/GameIdeas/GameIdeas.Shared/Dto/LoginDto.cs new file mode 100644 index 0000000..61ea528 --- /dev/null +++ b/src/GameIdeas/GameIdeas.Shared/Dto/LoginDto.cs @@ -0,0 +1,7 @@ +namespace GameIdeas.Shared.Dto; + +public class LoginDto +{ + public string? Username { get; set; } + public string? Password { get; set; } +} diff --git a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json index 618c13f..ea987f0 100644 --- a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json +++ b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json @@ -2,6 +2,8 @@ "GamesIdeas": "Game Ideas", "ManualAdd": "Manuel", "AutoAdd": "Automatique", - "Login": "Connexion", - "Logout": "Déconnexion" + "Login": "Se connecter", + "Logout": "Se déconnecter", + "EnterUsername": "Nom d'utilisateur", + "EnterPassword": "Mot de passe" } \ No newline at end of file