+
@tag.Label
}
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
index 5f28270..31b603a 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor.css
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameRow.razor.css
@@ -1 +1,39 @@
-
\ No newline at end of file
+.row {
+ display: grid;
+ grid-template-columns: 48px 5fr 70px 2fr 3fr 60px 30px 30px;
+ text-wrap: nowrap;
+ height: 64px;
+ background: var(--input-secondary);
+ box-shadow: var(--drop-shadow);
+ border-radius: var(--big-radius);
+ overflow: hidden;
+ align-content: center;
+ align-items:center;
+}
+.title {
+ font-weight: bold;
+}
+
+.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;
+ gap: 4px;
+}
+
+.platform-pill {
+ color: var(--violet);
+ cursor: pointer;
+
+}
+
+ .platform-pill:hover {
+ text-decoration: underline;
+ }
\ 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..65b68ce 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
@@ -6,7 +6,7 @@
padding-left: 10px;
height: 100%;
box-sizing: border-box;
- width: 240px;
+ width: 100%;
border-left: 2px solid var(--line);
z-index: var(--index-content);
}
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor
index f06eaeb..714114a 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor
@@ -13,17 +13,21 @@
+ @bind-DisplayType=DisplayType
+ @bind-Value=GameFilter/>
+ @foreach (var game in GamesDto)
+ {
+
+ }
-
+
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.cs
index 2f09114..6534e9e 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.cs
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.cs
@@ -3,6 +3,7 @@ using GameIdeas.BlazorApp.Shared.Components.Popup;
using GameIdeas.BlazorApp.Shared.Models;
using GameIdeas.Shared.Dto;
using Microsoft.AspNetCore.Components;
+using System.Net.Http.Headers;
namespace GameIdeas.BlazorApp.Pages.Games;
@@ -13,11 +14,13 @@ public partial class Game
private DisplayType DisplayType = DisplayType.List;
private GameFilterDto GameFilter = new();
private Popup? ManualAddPopup;
+ private bool IsLoading;
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 +40,22 @@ public partial class Game
{
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
index 5dc75c2..5c58be9 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.css
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Game.razor.css
@@ -1,12 +1,15 @@
.container {
+ display: grid;
+ grid-template-columns: 1fr 240px;
margin-top: 20px;
margin-bottom: 10px;
- justify-content: space-between;
- display: flex;
- flex-direction: row;
height: 100%;
}
.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/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/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/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/GameIdeas.Resources/CreateStaticResourceKey.cs b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs
index aa5b8fb..6cc5cc8 100644
--- a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs
+++ b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs
@@ -39,6 +39,7 @@ public class Translations (TranslationService translationService)
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
@@ -86,4 +87,5 @@ public static class ResourcesKey
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 30cf2c1..fd9dd3a 100644
--- a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json
+++ b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json
@@ -34,5 +34,7 @@
"ErrorCreateGame": "Erreur lors de la Création d'un jeu",
"InvalidTitle": "Le titre est incorrect",
"InvalidInterest": "L'interêt est incorrect",
- "Unknown": "Inconnu"
+ "Unknown": "Inconnu",
+ "ErrorFetchGames": "Erreur lors de la récupération des jeux"
+
}
\ No newline at end of file