mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-23 19:30:06 +02:00
feat: selected realm stored in browser's local storage
This commit is contained in:
1 parent
4fb56c3b16
commit
46ed757dcb
10 files changed
+79
-5
No files matched your search
@@ -8,7 +8,7 @@
|
||||
<span style="color: @Constants.ClanTagColor;"> [<span style="font-weight: bolder;">@Player.ClanTag</span>]</span>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" title="@Localize["Win rate"]">
|
||||
<span style="font-size: 12px; color: @Player.WinRate.ScaleColor()"> <RadzenIcon Icon="flag" Style="height: 15px;" /> @Player.WinRate%</span>
|
||||
</div>
|
||||
<div class="row" title="@Localize["Battles"]">
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<RadzenDropDown @bind-Value=@CurrentRealmType
|
||||
Data=@Realms
|
||||
ValueProperty="RealmType"
|
||||
Style="width: 87px">
|
||||
Style="width: 87px"
|
||||
Change="@OnRealmChanged">
|
||||
<Template>
|
||||
<img src="@(((RealmSelector) context).RealmImage)" style="height: 27px"/>
|
||||
</Template>
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
[Inject]
|
||||
public IGraphQlBackendService GraphQlBackendService { get; set; }
|
||||
|
||||
[Inject]
|
||||
public ILocalStorageService LocalStorageService { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DialogType DialogType { get; set; }
|
||||
|
||||
@@ -52,6 +55,23 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var settings = await LocalStorageService.ReadSettings();
|
||||
CurrentRealmType = settings.RealmType;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
public async Task OnRealmChanged(object value)
|
||||
{
|
||||
if (value is RealmType realm)
|
||||
{
|
||||
await Mediator.Publish(new ChangeCurrentRealmTypeMessage(realm));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task OnSearchTextChange(string value)
|
||||
{
|
||||
if (DialogType == DialogType.FindPlayer && value.Length < 3)
|
||||
|
||||
Reference in new issue
Block a user