squash a bunch of commits
This commit is contained in:
46
Shogi.UI/Pages/Home/Home.razor
Normal file
46
Shogi.UI/Pages/Home/Home.razor
Normal file
@@ -0,0 +1,46 @@
|
||||
@page "/"
|
||||
@using Shogi.Contracts.Types
|
||||
@using System.Net.WebSockets
|
||||
@using System.Text
|
||||
@inject ModalService modalService
|
||||
@inject AccountManager AccountManager
|
||||
@inject AccountState Account
|
||||
|
||||
@*<Modals />*@
|
||||
|
||||
<main class="shogi">
|
||||
@if (welcomeModalIsVisible)
|
||||
{
|
||||
<LoginModal />
|
||||
}
|
||||
<PageHeader />
|
||||
<GameBrowser ActiveSessionChanged="OnChangeSession" />
|
||||
<GameBoard SessionName="@activeSessionName" />
|
||||
</main>
|
||||
|
||||
@code {
|
||||
bool welcomeModalIsVisible = false;
|
||||
string activeSessionName = string.Empty;
|
||||
ClientWebSocket socket = new ClientWebSocket();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Account.LoginChangedEvent += OnLoginChanged;
|
||||
var success = await AccountManager.TryLoginSilentAsync();
|
||||
if (!success)
|
||||
{
|
||||
welcomeModalIsVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoginChanged(object? sender, LoginEventArgs args)
|
||||
{
|
||||
welcomeModalIsVisible = args.User == null;
|
||||
StateHasChanged();
|
||||
}
|
||||
private void OnChangeSession(SessionMetadata s)
|
||||
{
|
||||
activeSessionName = s.Name;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user