mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 20:00:05 +02:00
feat: added login/out buttons to nav menu and index page
This commit is contained in:
1 parent
6cbb809f44
commit
6390c454d0
8 files changed
+190
-6
No files matched your search
@@ -2,16 +2,31 @@
|
||||
@using MediatR
|
||||
@using WotBlitzStatisticsPro.Blazor.Messages
|
||||
@using WotBlitzStatisticsPro.Blazor.Model
|
||||
@using WotBlitzStatisticsPro.Blazor.Services
|
||||
@inject IStringLocalizer<App> Localize
|
||||
@inject IMediator Mediator
|
||||
@inject ILocalStorageService LocalStorage
|
||||
<div class="splash">
|
||||
<div class="splash-content">
|
||||
<RadzenLabel Text=@Localize["Welcome to WOT Blitz statistics application!"] Style="margin: 30px 0px 100px 0px"></RadzenLabel>
|
||||
|
||||
<RadzenButton Click=@(async args => { await Mediator.Publish(new LoginToWgMessage()); })
|
||||
Icon="vpn_key"
|
||||
Text=@Localize["Login with WG.net ID"]
|
||||
Style="width: 300px; margin: 30px" />
|
||||
@if(LoginInfo != null)
|
||||
{
|
||||
<RadzenButton Click=@(async args => { await Mediator.Publish(new OpenPlayerInfoMessage(LoginInfo.AccountId, true)); })
|
||||
Icon="person"
|
||||
[email protected]
|
||||
Style="width: 300px; margin: 30px" />
|
||||
<RadzenButton Click=@(async args => { await Mediator.Publish(new LogOutFromWgMessage()); })
|
||||
Icon="logout"
|
||||
Text=@Localize["Log out"]
|
||||
Style="width: 300px; margin: 30px" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<RadzenButton Click=@(async args => { await Mediator.Publish(new LoginToWgMessage()); })
|
||||
Icon="vpn_key"
|
||||
Text=@Localize["Login with WG.net ID"]
|
||||
Style="width: 300px; margin: 30px" />
|
||||
}
|
||||
<RadzenButton Click=@(async args => { await Mediator.Publish(new OpenSearchDialogMessage(DialogType.FindPlayer)); })
|
||||
Icon="person_search"
|
||||
Text=@Localize["Search player"]
|
||||
@@ -24,3 +39,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
public LoginInfo? LoginInfo { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
LoginInfo = await LocalStorage.GetItemAsync<LoginInfo>(Constants.LoginInfoLocalStorageKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user