Display list of games (#16)

Co-authored-by: Maxime Adler <madler@sqli.com>
Reviewed-on: #16
This commit was merged in pull request #16.
This commit is contained in:
2025-04-17 00:59:30 +02:00
parent 79a9bb91d7
commit d90811723a
25 changed files with 438 additions and 55 deletions

View File

@@ -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"
};
}
}