mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-29 13:20:05 +01:00
Compare commits
2
Commits
80050e1ddd
...
7d524fcdcd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d524fcdcd | ||
|
|
bb16617f3f |
No files matched your search
+6
-12
@@ -11,24 +11,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
|
||||
{
|
||||
return serializedValue switch
|
||||
{
|
||||
"NONE" => MarkOfMastery.None,
|
||||
"RANK3" => MarkOfMastery.Rank3,
|
||||
"RANK2" => MarkOfMastery.Rank2,
|
||||
"RANK1" => MarkOfMastery.Rank1,
|
||||
"MASTER" => MarkOfMastery.Master,
|
||||
_ => throw new global::StrawberryShake.GraphQLClientException()};
|
||||
"NONE" => MarkOfMastery.None, "RANK3" => MarkOfMastery.Rank3, "RANK2" => MarkOfMastery.Rank2, "RANK1" => MarkOfMastery.Rank1, "MASTER" => MarkOfMastery.Master, _ => throw new global::StrawberryShake.GraphQLClientException()}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public global::System.Object Format(global::System.Object? runtimeValue)
|
||||
{
|
||||
return runtimeValue switch
|
||||
{
|
||||
MarkOfMastery.None => "NONE",
|
||||
MarkOfMastery.Rank3 => "RANK3",
|
||||
MarkOfMastery.Rank2 => "RANK2",
|
||||
MarkOfMastery.Rank1 => "RANK1",
|
||||
MarkOfMastery.Master => "MASTER",
|
||||
_ => throw new global::StrawberryShake.GraphQLClientException()};
|
||||
MarkOfMastery.None => "NONE", MarkOfMastery.Rank3 => "RANK3", MarkOfMastery.Rank2 => "RANK2", MarkOfMastery.Rank1 => "RANK1", MarkOfMastery.Master => "MASTER", _ => throw new global::StrawberryShake.GraphQLClientException()}
|
||||
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-10
@@ -11,22 +11,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
|
||||
{
|
||||
return serializedValue switch
|
||||
{
|
||||
"RU" => RealmType.Ru,
|
||||
"EU" => RealmType.Eu,
|
||||
"NA" => RealmType.Na,
|
||||
"ASIA" => RealmType.Asia,
|
||||
_ => throw new global::StrawberryShake.GraphQLClientException()};
|
||||
"RU" => RealmType.Ru, "EU" => RealmType.Eu, "NA" => RealmType.Na, "ASIA" => RealmType.Asia, _ => throw new global::StrawberryShake.GraphQLClientException()}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public global::System.Object Format(global::System.Object? runtimeValue)
|
||||
{
|
||||
return runtimeValue switch
|
||||
{
|
||||
RealmType.Ru => "RU",
|
||||
RealmType.Eu => "EU",
|
||||
RealmType.Na => "NA",
|
||||
RealmType.Asia => "ASIA",
|
||||
_ => throw new global::StrawberryShake.GraphQLClientException()};
|
||||
RealmType.Ru => "RU", RealmType.Eu => "EU", RealmType.Na => "NA", RealmType.Asia => "ASIA", _ => throw new global::StrawberryShake.GraphQLClientException()}
|
||||
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-8
@@ -11,20 +11,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
|
||||
{
|
||||
return serializedValue switch
|
||||
{
|
||||
"RU" => RequestLanguage.Ru,
|
||||
"EN" => RequestLanguage.En,
|
||||
"DE" => RequestLanguage.De,
|
||||
_ => throw new global::StrawberryShake.GraphQLClientException()};
|
||||
"RU" => RequestLanguage.Ru, "EN" => RequestLanguage.En, "DE" => RequestLanguage.De, _ => throw new global::StrawberryShake.GraphQLClientException()}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public global::System.Object Format(global::System.Object? runtimeValue)
|
||||
{
|
||||
return runtimeValue switch
|
||||
{
|
||||
RequestLanguage.Ru => "RU",
|
||||
RequestLanguage.En => "EN",
|
||||
RequestLanguage.De => "DE",
|
||||
_ => throw new global::StrawberryShake.GraphQLClientException()};
|
||||
RequestLanguage.Ru => "RU", RequestLanguage.En => "EN", RequestLanguage.De => "DE", _ => throw new global::StrawberryShake.GraphQLClientException()}
|
||||
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -13,16 +13,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
global::System.String __typename = obj.GetProperty("__typename").GetString()!;
|
||||
return __typename switch
|
||||
{
|
||||
"Achievement" => ParseAchievementEntityId(obj, __typename),
|
||||
_ => throw new global::System.NotSupportedException()};
|
||||
"Achievement" => ParseAchievementEntityId(obj, __typename), _ => throw new global::System.NotSupportedException()}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public global::System.String Format(global::StrawberryShake.EntityId entityId)
|
||||
{
|
||||
return entityId.Name switch
|
||||
{
|
||||
"Achievement" => FormatAchievementEntityId(entityId),
|
||||
_ => throw new global::System.NotSupportedException()};
|
||||
"Achievement" => FormatAchievementEntityId(entityId), _ => throw new global::System.NotSupportedException()}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
private global::StrawberryShake.EntityId ParseAchievementEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WotBlitzStatisticsProClientStoreAccessor : global::StrawberryShake.StoreAccessor
|
||||
{
|
||||
public WotBlitzStatisticsProClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory> requestFactories, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory> resultDataFactories) : base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
|
||||
public WotBlitzStatisticsProClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory> requestFactories, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory> resultDataFactories): base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,108 +1,116 @@
|
||||
@using WotBlitzStatisticsPro.Blazor.Helpers
|
||||
@using System.Linq
|
||||
@inherits PlayerInfoTanksTreeBase;
|
||||
<div style="overflow-y: auto; overflow-x: auto;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="@((CardWidth + 40) * 10)"
|
||||
height="@FrameHeigth">
|
||||
<!-- Background -->
|
||||
@for (int i = 0; i < 10; i++)
|
||||
<div class="d-flex flex-column">
|
||||
<div class="d-flex flex-row mb-3">
|
||||
@foreach (var nationForFilter in NationsFilter)
|
||||
{
|
||||
<rect x="@(i * (CardWidth + 40))"
|
||||
y="0"
|
||||
width="@(CardWidth + 40)"
|
||||
height="@FrameHeigth"
|
||||
fill="@(i % 2 == 0 ? "#464A5D" : "#3A3D4B")">
|
||||
</rect>
|
||||
<img src="@nationForFilter.ItemName" class="@NationFilterStyle(nationForFilter.ItemId)" @onclick="@(async (e) => { await ApplyNationFilter(e, nationForFilter.ItemId); })" />
|
||||
}
|
||||
|
||||
<!-- Connections -->
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths -->
|
||||
@foreach (var pathConnection in Connections)
|
||||
{
|
||||
<path fill="none" stroke="white" stroke-width="1" d="@pathConnection" />
|
||||
}
|
||||
|
||||
@if (TreeItems != null)
|
||||
{
|
||||
@for (int tier = 1; tier < 11; tier++)
|
||||
</div>
|
||||
<div style="overflow-y: auto; overflow-x: auto;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="@((CardWidth + 40) * 10)"
|
||||
height="@FrameHeigth">
|
||||
<!-- Background -->
|
||||
@for (int i = 0; i < 10; i++)
|
||||
{
|
||||
@foreach (var tank in TreeItems.Where(t => t.Tier == tier).OrderBy(t => t.Row).ToList())
|
||||
<rect x="@(i * (CardWidth + 40))"
|
||||
y="0"
|
||||
width="@(CardWidth + 40)"
|
||||
height="@FrameHeigth"
|
||||
fill="@(i % 2 == 0 ? "#464A5D" : "#3A3D4B")">
|
||||
</rect>
|
||||
}
|
||||
|
||||
<!-- Connections -->
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths -->
|
||||
@foreach (var pathConnection in Connections)
|
||||
{
|
||||
<path fill="none" stroke="white" stroke-width="1" d="@pathConnection" />
|
||||
}
|
||||
|
||||
@if (TreeItems != null)
|
||||
{
|
||||
@for (int tier = 1; tier < 11; tier++)
|
||||
{
|
||||
<!-- Tank card svg-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
x="@((tier - 1) * (CardWidth + 40) + 20)"
|
||||
y="@(tank.Row * (CardHeigth + 20) + 20)"
|
||||
width="@CardWidth"
|
||||
height="@CardHeigth">
|
||||
<g>
|
||||
<!--Rect fill = #275950 - researched, #2E353B - unresearched, #66502b - prem-->
|
||||
<rect x="0"
|
||||
y="0"
|
||||
@foreach (var tank in TreeItems.Where(t => t.Tier == tier).OrderBy(t => t.Row).ToList())
|
||||
{
|
||||
<!-- Tank card svg-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
x="@((tier - 1) * (CardWidth + 40) + 20)"
|
||||
y="@(tank.Row * (CardHeigth + 20) + 20)"
|
||||
width="@CardWidth"
|
||||
height="@CardHeigth"
|
||||
rx="10"
|
||||
ry="10"
|
||||
fill="@(tank.IsResearched ? (tank.IsPremium ? "#66502b" : "#275950") : "#2E353B")">
|
||||
</rect>
|
||||
height="@CardHeigth">
|
||||
<g>
|
||||
<!--Rect fill = #275950 - researched, #2E353B - unresearched, #66502b - prem-->
|
||||
<rect x="0"
|
||||
y="0"
|
||||
width="@CardWidth"
|
||||
height="@CardHeigth"
|
||||
rx="10"
|
||||
ry="10"
|
||||
fill="@(tank.IsResearched ? (tank.IsPremium ? "#66502b" : "#275950") : "#2E353B")">
|
||||
</rect>
|
||||
|
||||
<!--Tank type-->
|
||||
<image x="7" y="7" width="25" height="25" href="@tank.TankTypeId.TankTypeAsset(tank.IsPremium)" />
|
||||
<!--Tank tier-->
|
||||
<text x="33" y="4" fill="@(tank.IsPremium ? Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="19">
|
||||
@tank.Tier.RomanNumber()
|
||||
</text>
|
||||
<!--TankImage-->
|
||||
<image x="@((CardWidth - 95) / 2)" y="@((CardHeigth - 70) / 2)" width="95" height="70" href="@tank.PreviewImage" />
|
||||
<!--TankName-->
|
||||
<text x="33" y="@(CardHeigth - 25)" fill="@(tank.IsPremium ? Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="14">
|
||||
@tank.Name
|
||||
</text>
|
||||
<!--Tank type-->
|
||||
<image x="7" y="7" width="25" height="25" href="@tank.TankTypeId.TankTypeAsset(tank.IsPremium)" />
|
||||
<!--Tank tier-->
|
||||
<text x="33" y="4" fill="@(tank.IsPremium ? Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="19">
|
||||
@tank.Tier.RomanNumber()
|
||||
</text>
|
||||
<!--TankImage-->
|
||||
<image x="@((CardWidth - 95) / 2)" y="@((CardHeigth - 70) / 2)" width="95" height="70" href="@tank.PreviewImage" />
|
||||
<!--TankName-->
|
||||
<text x="33" y="@(CardHeigth - 25)" fill="@(tank.IsPremium ? Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="14">
|
||||
@tank.Name
|
||||
</text>
|
||||
|
||||
<!--Researched: Mastery, Winrate, AvgDmg, Battles, LastBattle-->
|
||||
@if (tank.IsResearched && tank.MarkOfMastery.HasValue && tank.WinRate.HasValue && tank.AvgDamage.HasValue && tank.Battles.HasValue && tank.LastBattleTime.HasValue)
|
||||
{
|
||||
<g>
|
||||
<!--Mastery-->
|
||||
<image x="7" y="@(CardHeigth - 26)" width="20" height="20" href="@tank.MarkOfMastery.Value.IconAsset()" />
|
||||
<!--Winrate-->
|
||||
<image x="7" y="40" width="20" height="20" href="icons/details.wins.scale-200.png" />
|
||||
<text x="32" y="40" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-weight="bold" font-size="12">
|
||||
@(tank.WinRate.Value.ToString("N0"))%
|
||||
</text>
|
||||
<line x1="8" y1="60" x2="58" y2="60" style="@($"stroke:{tank.WinRate.Value.ScaleColor()};stroke-width:3")" />
|
||||
<!--AvgDmg-->
|
||||
<image x="@(CardWidth - 62)" y="40" width="20" height="20" href="icons/damage.scale-200.png" />
|
||||
<text x="@(CardWidth - 37)" y="40" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@tank.AvgDamage.Value.ToString("N0")
|
||||
</text>
|
||||
<!--Battles-->
|
||||
<image x="@(CardWidth - 62)" y="9" width="20" height="20" href="icons/details.battles.scale-200.png" />
|
||||
<text x="@(CardWidth - 37)" y="9" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@tank.Battles.Value.ToString("N0")
|
||||
</text>
|
||||
<!--Last battle-->
|
||||
<image x="8" y="@(CardHeigth - 50)" width="16" height="16" href="icons/calendar.scale-200.png" />
|
||||
<text x="32" y="@(CardHeigth - 50)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@tank.LastBattleTime.Value.ToString("d")
|
||||
</text>
|
||||
</g>
|
||||
}
|
||||
<!--Unresearched: XP, Credits-->
|
||||
@if (!tank.IsResearched)
|
||||
{
|
||||
<g>
|
||||
<!--Credits-->
|
||||
<image x="8" y="@(CardHeigth - 50)" width="20" height="20" href="icons/encyclopedia.vehicle.credits.scale-200.png" />
|
||||
<text x="32" y="@(CardHeigth - 50)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@((tank.PriceCredit / 1000).ToString("N0")) K
|
||||
</text>
|
||||
</g>
|
||||
}
|
||||
</g>
|
||||
</svg>
|
||||
<!--Researched: Mastery, Winrate, AvgDmg, Battles, LastBattle-->
|
||||
@if (tank.IsResearched && tank.MarkOfMastery.HasValue && tank.WinRate.HasValue && tank.AvgDamage.HasValue && tank.Battles.HasValue && tank.LastBattleTime.HasValue)
|
||||
{
|
||||
<g>
|
||||
<!--Mastery-->
|
||||
<image x="7" y="@(CardHeigth - 26)" width="20" height="20" href="@tank.MarkOfMastery.Value.IconAsset()" />
|
||||
<!--Winrate-->
|
||||
<image x="7" y="40" width="20" height="20" href="icons/details.wins.scale-200.png" />
|
||||
<text x="32" y="40" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-weight="bold" font-size="12">
|
||||
@(tank.WinRate.Value.ToString("N0"))%
|
||||
</text>
|
||||
<line x1="8" y1="60" x2="58" y2="60" style="@($"stroke:{tank.WinRate.Value.ScaleColor()};stroke-width:3")" />
|
||||
<!--AvgDmg-->
|
||||
<image x="@(CardWidth - 62)" y="40" width="20" height="20" href="icons/damage.scale-200.png" />
|
||||
<text x="@(CardWidth - 37)" y="40" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@tank.AvgDamage.Value.ToString("N0")
|
||||
</text>
|
||||
<!--Battles-->
|
||||
<image x="@(CardWidth - 62)" y="9" width="20" height="20" href="icons/details.battles.scale-200.png" />
|
||||
<text x="@(CardWidth - 37)" y="9" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@tank.Battles.Value.ToString("N0")
|
||||
</text>
|
||||
<!--Last battle-->
|
||||
<image x="8" y="@(CardHeigth - 50)" width="16" height="16" href="icons/calendar.scale-200.png" />
|
||||
<text x="32" y="@(CardHeigth - 50)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@tank.LastBattleTime.Value.ToString("d")
|
||||
</text>
|
||||
</g>
|
||||
}
|
||||
<!--Unresearched: XP, Credits-->
|
||||
@if (!tank.IsResearched)
|
||||
{
|
||||
<g>
|
||||
<!--Credits-->
|
||||
<image x="8" y="@(CardHeigth - 50)" width="20" height="20" href="icons/encyclopedia.vehicle.credits.scale-200.png" />
|
||||
<text x="32" y="@(CardHeigth - 50)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@((tank.PriceCredit / 1000).ToString("N0")) K
|
||||
</text>
|
||||
</g>
|
||||
}
|
||||
</g>
|
||||
</svg>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</svg>
|
||||
</div>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
.nation-filter-flag {
|
||||
width: 70px;
|
||||
height: 46px;
|
||||
border-radius: 4px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.filter-selected {
|
||||
border-width: 1px;
|
||||
border-color: #f5aa3b;
|
||||
border-style: solid;
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WotBlitzStatisticsPro.Blazor.GraphQl;
|
||||
using WotBlitzStatisticsPro.Blazor.Helpers;
|
||||
using WotBlitzStatisticsPro.Blazor.Model;
|
||||
using WotBlitzStatisticsPro.Blazor.Services;
|
||||
|
||||
@@ -43,10 +45,12 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
|
||||
public List<TankTreeItem> TreeItems { get; set; } = new();
|
||||
|
||||
public string SelectedNation { get; set; } = "germany";
|
||||
public string SelectedNation { get; set; }
|
||||
|
||||
public List<string> Connections { get; set; } = new List<string>();
|
||||
|
||||
public List<FilterItem<string>> NationsFilter { get; set; } = new();
|
||||
|
||||
public string FrameStyle
|
||||
{
|
||||
get
|
||||
@@ -57,19 +61,10 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
FillNationsFilter();
|
||||
var screenHeight = await MediaQueriesService.WindowHeight();
|
||||
|
||||
// TODO: Move it to the Nation selector handler
|
||||
try
|
||||
{
|
||||
VehiclesLibrary = await GraphQlBackendService.GetVehiclesByNation(SelectedNation);
|
||||
BuildTree();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Notifications.ReportError("Can not get data from backend", e.Message);
|
||||
}
|
||||
|
||||
await LoadTree();
|
||||
}
|
||||
|
||||
public int GetTextWidth(string text, string fontFace, int fontSize)
|
||||
@@ -242,5 +237,51 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
|
||||
return maxRowsCount;
|
||||
}
|
||||
|
||||
private void FillNationsFilter()
|
||||
{
|
||||
// ToDo: Should get values from Dictionary here instead of hard code
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryUsa, Constants.CountryUsa.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryFrance, Constants.CountryFrance.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryUssr, Constants.CountryUssr.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryChina, Constants.CountryChina.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryUk, Constants.CountryUk.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryJapan, Constants.CountryJapan.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryGermany, Constants.CountryGermany.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryOther, Constants.CountryOther.NationAsset()));
|
||||
NationsFilter.Add(new FilterItem<string>(Constants.CountryEuropean, Constants.CountryEuropean.NationAsset()));
|
||||
|
||||
SelectedNation = NationsFilter[0].ItemId;
|
||||
}
|
||||
|
||||
public string NationFilterStyle(string nation)
|
||||
{
|
||||
string basic = "nation-filter-flag";
|
||||
if (SelectedNation == nation)
|
||||
{
|
||||
return $"{basic} filter-selected";
|
||||
}
|
||||
return basic;
|
||||
}
|
||||
|
||||
public async Task ApplyNationFilter(MouseEventArgs e, string nationToApply)
|
||||
{
|
||||
SelectedNation = nationToApply;
|
||||
await LoadTree();
|
||||
}
|
||||
|
||||
private async Task LoadTree()
|
||||
{
|
||||
try
|
||||
{
|
||||
VehiclesLibrary = await GraphQlBackendService.GetVehiclesByNation(SelectedNation);
|
||||
BuildTree();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Notifications.ReportError("Can not get data from backend", e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,11 +55,11 @@ namespace WotBlitzStatisticsPro.Blazor
|
||||
//var useMock = Environment.GetEnvironmentVariable("USE_GRAPH_QL_MOCK");
|
||||
//if (useMock != null && useMock == "true")
|
||||
//{
|
||||
builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendMockService>();
|
||||
//builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendMockService>();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendService>();
|
||||
builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendService>();
|
||||
//}
|
||||
|
||||
var host = builder.Build();
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace WotBlitzStatisticsPro.Logic
|
||||
for (int i = 0; i < accounts.Count; i++)
|
||||
{
|
||||
var accountResponse = accounts.ToArray()[i];
|
||||
var shortAccountInfo = shortAccountInfos?.FirstOrDefault(a => a.AccountId == accountResponse.AccountId);
|
||||
var shortAccountInfo = shortAccountInfos?.FirstOrDefault(a => a != null && a.AccountId == accountResponse.AccountId);
|
||||
if (shortAccountInfo != null)
|
||||
{
|
||||
_mapper.Map(shortAccountInfo, accountResponse);
|
||||
|
||||
Reference in new issue
Block a user