diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor new file mode 100644 index 0000000..f18e32a --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor @@ -0,0 +1,65 @@ +@using GameIdeas.BlazorApp.Shared.Components.Search +@using GameIdeas.BlazorApp.Shared.Components.Select +@using GameIdeas.BlazorApp.Shared.Components.Select.Models +@using GameIdeas.BlazorApp.Shared.Components.SliderRange +@using GameIdeas.Shared.Dto +@using GameIdeas.BlazorApp.Pages.Games.Models + + + +
+ + + + +
+ + + +
+ +
+ + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ + + diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.cs new file mode 100644 index 0000000..8dcba7b --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.cs @@ -0,0 +1,65 @@ +using GameIdeas.BlazorApp.Pages.Games.Models; +using GameIdeas.BlazorApp.Shared.Components.Select.Models; +using GameIdeas.BlazorApp.Shared.Components.SliderRange; +using GameIdeas.Shared.Dto; +using GameIdeas.Shared.Enum; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Forms; + +namespace GameIdeas.BlazorApp.Pages.Games.Filter; + +public partial class GameFilter +{ + [Parameter] public GameFilterParams GameFilterParams { get; set; } = new(); + [Parameter] public EventCallback GameFilterParamsChanged { get; set; } + [Parameter] public DisplayType DisplayType { get; set; } + [Parameter] public EventCallback DisplayTypeChanged { get; set; } + + private readonly IEnumerable>> SortTypes = [ + new() { Item = _ => SortType.Ascending, Label = "Ascendant", IsSelected = true }, + new() { Item = _ => SortType.Descending, Label = "Descendant" } + ]; + + private readonly IEnumerable>> GameProperties = [ + new() { Item = game => game?.Name, Label = "Nom", IsSelected = true }, + new() { Item = game => game?.ReleaseDate, Label = "Date de parution" } + ]; + + private readonly IEnumerable> Plateforms = [ + new() { Item = "Steam", Label = "Steam" }, + new() { Item = "GOG", Label = "GOG" }, + new() { Item = "Epic games", Label = "Epic games" }, + new() { Item = "Ubisoft", Label = "Ubisoft" }, + ]; + + private readonly IEnumerable> Genres = [ + new() { Item = "Rogue Like", Label = "Rogue Like" }, + new() { Item = "Aventure", Label = "Aventure" }, + new() { Item = "RPG", Label = "RPG" }, + new() { Item = "Fast FPS", Label = "Fast FPS" }, + ]; + + private EditContext? EditContext; + private SliderRangeParams SliderRangeParams = + new() { Min = 1, ValueMin = 1, ValueMax = 5, Max = 5 }; + + protected override void OnInitialized() + { + EditContext = new EditContext(GameFilterParams); + EditContext.OnFieldChanged += async (s, e) => + { + await GameFilterParamsChanged.InvokeAsync(GameFilterParams); + }; + } + + private void HandleSortTypeChanged(Func getHeader) + { + GameFilterParams.SortType = (SortType?)getHeader(null) ?? SortType.Ascending; + } + + private async Task HandleDisplayClicked(DisplayType displayType) + { + DisplayType = displayType; + await DisplayTypeChanged.InvokeAsync(displayType); + } +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.css new file mode 100644 index 0000000..75bae77 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.css @@ -0,0 +1,69 @@ +.form-filter { + display: flex; + flex-direction: row; + gap: 8px; + align-items: center; +} + +.search-container { + width: 150px; + min-width: 150px; +} + +.slider-container { + width: 150px; + min-width: 150px; +} + +.select-container { + width: 150px; + min-width: 150px; +} + +.square-button { + height: 28px; + min-height: 28px; + width: 28px; + min-width: 28px; + border-radius: var(--small-radius); + background: var(--black); + overflow: hidden; +} + + .square-button:first-child { + margin-right: 16px; + } + +.square-button svg { + fill: var(--white); +} + + .square-button svg:hover { + cursor: pointer; + background: var(--low-white); + } + +.selected-icon { + fill: var(--violet) !important; +} + +.sort-icon { + padding: 2px; +} + +.list-icon { + padding-right: 1px; + padding-top: 0.5px; + padding-bottom: 0.5px; +} + +.card-icon { + padding-top: 1px; + padding-right: 1px; +} + +@media screen and (max-width: 1000px) { + .select-container { + display: none; + } +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilterParams.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilterParams.cs new file mode 100644 index 0000000..7106f83 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilterParams.cs @@ -0,0 +1,15 @@ +using GameIdeas.Shared.Enum; +using GameIdeas.Shared.Dto; + +namespace GameIdeas.BlazorApp.Pages.Games.Filter; + +public class GameFilterParams +{ + public SortType? SortType { get; set; } + public Func? SortProperty { get; set; } + public string? SearchName { get; set; } + public IEnumerable? Plateforms { get; set; } + public IEnumerable? Genres { get; set; } + public int MaxRating { get; set; } + public int MinRating { get; set; } +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor index 87718be..e30c95a 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor @@ -1,15 +1,16 @@ @page "/Games" @using GameIdeas.BlazorApp.Layouts +@using GameIdeas.BlazorApp.Pages.Games.Filter @using GameIdeas.BlazorApp.Shared.Components -@using GameIdeas.BlazorApp.Shared.Headers +@using GameIdeas.BlazorApp.Shared.Layouts.Header @using GameIdeas.Resources @layout MainLayout @ResourcesKey.GamesIdeas - + -
PROUT
+ -
+ \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor.cs index dc671cf..d4cfdaf 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GamesBase.razor.cs @@ -1,6 +1,8 @@ +using GameIdeas.BlazorApp.Pages.Games.Models; + namespace GameIdeas.BlazorApp.Pages.Games; public partial class GamesBase () { - + private DisplayType DisplayType = DisplayType.List; } \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/AccountSetting.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/AccountSetting.cs deleted file mode 100644 index 23e9ce3..0000000 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/AccountSetting.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace GameIdeas.BlazorApp.Pages.Games.Models; - -public enum AccountSetting -{ - Logout -} - -public class AccountSettingParams -{ - public string Label { get; set; } - public AccountSetting AccountSetting { get; set; } - public bool ForConnected { get; set; } - - public AccountSettingParams(string label, AccountSetting accountSetting, bool forConnected) - { - Label = label; - AccountSetting = accountSetting; - ForConnected = forConnected; - } -} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/AddType.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/AddType.cs index 6e34746..d526be0 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/AddType.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/AddType.cs @@ -5,9 +5,3 @@ public enum AddType Manual, Auto } - -public class AddTypeParams(AddType addType, string label) -{ - public AddType AddType { get; set; } = addType; - public string? Label { get; set; } = label; -} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/DisplayType.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/DisplayType.cs new file mode 100644 index 0000000..f3c0af4 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Models/DisplayType.cs @@ -0,0 +1,7 @@ +namespace GameIdeas.BlazorApp.Pages.Games.Models; + +public enum DisplayType +{ + Card, + List +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Properties/launchSettings.json b/src/GameIdeas/Client/GameIdeas.BlazorApp/Properties/launchSettings.json index 8db20ce..fccd456 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Properties/launchSettings.json +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Properties/launchSettings.json @@ -7,6 +7,7 @@ "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "http://localhost:5172", + "launchUrl": "http://localhost:5172/Games", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -17,6 +18,7 @@ "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "https://localhost:7060;http://localhost:5172", + "launchUrl": "http://localhost:7060/Games", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/AccountSettings.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Account/AccountSettings.razor similarity index 89% rename from src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/AccountSettings.razor rename to src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Account/AccountSettings.razor index 578eead..5b111c2 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Headers/AccountSettings.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Account/AccountSettings.razor @@ -1,7 +1,7 @@ @using GameIdeas.Resources @using Blazored.FluentValidation; -