feat: tanks table layout
No files matched your search
@@ -13,7 +13,7 @@
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="3.2.8" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="3.6.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using WotBlitzStatisticsPro.Blazor.GraphQl;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.Helpers
|
||||
{
|
||||
public static class AssetsHelper
|
||||
{
|
||||
public static string IconAsset(this MarkOfMastery mastery)
|
||||
{
|
||||
return mastery switch
|
||||
{
|
||||
MarkOfMastery.Rank3 => "/mastery/vehicle.mark.third.scale-200.png",
|
||||
MarkOfMastery.Rank2 => "/mastery/vehicle.mark.second.scale-200.png",
|
||||
MarkOfMastery.Rank1 => "/mastery/vehicle.mark.first.scale-200.png",
|
||||
MarkOfMastery.Master => "/mastery/vehicle.mark.master.scale-200.png",
|
||||
_ => "/mastery/vehicle.mark.none.big.scale-200.png"
|
||||
};
|
||||
}
|
||||
|
||||
public static string TankTypeAsset(this string tankTypeId, bool isPremium)
|
||||
{
|
||||
return tankTypeId switch
|
||||
{
|
||||
"heavyTank" when !isPremium => "/tank-type/vehicle.class.heavy.small.scale-200.png",
|
||||
"heavyTank" when isPremium => "/tank-type/vehicle.class.heavy.premium.small.scale-200.png",
|
||||
"AT-SPG" when !isPremium => "/tank-type/vehicle.class.atspg.small.scale-200.png",
|
||||
"AT-SPG" when isPremium => "/tank-type/vehicle.class.atspg.premium.small.scale-200.png",
|
||||
"mediumTank" when !isPremium => "/tank-type/vehicle.class.medium.small.scale-200.png",
|
||||
"mediumTank" when isPremium => "/tank-type/vehicle.class.medium.premium.small.scale-200.png",
|
||||
"lightTank" when !isPremium => "/tank-type/vehicle.class.light.small.scale-200.png",
|
||||
"lightTank" when isPremium => "/tank-type/vehicle.class.light.premium.small.scale-200.png",
|
||||
_ => ""
|
||||
};
|
||||
}
|
||||
|
||||
public static string NationAsset(this string nationTypeId)
|
||||
{
|
||||
return nationTypeId switch
|
||||
{
|
||||
"usa" => "flags/usa.png",
|
||||
"france" => "flags/france.png",
|
||||
"ussr" => "flags/ussr.png",
|
||||
"china" => "flags/china.png",
|
||||
"uk" => "flags/uk.png",
|
||||
"japan" => "flags/japan.png",
|
||||
"germany" => "flags/germany.png",
|
||||
"other" => "flags/other.png",
|
||||
"european" => "flags/eu.png",
|
||||
_ => "flags/vehicle.nation.unknown.scale-200.png"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Encodings.Web;
|
||||
using System;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Text.Unicode;
|
||||
|
||||
@@ -10,5 +11,32 @@ namespace WotBlitzStatisticsPro.Blazor.Helpers
|
||||
{
|
||||
return JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = true, Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.Cyrillic) });
|
||||
}
|
||||
|
||||
public static string RomanNumber(this int number)
|
||||
{
|
||||
var romanNumerals = new[] {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
|
||||
var numerals = new[] {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
|
||||
|
||||
if (number <= 0)
|
||||
{
|
||||
return number.ToString();
|
||||
}
|
||||
|
||||
string result = "";
|
||||
|
||||
while (number > 0)
|
||||
{
|
||||
// find biggest numeral that is less than equal to number
|
||||
var index = Array.FindIndex(numerals, n => n <= number);
|
||||
|
||||
// subtract it's value from your number
|
||||
number -= numerals[index];
|
||||
|
||||
// tack it onto the end of your roman numeral
|
||||
result = string.Concat(result, romanNumerals[index]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
<PlayerInfoStatistics></PlayerInfoStatistics>
|
||||
</RadzenTabsItem>
|
||||
<RadzenTabsItem Icon="agriculture">
|
||||
<PlayerInfoTanksList></PlayerInfoTanksList>
|
||||
<PlayerInfoTanksList TanksList="@AccountInfo.Tanks"></PlayerInfoTanksList>
|
||||
</RadzenTabsItem>
|
||||
<RadzenTabsItem Icon="military_tech">
|
||||
<PlayerInfoAchievements></PlayerInfoAchievements>
|
||||
|
||||
@@ -1,5 +1,107 @@
|
||||
<h3>PlayerTanksList</h3>
|
||||
@using WotBlitzStatisticsPro.Blazor.Helpers
|
||||
@inject TooltipService TooltipService
|
||||
@inject IStringLocalizer<App> Localize
|
||||
|
||||
<RadzenDataGrid AllowFiltering="true"
|
||||
AllowColumnResize="true"
|
||||
FilterMode="FilterMode.Advanced"
|
||||
PageSize="10"
|
||||
AllowPaging="true"
|
||||
AllowSorting="true"
|
||||
Data="@TanksList"
|
||||
TItem="ITank"
|
||||
ColumnWidth="300px"
|
||||
LogicalFilterOperator="LogicalFilterOperator.Or">
|
||||
<Columns>
|
||||
<RadzenDataGridColumn TItem="ITank" Filterable="false" Sortable="false" Title="" Frozen="true" Width="34px" TextAlign="TextAlign.Center">
|
||||
<Template Context="data">
|
||||
<b>@data.Tier.RomanNumber()</b>
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="ITank" Filterable="false" Sortable="false" Title="" Frozen="true" Width="34px" TextAlign="TextAlign.Center">
|
||||
<Template Context="data">
|
||||
<RadzenImage Path="@data.TankTypeId.TankTypeAsset(data.IsPremium)" MouseEnter="@(args => ShowTooltip(args, data.TankType) )" style="width: 24px; height: 24px;" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="ITank" Filterable="false" Sortable="false" Title="" Frozen="true" Width="50px" TextAlign="TextAlign.Center">
|
||||
<Template Context="data">
|
||||
<RadzenImage Path="@data.TankNationId.NationAsset()" MouseEnter="@(args => ShowTooltip(args, data.TankNation) )" style="width: 35px; height: 23px; border-radius: 4px;" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="ITank" Filterable="false" Sortable="false" Title="" Frozen="true" Width="34px" TextAlign="TextAlign.Center">
|
||||
<Template Context="data">
|
||||
<RadzenImage Path="@data.MarkOfMastery.IconAsset()" style="width: 24px; height: 24px;" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="ITank" Title="" Sortable="false" Filterable="false" Width="55px">
|
||||
<Template Context="data">
|
||||
<RadzenImage Path="@data.PreviewImage" style="width: 50px; height: 40px; border-radius: 8px;" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="ITank" Property="Name" Filterable="false" Sortable="true" Title="@Localize["Tank"]" Frozen="true" Width="100px" TextAlign="TextAlign.Left" />
|
||||
<RadzenDataGridColumn TItem="ITank" Property="Battles" Filterable="false" Sortable="true" Title="⚔" Frozen="false" Width="70px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="ITank" Property="WinRate"
|
||||
Filterable="false"
|
||||
Sortable="true"
|
||||
Title="🏳"
|
||||
Frozen="false"
|
||||
Width="50px"
|
||||
TextAlign="TextAlign.Center"
|
||||
FormatString="{0:N0}%"/>
|
||||
<RadzenDataGridColumn TItem="ITank" Property="Wn7"
|
||||
Filterable="false"
|
||||
Sortable="true"
|
||||
Title="@Localize["Wn7"]"
|
||||
Frozen="false"
|
||||
Width="80px"
|
||||
TextAlign="TextAlign.Center"
|
||||
FormatString="{0:N0}"/>
|
||||
<RadzenDataGridColumn TItem="ITank" Property="AvgDamage"
|
||||
Filterable="false"
|
||||
Sortable="true"
|
||||
Title="💣"
|
||||
Frozen="false"
|
||||
Width="50px"
|
||||
TextAlign="TextAlign.Center"
|
||||
FormatString="{0:N0}"/>
|
||||
<RadzenDataGridColumn TItem="ITank" Property="AvgXp"
|
||||
Filterable="false"
|
||||
Sortable="true"
|
||||
Title="⭐"
|
||||
Frozen="false"
|
||||
Width="50px"
|
||||
TextAlign="TextAlign.Center"
|
||||
FormatString="{0:N0}"/>
|
||||
<RadzenDataGridColumn TItem="ITank" Property="MaxXp"
|
||||
Filterable="false"
|
||||
Sortable="true"
|
||||
Title="🌟"
|
||||
Frozen="false"
|
||||
Width="50px"
|
||||
TextAlign="TextAlign.Center"
|
||||
FormatString="{0:N0}"/>
|
||||
<RadzenDataGridColumn TItem="ITank" Property="SurvivalRate"
|
||||
Filterable="false"
|
||||
Sortable="true"
|
||||
Title="⚰"
|
||||
Frozen="false"
|
||||
Width="50px"
|
||||
TextAlign="TextAlign.Center"
|
||||
FormatString="{0:N0}%"/>
|
||||
<RadzenDataGridColumn TItem="ITank" Property="LastBattleTime"
|
||||
Filterable="false"
|
||||
Sortable="true"
|
||||
Title="⌚"
|
||||
Frozen="false"
|
||||
Width="100px"
|
||||
TextAlign="TextAlign.Center"
|
||||
FormatString="{0:d}"/>
|
||||
</Columns>
|
||||
</RadzenDataGrid>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public IEnumerable<ITank> TanksList { get; set; }
|
||||
|
||||
void ShowTooltip(ElementReference elementReference, string message, TooltipOptions options = null) => TooltipService.Open(elementReference, message, options);
|
||||
}
|
||||
@@ -26,6 +26,7 @@ namespace WotBlitzStatisticsPro.Blazor
|
||||
|
||||
builder.Services.AddScoped<DialogService>();
|
||||
builder.Services.AddScoped<NotificationService>();
|
||||
builder.Services.AddScoped<TooltipService>();
|
||||
builder.Services.AddScoped<ISearchDialogService, SearchDialogService>();
|
||||
|
||||
builder.Services.AddMediatR(typeof(Program));
|
||||
|
||||
@@ -168,6 +168,9 @@
|
||||
<data name="Search player" xml:space="preserve">
|
||||
<value>Spieler suchen</value>
|
||||
</data>
|
||||
<data name="Tank" xml:space="preserve">
|
||||
<value>Panzer</value>
|
||||
</data>
|
||||
<data name="Welcome to WOT Blitz statistics application!" xml:space="preserve">
|
||||
<value>Willkommen bei der WOT Blitz statistics!</value>
|
||||
</data>
|
||||
|
||||
@@ -168,6 +168,9 @@
|
||||
<data name="Search player" xml:space="preserve">
|
||||
<value>Поиск игрока</value>
|
||||
</data>
|
||||
<data name="Tank" xml:space="preserve">
|
||||
<value>Танк</value>
|
||||
</data>
|
||||
<data name="Welcome to WOT Blitz statistics application!" xml:space="preserve">
|
||||
<value>Добро пожаловать в WOT Blitz statistics!</value>
|
||||
</data>
|
||||
|
||||
@@ -46,6 +46,11 @@ namespace WotBlitzStatisticsPro.Blazor.Services
|
||||
return (playerInfo.Data?.AccountInfo, playerInfo.Data?.AccountMedals?.Sections);
|
||||
}
|
||||
|
||||
public Task<string> GetWgLoginUrl(RealmType realmType)
|
||||
{
|
||||
throw new System.NotImplementedException("Request for LoginUrl will be implemented soon");
|
||||
}
|
||||
|
||||
private RequestLanguage GetLanguage()
|
||||
{
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
@@ -94,10 +99,5 @@ namespace WotBlitzStatisticsPro.Blazor.Services
|
||||
_notificationsService.ReportError("Backend error",string.Join(";", messages));
|
||||
}
|
||||
}
|
||||
|
||||
public Task<string> GetWgLoginUrl(RealmType realmType)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
<RadzenDialog />
|
||||
<RadzenNotification />
|
||||
<RadzenTooltip />
|
||||
|
||||
<RadzenHeader>
|
||||
<ChildContent>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
@@ -21,7 +21,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.5" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="3.2.0" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="3.6.8" />
|
||||
<PackageReference Include="StrawberryShake.CodeGeneration.CSharp.Analyzers" Version="11.2.2" />
|
||||
<PackageReference Include="StrawberryShake.Transport.Http" Version="11.2.2" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
|
||||
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 356 B |
|
After Width: | Height: | Size: 458 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 678 B |
|
After Width: | Height: | Size: 974 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 618 B |
|
After Width: | Height: | Size: 786 B |