mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 02:17:20 +02:00
feat: realm added. Plus clans bug fixed
This commit is contained in:
1 parent
68faee2d23
commit
3c67595d94
6 files changed
+49
-9
No files matched your search
@@ -0,0 +1,7 @@
|
||||
using WotBlitzStatisticsPro.Blazor.GraphQl;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.Model
|
||||
{
|
||||
public record RealmSelector(RealmType RealmType, string RealmImage);
|
||||
|
||||
}
|
||||
@@ -1,12 +1,24 @@
|
||||
@using WotBlitzStatisticsPro.Blazor.Model
|
||||
@inherits SearchDialogTypeBase
|
||||
<!--Realm type selection-->
|
||||
<RadzenTextBox Placeholder=@($"{Localizer["Search"]}...") Change=@OnSearchTextChange Disabled="@ComponentBusy" Style="width: 100%;" />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<RadzenDropDown @bind-Value=@CurrentRealmType
|
||||
Data=@Realms
|
||||
ValueProperty="RealmType"
|
||||
Style="width: 87px">
|
||||
<Template>
|
||||
<img src="@(((RealmSelector) context).RealmImage)" style="height: 27px"/>
|
||||
</Template>
|
||||
</RadzenDropDown>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<RadzenTextBox Placeholder=@($"{Localizer["Search"]}...") Change=@OnSearchTextChange Disabled="@ComponentBusy" Style="width: 150px;"/>
|
||||
</div>
|
||||
</div>
|
||||
<RadzenProgressBar Value="100" ShowValue="false" Mode="ProgressBarMode.Indeterminate"
|
||||
Visible="@ComponentBusy"
|
||||
Style="width: 100%; margin-top: 10px;" />
|
||||
<RadzenListBox
|
||||
@bind-Value=@CurrentValue
|
||||
<RadzenListBox @bind-Value=@CurrentValue
|
||||
Data=@FilteredList
|
||||
ValueProperty="ItemId"
|
||||
Style="height:335px; width: 100%; margin-top: 10px;"
|
||||
@@ -16,8 +28,7 @@
|
||||
@(((SearchItem) context).ItemName) | accountId: @(((SearchItem) context).ItemId)
|
||||
</Template>
|
||||
</RadzenListBox>
|
||||
<RadzenButton
|
||||
Click=@(args => OnOkButtonClick())
|
||||
<RadzenButton Click=@(args => OnOkButtonClick())
|
||||
Text="Ok"
|
||||
Visible="@(!ComponentBusy)"
|
||||
Style="margin: 10px auto 10px auto; display: block; width: 150px; " />
|
||||
@@ -32,12 +32,26 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
|
||||
public List<SearchItem> FilteredList { get; set; } = new();
|
||||
|
||||
public List<RealmSelector> Realms { get; set; }
|
||||
|
||||
public RealmType CurrentRealmType { get; set; } = RealmType.Eu;
|
||||
|
||||
public long CurrentValue { get; set; }
|
||||
|
||||
public bool ComponentBusy { get; set; } = false;
|
||||
|
||||
public SearchDialogTypeBase()
|
||||
{
|
||||
Realms = new List<RealmSelector>()
|
||||
{
|
||||
new(RealmType.Eu, "/realm/region.eu.scale-200.png"),
|
||||
new(RealmType.Ru, "/realm/region.ru.scale-200.png"),
|
||||
new(RealmType.Na, "/realm/region.na.scale-200.png"),
|
||||
new(RealmType.Asia, "/realm/region.asia.scale-200.png"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public async Task OnSearchTextChange(string value)
|
||||
{
|
||||
if (DialogType == DialogType.FindPlayer && value.Length < 3)
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace WotBlitzStatisticsPro.Blazor.Services
|
||||
{
|
||||
result.Add(new FindPlayers_Players_AccountsSearchResponseItem(
|
||||
faker.Random.Long(100000, 999999),
|
||||
faker.Name.LastName(),
|
||||
faker.Lorem.Word().OrNull(faker, 0.8f),
|
||||
faker.Internet.UserName(),
|
||||
faker.Hacker.Abbreviation().OrNull(faker, 0.6f),
|
||||
faker.Date.Past(),
|
||||
faker.Random.Number(10, 20000),
|
||||
faker.Random.Number(30, 90)));
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace WotBlitzStatisticsPro.GraphQl.Query
|
||||
/// <param name="realmType">Wargaming Realm.</param>
|
||||
/// <param name="language">Language for the output data.</param>
|
||||
/// <returns></returns>
|
||||
public Task<ICollection<AccountsSearchResponseItem>> Players(
|
||||
public Task<ICollection<AccountsSearchResponseItem>?> Players(
|
||||
string accountNick,
|
||||
RealmType? realmType,
|
||||
RequestLanguage? language)
|
||||
|
||||
@@ -163,6 +163,10 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
public async Task<List<ClanAccountInfo>?> GetBulkPlayerClans(long[] accountIds, RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
if (accountIds.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var clanInfo = await GetFromBlitzApi<Dictionary<string, ClanAccountInfo>>(
|
||||
realmType,
|
||||
language,
|
||||
@@ -174,6 +178,10 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
public async Task<List<ClanInfo>?> GetShortClansInfo(long[] clanIds, RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
if (clanIds.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var clanInfo = await GetFromBlitzApi<Dictionary<string, ClanInfo>>(
|
||||
realmType,
|
||||
language,
|
||||
|
||||
Reference in new issue
Block a user