Replace custom socket implementation with SignalR.

Replace MSAL and custom cookie auth with Microsoft.Identity.EntityFramework
Also some UI redesign to accommodate different login experience.
This commit is contained in:
2024-08-25 03:46:44 +00:00
parent d688afaeae
commit 51d234d871
172 changed files with 3857 additions and 4045 deletions

View File

@@ -0,0 +1,59 @@
@using Shogi.Contracts.Types;
@using System.ComponentModel.DataAnnotations;
@using System.Net;
@using System.Text.Json;
@inject ShogiApi ShogiApi
<section class="GameBrowser PrimaryTheme ThemeVariant--Contrast">
<div class="table">
<row class="header">
<span>Creator</span>
<span>Seats</span>
</row>
<hr />
<AuthorizeView>
@foreach (var session in allSessions)
{
<row>
<div>
<a href="/play/@session.SessionId">@session.Player1</a>
</div>
@if (string.IsNullOrEmpty(session.Player2))
{
<span>1 / 2</span>
}
else
{
<span>Full</span>
}
</row>
}
</AuthorizeView>
</div>
@if (allSessions.Length == 0)
{
<p>There are no games being played.</p>
}
</section>
@code {
private SessionMetadata[] allSessions = Array.Empty<SessionMetadata>();
private SessionMetadata? activeSession;
protected override Task OnInitializedAsync()
{
return FetchSessions();
}
async Task FetchSessions()
{
var sessions = await ShogiApi.GetAllSessionsMetadata();
if (sessions != null)
{
this.allSessions = sessions.ToArray();
StateHasChanged();
}
}
}