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:
59
Shogi.UI/Pages/Play/GameBrowser.razor
Normal file
59
Shogi.UI/Pages/Play/GameBrowser.razor
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user