chore: Some minor improvements

This commit is contained in:
Mikhail Shabanov committed 2021-05-14 13:29:07 +02:00
1 parent 798a9d0e43
commit d3d25fa62d
3 files changed
+19 -9

No files matched your search

@@ -1,16 +1,23 @@
@using WotBlitzStatisticsPro.Blazor.Model @using WotBlitzStatisticsPro.Blazor.Model
@inherits SearchDialogTypeBase @inherits SearchDialogTypeBase
<!--Realm type selection--> <!--Realm type selection-->
<RadzenTextBox Placeholder=@($"{Localizer["Search"]}...") Change=@OnSearchTextChange Style="width: 100%;" /> <RadzenTextBox Placeholder=@($"{Localizer["Search"]}...") Change=@OnSearchTextChange Disabled="@ComponentBusy" Style="width: 100%;" />
<RadzenProgressBar Value="100" ShowValue="false" Mode="ProgressBarMode.Indeterminate"
Visible="@ComponentBusy"
Style="width: 100%; margin-top: 10px;" />
<RadzenListBox <RadzenListBox
@bind-Value=@CurrentValue @bind-Value=@CurrentValue
Data=@FilteredList Data=@FilteredList
ValueProperty="ItemId" ValueProperty="ItemId"
Style="height:335px; width: 100%; margin-top: 10px;"> Style="height:335px; width: 100%; margin-top: 10px;"
Visible="@(!ComponentBusy)">
<Template> <Template>
<!--ToDo: Create new component that will show nick[clan] {WinRate with color}, {battles count with translatable word "battles"}. And another component for Clans--> <!--ToDo: Create new component that will show nick[clan] {WinRate with color}, {battles count with translatable word "battles"}. And another component for Clans-->
@(((SearchItem) context).ItemName) | accountId: @(((SearchItem) context).ItemId) @(((SearchItem) context).ItemName) | accountId: @(((SearchItem) context).ItemId)
</Template> </Template>
</RadzenListBox> </RadzenListBox>
<RadzenButton Click=@(args => OnOkButtonClick()) Text="Ok" Style="margin: 10px auto 10px auto; display: block; width: 150px; " /> <RadzenButton
Click=@(args => OnOkButtonClick())
Text="Ok"
Visible="@(!ComponentBusy)"
Style="margin: 10px auto 10px auto; display: block; width: 150px; " />
@@ -33,6 +33,8 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
public long CurrentValue { get; set; } public long CurrentValue { get; set; }
public bool ComponentBusy { get; set; } = false;
public async Task OnSearchTextChange(string value) public async Task OnSearchTextChange(string value)
{ {
if (DialogType == DialogType.FindPlayer && value.Length < 3) if (DialogType == DialogType.FindPlayer && value.Length < 3)
@@ -41,10 +43,9 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
} }
FilteredList.Clear(); FilteredList.Clear();
ComponentBusy = true;
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
// ToDo: Add busy cursor
// ToDo: Move this call to a service // ToDo: Move this call to a service
var accounts = var accounts =
await WotBlitzStatisticsProClient.FindAccounts.ExecuteAsync(value, RealmType.Ru, RequestLanguage.En); await WotBlitzStatisticsProClient.FindAccounts.ExecuteAsync(value, RealmType.Ru, RequestLanguage.En);
@@ -58,8 +59,10 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
} }
await InvokeAsync(StateHasChanged);
} }
ComponentBusy = false;
await InvokeAsync(StateHasChanged);
} }
public async Task OnOkButtonClick() public async Task OnOkButtonClick()
+2 -2
View File
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System; using System;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -30,11 +31,10 @@ namespace WotBlitzStatisticsPro.Blazor
builder.Services.AddSingleton<NavigationMessagesInterceptor>(); builder.Services.AddSingleton<NavigationMessagesInterceptor>();
builder.Services.AddScoped<ILocalStorageService, LocalStorageService>(); builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
// ToDo: Find out URL
// StrawberryShake GraphQL Client // StrawberryShake GraphQL Client
builder.Services builder.Services
.AddWotBlitzStatisticsProClient() .AddWotBlitzStatisticsProClient()
.ConfigureHttpClient(client => client.BaseAddress = new Uri($"https://localhost:5001/graphql/")); .ConfigureHttpClient(client => client.BaseAddress = new Uri($"{builder.HostEnvironment.BaseAddress}graphql/"));
var host = builder.Build(); var host = builder.Build();