From d90811723a3b3c3bf82695da1e303b1a46bdc15e Mon Sep 17 00:00:00 2001 From: Egamorf Date: Thu, 17 Apr 2025 00:59:30 +0200 Subject: [PATCH] Display list of games (#16) Co-authored-by: Maxime Adler Reviewed-on: https://gitea.egamorf.com/PRJ-Game-Ideas/game-ideas/pulls/16 --- .../GameIdeas.BlazorApp/Helpers/GameHelper.cs | 13 ++ .../Pages/Games/Components/GameBase.cs | 30 +++++ .../Pages/Games/Components/GameRow.razor | 41 +++++++ .../Pages/Games/Components/GameRow.razor.css | 101 ++++++++++++++++ .../Games/Components/GameRowSkeleton.razor | 36 ++++++ .../Components/GameRowSkeleton.razor.css | 111 ++++++++++++++++++ .../Games/Filter/AdvancedGameFilter.razor.css | 5 +- .../Pages/Games/Filter/GameFilter.razor.css | 4 +- .../Games/{GameBase.razor => Game.razor} | 19 ++- .../{GameBase.razor.cs => Game.razor.cs} | 24 +++- .../Pages/Games/Game.razor.css | 14 +++ .../Pages/Games/GameBase.razor.css | 12 -- .../Pages/Games/Gateways/GameGateway.cs | 13 ++ .../Pages/Games/Gateways/IGameGateway.cs | 1 + .../Shared/Components/Popup/Popup.razor | 2 +- .../Components/Search/SearchInput.razor | 2 +- .../Components/Search/SearchInput.razor.cs | 4 +- .../Shared/Components/Slider/Slider.razor.cs | 12 +- .../Shared/Constants/Endpoints.cs | 6 +- .../Shared/Constants/Icons.cs | 28 ++--- .../Exceptions/GameNotFoundException.cs | 3 + .../GameIdeas.BlazorApp/wwwroot/css/app.css | 1 - .../CreateStaticResourceKey.cs | 4 + .../Controllers/GameController.cs | 2 +- .../GameIdeas.WebAPI/Files/GameIdeas.fr.json | 5 +- 25 files changed, 438 insertions(+), 55 deletions(-) create mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameBase.cs create mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor create mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor.css create mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor create mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor.css rename src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/{GameBase.razor => Game.razor} (70%) rename src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/{GameBase.razor.cs => Game.razor.cs} (64%) create mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.css delete mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.css create mode 100644 src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Exceptions/GameNotFoundException.cs diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Helpers/GameHelper.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Helpers/GameHelper.cs index d806f8e..8f830c2 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Helpers/GameHelper.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Helpers/GameHelper.cs @@ -9,4 +9,17 @@ public static class GameHelper game.CreationUserId = 100000; game.CreationDate = DateTime.Now; } + + public static string GetInterestColor(int interest, int maxInterest) + { + int firstTier = (int)Math.Floor(0.33 * maxInterest); + int secondTier = (int)Math.Ceiling(0.66 * maxInterest); + + return interest switch + { + int x when x <= firstTier => "--red", + int x when x >= secondTier => "--green", + _ => "--yellow", + }; + } } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameBase.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameBase.cs new file mode 100644 index 0000000..efc56cf --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameBase.cs @@ -0,0 +1,30 @@ +using GameIdeas.Shared.Dto; +using Microsoft.AspNetCore.Components; + +namespace GameIdeas.BlazorApp.Pages.Games.Components; + +public class GameBase : ComponentBase +{ + [Parameter] public GameDto GameDto { get; set; } = new(); + [Inject] public NavigationManager NavigationManager { get; set; } = default!; + + protected void HandleDetailClicked() + { + NavigationManager.NavigateTo($"/Games/Detail/{GameDto.Id}"); + } + + protected string GetFormatedStorageSpace() + { + if (GameDto.StorageSpace == null) + { + return string.Empty; + } + + return GameDto.StorageSpace switch + { + >= 1000000 => $"{GameDto.StorageSpace / 1000000:f1} To", + >= 1000 => $"{GameDto.StorageSpace / 1000:f1} Go", + _ => $"{GameDto.StorageSpace:f1} Mo" + }; + } +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor new file mode 100644 index 0000000..a2309f2 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor @@ -0,0 +1,41 @@ +@using GameIdeas.BlazorApp.Helpers +@using GameIdeas.BlazorApp.Shared.Constants +@inherits GameBase + +
+ + + @GameDto.Title + + @(GameDto.ReleaseDate?.ToShortDateString() ?? @ResourcesKey.Unknown) + +
+ @foreach (var platform in GameDto.Platforms ?? []) + { + + @platform.Label + + } +
+ +
+ @foreach (var tag in GameDto.Tags ?? []) + { +
+ @tag.Label +
+ } +
+ + @GetFormatedStorageSpace() + +
+ + @GameDto.Interest + + /5 +
+ + +
\ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor.css new file mode 100644 index 0000000..3adfb08 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor.css @@ -0,0 +1,101 @@ +.row { + display: grid; + grid-template-columns: auto 3fr 70px 2fr 3fr 60px 30px 30px; + grid-gap: 8px; + text-wrap: nowrap; + height: 64px; + background: var(--input-secondary); + box-shadow: var(--drop-shadow); + border-radius: var(--big-radius); + align-items: center; + overflow: hidden; +} + +.row * { + max-height: 64px; + height: fit-content; + padding: 6px 0; + box-sizing: border-box; +} + +.icon { + padding: 0; + margin: 8px; + height: 48px; + width: 48px; +} + +.title { + font-weight: bold; + font-size: 13px; + color: var(--white); + text-decoration: none; + width: fit-content; + padding: 6px; + border-radius: var(--small-radius); +} + +.title:hover { + background: var(--input-selected); +} + +.release-date, .storage, .max-value { + color: rgb(184, 184, 184); +} + +.pill { + width: fit-content; + height: 24px; + padding: 0 6px; + background: rgb(255, 255, 255, 0.2); + border-radius: var(--small-radius); + align-content: center; +} + +.platforms, .tags { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.platform-pill { + color: var(--violet); + cursor: pointer; + text-decoration: none; +} + + .platform-pill:hover { + text-decoration: underline; + } + +.detail { + transform: scale(0.6, 1) rotate(-90deg); + background: none; + border: none; + outline: none; + cursor: pointer; +} + +::deep .detail svg { + fill: var(--white); +} + +.value { + font-size: 24px; + font-weight: bold; +} + +.max-value { + position: absolute; + transform: translate(2px, 10px); +} + +@media screen and (max-width: 1000px) { + .row { + grid-template-columns: 48px 3fr 2fr 3fr 30px 30px; + } + + .tags, .storage { + display: none; + } +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor new file mode 100644 index 0000000..7e97df7 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor @@ -0,0 +1,36 @@ +@using GameIdeas.BlazorApp.Helpers +@using GameIdeas.BlazorApp.Shared.Constants + +
+
@Icons.Game
+ +
+ + @ResourcesKey.Unknown + +
+
+
+
+
+ +
+
+
+
+ + 10.0 Go + +
+ + @Interest + + /5 +
+ + +
+ +@code { + private int Interest = @Random.Shared.Next(1, 5); +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor.css new file mode 100644 index 0000000..df41d48 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRowSkeleton.razor.css @@ -0,0 +1,111 @@ +.row { + display: grid; + grid-template-columns: auto 3fr 70px 2fr 3fr 60px 30px 30px; + grid-gap: 8px; + height: 64px; + background: var(--input-secondary); + box-shadow: var(--drop-shadow); + border-radius: var(--big-radius); + align-items: center; + overflow: hidden; +} + +.row * { + max-height: 64px; + height: fit-content; + padding: 6px 0; + box-sizing: border-box; +} + +.icon { + border-radius: var(--small-radius); + padding: 4px; + margin: 8px; + height: 48px; + width: 48px; + animation: loading 3s ease infinite; +} + +.icon ::deep svg { + fill: var(--input-secondary); +} + +.title { + border-radius: var(--small-radius); + animation: loading 3s ease infinite; + width: 160px; + height: 24px; + padding: 6px; + border-radius: var(--small-radius); +} + +.release-date, .storage, .max-value { + color: rgb(184, 184, 184); +} + +.pill { + width: 60px; + height: 24px; + padding: 0 6px; + border-radius: var(--small-radius); + align-content: center; + animation: loading 3s ease infinite; +} + +.pill-lg { + width: 80px; +} + +.pill-sm { + width: 40px; +} + +.platforms, .tags { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.detail { + transform: scale(0.6, 1) rotate(-90deg); + background: none; + border: none; + outline: none; + cursor: pointer; +} + +::deep .detail svg { + fill: var(--white); +} + +.value { + font-size: 24px; + font-weight: bold; +} + +.max-value { + position: absolute; + transform: translate(2px, 10px); +} + +@media screen and (max-width: 1000px) { + .row { + grid-template-columns: 48px 3fr 2fr 3fr 30px 30px; + } + + .tags, .storage { + display: none; + } +} + +@keyframes loading { + 0% { + background: rgb(255, 255, 255, 0.05); + } + 50% { + background: rgb(255, 255, 255, 0.2); + } + 100% { + background: rgb(255, 255, 255, 0.05); + } +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.css index d6db344..fc8c9f4 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.css @@ -4,9 +4,9 @@ gap: 10px; padding-right: 20px; padding-left: 10px; - height: 100%; + min-height: calc(100vh - 80px); box-sizing: border-box; - width: 240px; + width: 100%; border-left: 2px solid var(--line); z-index: var(--index-content); } @@ -19,6 +19,7 @@ .title { font-weight: bold; + font-size: 14px; color: var(--violet); height: 24px; align-content: center 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 index a7a9081..748276e 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.css @@ -2,8 +2,8 @@ display: flex; flex-direction: row; gap: 8px; + margin: 0 8px; align-items: center; - z-index: var(--index-content); } .search-container { @@ -13,7 +13,7 @@ .slider-container { width: 150px; - min-width: 150px; + min-width: 150px; } .select-container { diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor similarity index 70% rename from src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor rename to src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor index f06eaeb..8841706 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor @@ -14,16 +14,31 @@ + @bind-Value=GameFilter />
+ @if (!IsLoading) + { + @foreach (var game in GamesDto) + { + + } + } + else + { + @for (int i = 0; i < 20; i++) + { + + } + } +
- + diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.cs similarity index 64% rename from src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.cs rename to src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.cs index e356f4a..f586315 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.cs @@ -6,18 +6,20 @@ using Microsoft.AspNetCore.Components; namespace GameIdeas.BlazorApp.Pages.Games; -public partial class GameBase () +public partial class Game { [Inject] private IGameGateway GameGateway { get; set; } = default!; private DisplayType DisplayType = DisplayType.List; private GameFilterDto GameFilter = new(); private Popup? ManualAddPopup; + private bool IsLoading = false; private CategoriesDto? Categories; + private IEnumerable GamesDto = []; protected override async Task OnInitializedAsync() { - await HandleFetchCategories(); + await HandleFetchDatas(); await base.OnInitializedAsync(); } private void HandleAddClicked(AddType addType) @@ -37,8 +39,22 @@ public partial class GameBase () { ManualAddPopup?.Close(); } - private async Task HandleFetchCategories() + private async Task HandleFetchDatas() { - Categories = await GameGateway.FetchCategories(); + try + { + IsLoading = true; + + Categories = await GameGateway.FetchCategories(); + GamesDto = await GameGateway.FetchGames(new PaggingDto() { CurrentPage = 1, NumberPerPage = 50 }); + } + catch (Exception) + { + throw; + } + finally + { + IsLoading = false; + } } } \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.css new file mode 100644 index 0000000..501965d --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.css @@ -0,0 +1,14 @@ +.container { + display: grid; + grid-template-columns: 1fr 240px; + padding: 20px 0; + height: fit-content; +} + +.content { + z-index: var(--index-content); + margin: 0 20px; + display: flex; + flex-direction: column; + gap: 20px; +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.css deleted file mode 100644 index 5dc75c2..0000000 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.css +++ /dev/null @@ -1,12 +0,0 @@ -.container { - margin-top: 20px; - margin-bottom: 10px; - justify-content: space-between; - display: flex; - flex-direction: row; - height: 100%; -} - -.content { - z-index: var(--index-content); -} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs index 34873dc..25da217 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs @@ -33,4 +33,17 @@ public class GameGateway(IHttpClientService httpClientService) : IGameGateway throw new CategoryNotFoundException(ResourcesKey.ErrorFetchCategories); } } + + public async Task> FetchGames(PaggingDto pagging) + { + try + { + var result = await httpClientService.FetchDataAsync>(Endpoints.Game.Fetch(pagging)); + return result ?? throw new InvalidOperationException(ResourcesKey.ErrorFetchGames); + } + catch (Exception) + { + throw new CategoryNotFoundException(ResourcesKey.ErrorFetchGames); + } + } } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs index 0269bad..387d846 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs @@ -6,4 +6,5 @@ public interface IGameGateway { Task FetchCategories(); Task CreateGame(GameDto game); + Task> FetchGames(PaggingDto pagging); } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor index fb626b3..64a59ec 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor @@ -8,7 +8,7 @@ diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor index db11012..886e722 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor @@ -17,7 +17,7 @@ @if (!string.IsNullOrEmpty(Text)) {
- @Icons.Shared.Close; + @Icons.Close;
} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs index 5e5f3d1..fd0f42e 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs @@ -57,8 +57,8 @@ public partial class SearchInput { return Icon switch { - SearchInputIcon.Dropdown => Icons.Search.Triangle, - SearchInputIcon.Search => Icons.Search.Glass, + SearchInputIcon.Dropdown => Icons.Triangle, + SearchInputIcon.Search => Icons.Glass, _ => new MarkupString() }; } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.cs index 007bf0a..ea2be8f 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.cs @@ -1,3 +1,4 @@ +using GameIdeas.BlazorApp.Helpers; using Microsoft.AspNetCore.Components; namespace GameIdeas.BlazorApp.Shared.Components.Slider; @@ -16,15 +17,6 @@ public partial class Slider private string StatusColor(int value) { string str = "--thumb-color: var({0});"; - - int firstTier = (int)Math.Floor(0.33 * Params.Max); - int secondTier = (int)Math.Ceiling(0.66 * Params.Max); - - return value switch - { - int x when x <= firstTier => string.Format(str, "--red"), - int x when x >= secondTier => string.Format(str, "--green"), - _ => string.Format(str, "--yellow"), - }; + return string.Format(str, GameHelper.GetInterestColor(value, Params.Max)); } } \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs index e4cad7a..3e6289d 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs @@ -1,10 +1,14 @@ -namespace GameIdeas.BlazorApp.Shared.Constants; +using GameIdeas.Shared.Dto; + +namespace GameIdeas.BlazorApp.Shared.Constants; public static class Endpoints { public static class Game { public static readonly string Create = "api/Game/Create"; + public static string Fetch(PaggingDto pagging) => + $"api/Game?{nameof(pagging.CurrentPage)}={pagging.CurrentPage}&{nameof(pagging.NumberPerPage)}={pagging.NumberPerPage}"; } public static class Category diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Icons.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Icons.cs index 26ade56..07d5d99 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Icons.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Icons.cs @@ -8,21 +8,19 @@ public static class Icons private const string CloseBraket = ""; - public static class Search - { - public readonly static MarkupString Glass = new(OpenBraket + - "" + - CloseBraket); + public readonly static MarkupString Glass = new(OpenBraket + + "" + + CloseBraket); - public readonly static MarkupString Triangle = new(OpenBraket + - "" + - CloseBraket); - } + public readonly static MarkupString Triangle = new(OpenBraket + + "" + + CloseBraket); + + public readonly static MarkupString Close = new(OpenBraket + + "" + + CloseBraket); - public static class Shared - { - public readonly static MarkupString Close = new(OpenBraket + - "" + - CloseBraket); - } + public readonly static MarkupString Game = new(OpenBraket + + "" + + CloseBraket); } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Exceptions/GameNotFoundException.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Exceptions/GameNotFoundException.cs new file mode 100644 index 0000000..5e06e7a --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Exceptions/GameNotFoundException.cs @@ -0,0 +1,3 @@ +namespace GameIdeas.BlazorApp.Shared.Exceptions; + +public class GameNotFoundException(string message) : Exception(message); diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css index 238e46c..1f9a59a 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css @@ -39,7 +39,6 @@ html { html, body, #app { margin: 0; padding: 0; - height: 100%; } .invalid { diff --git a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs index f39a66e..6cc5cc8 100644 --- a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs +++ b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs @@ -38,6 +38,8 @@ public class Translations (TranslationService translationService) public string ErrorCreateGame => translationService.Translate(nameof(ErrorCreateGame)); public string InvalidTitle => translationService.Translate(nameof(InvalidTitle)); public string InvalidInterest => translationService.Translate(nameof(InvalidInterest)); + public string Unknown => translationService.Translate(nameof(Unknown)); + public string ErrorFetchGames => translationService.Translate(nameof(ErrorFetchGames)); } public static class ResourcesKey @@ -84,4 +86,6 @@ public static class ResourcesKey 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."); + public static string Unknown => _instance?.Unknown ?? throw new InvalidOperationException("ResourcesKey.Unknown is not initialized."); + public static string ErrorFetchGames => _instance?.ErrorFetchGames ?? throw new InvalidOperationException("ResourcesKey.ErrorFetchGames is not initialized."); } \ No newline at end of file diff --git a/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs b/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs index 3fdcb3b..0db432b 100644 --- a/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs +++ b/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs @@ -12,7 +12,7 @@ public class GameController(IGameService gameService, ILoggerFactory loggerFacto private readonly ILogger logger = loggerFactory.CreateLogger(); [HttpGet] - public async Task>> SearchGames([FromQuery] PaggingDto pagging) + public async Task>> GetGames([FromQuery] PaggingDto pagging) { try { diff --git a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json index 0dcf122..fd9dd3a 100644 --- a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json +++ b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json @@ -33,5 +33,8 @@ "PlaceholderAdd": "Ajouter un nouveau", "ErrorCreateGame": "Erreur lors de la Création d'un jeu", "InvalidTitle": "Le titre est incorrect", - "InvalidInterest": "L'interêt est incorrect'" + "InvalidInterest": "L'interêt est incorrect", + "Unknown": "Inconnu", + "ErrorFetchGames": "Erreur lors de la récupération des jeux" + } \ No newline at end of file