diff --git a/WotBlitzStatisticsPro.Blazor/Model/SearchItem.cs b/WotBlitzStatisticsPro.Blazor/Model/SearchItem.cs
new file mode 100644
index 0000000..97f5401
--- /dev/null
+++ b/WotBlitzStatisticsPro.Blazor/Model/SearchItem.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace WotBlitzStatisticsPro.Blazor.Model
+{
+ [Obsolete("This is temporary item. In the future there should be two new data models with 'clan, winrate and battles' for player, and 'name, tag members count' for clan")]
+ public record SearchItem(long ItemId, string ItemName);
+
+}
\ No newline at end of file
diff --git a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialog.razor b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialog.razor
index fed6a39..3bcb9e9 100644
--- a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialog.razor
+++ b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialog.razor
@@ -1,4 +1,16 @@
-@inherits SearchDialogTypeBase
-
SearchDialog
-@DialogType
- OnClick()) Text="Ok" Style="margin-bottom: 20px; width: 150px" />
+@using WotBlitzStatisticsPro.Blazor.Model
+@inherits SearchDialogTypeBase
+
+
+
+
+
+
+ @(((SearchItem) context).ItemName) | accountId: @(((SearchItem) context).ItemId)
+
+
+ OnOkButtonClick()) Text="Ok" Style="margin: 10px auto 10px auto; display: block; width: 150px; " />
diff --git a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs
index fd1961e..6314778 100644
--- a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs
+++ b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs
@@ -1,6 +1,8 @@
-using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Threading.Tasks;
using MediatR;
using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Localization;
using Radzen;
using WotBlitzStatisticsPro.Blazor.Messages;
using WotBlitzStatisticsPro.Blazor.Model;
@@ -15,12 +17,66 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
[Inject]
private IMediator Mediator { get; set; }
+ [Inject]
+ public IStringLocalizer Localizer { get; set; }
+
[Parameter]
public DialogType DialogType { get; set; }
- public async Task OnClick()
+ public List FilteredList { get; set; } = new();
+
+ //public RealmType CurrentRealmType { get; set; } = RealmType.Eu;
+
+ public long CurrentValue { get; set; }
+
+ public async Task OnSearchTextChange(string value)
{
- await Mediator.Publish(new OpenPlayerInfoMessage(123456789, false));
+ if (DialogType == DialogType.FindPlayer && value.Length < 3)
+ {
+ return;
+ }
+
+ FilteredList.Clear();
+ await InvokeAsync(StateHasChanged);
+
+ // ToDo: Call GraphQL Backend CurrentRealmType + value
+ await Task.Delay(1000);
+ for (int i = 0; i < 15; i++)
+ {
+ FilteredList.Add(new SearchItem(i, $"Item number {i}"));
+ }
+
+ await InvokeAsync(StateHasChanged);
+
+ }
+
+ public async Task OnLoadSearchData(LoadDataArgs args)
+ {
+ if (DialogType == DialogType.FindPlayer && args.Filter.Length < 3)
+ {
+ return;
+ }
+
+ FilteredList.Clear();
+ await InvokeAsync(StateHasChanged);
+
+ // ToDo: Call GraphQL Backend CurrentRealmType + args.Filter
+ await Task.Delay(1000);
+ for (int i = 0; i < 15; i++)
+ {
+ FilteredList.Add(new SearchItem(i, $"Item number {i}"));
+ }
+
+ await InvokeAsync(StateHasChanged);
+ }
+
+ public async Task OnOkButtonClick()
+ {
+ if (CurrentValue > 0)
+ {
+ await Mediator.Publish(new OpenPlayerInfoMessage(CurrentValue, false));
+ }
+
DialogService.Close(true);
}
}
diff --git a/WotBlitzStatisticsPro.Blazor/Resources/App.de.resx b/WotBlitzStatisticsPro.Blazor/Resources/App.de.resx
index b9fdc4b..3d8c6ab 100644
--- a/WotBlitzStatisticsPro.Blazor/Resources/App.de.resx
+++ b/WotBlitzStatisticsPro.Blazor/Resources/App.de.resx
@@ -123,6 +123,9 @@
Anmelden mit WG.net-ID
+
+ Suchen
+
Clan suchen
diff --git a/WotBlitzStatisticsPro.Blazor/Resources/App.ru.resx b/WotBlitzStatisticsPro.Blazor/Resources/App.ru.resx
index aa60302..7f1a786 100644
--- a/WotBlitzStatisticsPro.Blazor/Resources/App.ru.resx
+++ b/WotBlitzStatisticsPro.Blazor/Resources/App.ru.resx
@@ -123,6 +123,9 @@
Войти с WG.net ID
+
+ Поиск
+
Поиск клана
diff --git a/WotBlitzStatisticsPro.Blazor/Services/SearchDialogService.cs b/WotBlitzStatisticsPro.Blazor/Services/SearchDialogService.cs
index 9019411..912e3e1 100644
--- a/WotBlitzStatisticsPro.Blazor/Services/SearchDialogService.cs
+++ b/WotBlitzStatisticsPro.Blazor/Services/SearchDialogService.cs
@@ -2,6 +2,7 @@
using System.Threading;
using System.Threading.Tasks;
using MediatR;
+using Microsoft.Extensions.Localization;
using Radzen;
using WotBlitzStatisticsPro.Blazor.Messages;
using WotBlitzStatisticsPro.Blazor.Model;
@@ -13,16 +14,20 @@ namespace WotBlitzStatisticsPro.Blazor.Services
{
private readonly DialogService _dialogService;
+ private readonly IStringLocalizer _localizer;
- public SearchDialogService(DialogService dialogService)
+ public SearchDialogService(
+ DialogService dialogService,
+ IStringLocalizer localizer)
{
_dialogService = dialogService;
+ _localizer = localizer;
}
public async Task OpenSearchDialog(DialogType type)
{
- await _dialogService.OpenAsync($"Search",
+ await _dialogService.OpenAsync(type == DialogType.FindPlayer ? _localizer.GetString("Search player") : _localizer.GetString("Search clan"),
new Dictionary() { { "DialogType", type } },
new DialogOptions() { Width = "300px", Height = "530px" });
}