Add header for game list (#3)

Co-authored-by: Maxime Adler <madler@sqli.com>
Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2025-02-27 01:09:05 +01:00
parent d9ae2f39bb
commit 4183b4b616
28 changed files with 697 additions and 104 deletions

View File

@@ -1,5 +1,15 @@
@page "/"
@page "/Games"
@using GameIdeas.BlazorApp.Layouts
@using GameIdeas.BlazorApp.Shared.Components
@using GameIdeas.BlazorApp.Shared.Headers
@using GameIdeas.Resources
@inherits LayoutComponentBase
@layout MainLayout
<PageTitle>@ResourcesKey.GamesIdeas</PageTitle>
<HeaderBase>
<Body>
<div>PROUT</div>
</Body>
</HeaderBase>

View File

@@ -1,24 +1,6 @@
using Microsoft.AspNetCore.Components;
using System.Net.Http.Json;
using GameIdeas.Resources;
namespace GameIdeas.BlazorApp.Pages.Games;
public partial class GamesBase (
IHttpClientFactory HttpClientFactory,
TranslationService TranslationService,
Translations Translations) : LayoutComponentBase
public partial class GamesBase ()
{
protected override async Task OnInitializedAsync()
{
var client = HttpClientFactory.CreateClient("GameIdeas.WebAPI");
var response = await client.GetAsync("api/Translations");
var dictionary = await response.Content.ReadFromJsonAsync<Dictionary<string, string>>();
if (dictionary != null)
{
TranslationService.Initialize(dictionary);
ResourcesKey.Initialize(Translations);
}
}
}

View File

@@ -0,0 +1,20 @@
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;
}
}

View File

@@ -0,0 +1,13 @@
namespace GameIdeas.BlazorApp.Pages.Games.Models;
public enum AddType
{
Manual,
Auto
}
public class AddTypeParams(AddType addType, string label)
{
public AddType AddType { get; set; } = addType;
public string? Label { get; set; } = label;
}