BuildList: added Filter for equipped builds

This commit is contained in:
Sarah Faey 2022-12-11 12:29:43 +01:00
parent 5078475e2f
commit ba7cf120d0
2 changed files with 17 additions and 2 deletions

View file

@ -27,6 +27,10 @@
<label style="margin-left: 10px; margin-right: 4px;">Alacrity:</label><input type="checkbox" checked="@_filterAlac" @onchange="args => AlacStatusChanged(args)" /> <label style="margin-left: 10px; margin-right: 4px;">Alacrity:</label><input type="checkbox" checked="@_filterAlac" @onchange="args => AlacStatusChanged(args)" />
<label style="margin-left: 10px; margin-right: 4px;">Quickness:</label><input type="checkbox" checked="@_filterQuick" @onchange="args => QuickStatusChanged(args)" /> <label style="margin-left: 10px; margin-right: 4px;">Quickness:</label><input type="checkbox" checked="@_filterQuick" @onchange="args => QuickStatusChanged(args)" />
<label style="margin-left: 10px; margin-right: 4px;">Might:</label><input type="checkbox" checked="@_filterMight" @onchange="args => MightStatusChanged(args)" /> <label style="margin-left: 10px; margin-right: 4px;">Might:</label><input type="checkbox" checked="@_filterMight" @onchange="args => MightStatusChanged(args)" />
@if (_account != null)
{
<label style="margin-left: 10px; margin-right: 4px;">Equipped:</label><input type="checkbox" checked="@_filterEquipped" @onchange="args => EquippedStatusChanged(args)" />
}
</label> </label>
<table class="roletable"> <table class="roletable">
<tr> <tr>
@ -161,6 +165,7 @@
private bool _filterAlac = false; private bool _filterAlac = false;
private bool _filterQuick = false; private bool _filterQuick = false;
private bool _filterMight = false; private bool _filterMight = false;
private bool _filterEquipped = false;
private DamageType? _filterDamageType; private DamageType? _filterDamageType;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
@ -233,6 +238,12 @@
ApplyFilter(); ApplyFilter();
} }
private void EquippedStatusChanged(ChangeEventArgs args)
{
_filterEquipped = bool.Parse(args.Value.ToString());
ApplyFilter();
}
private void ApplyFilter() private void ApplyFilter()
{ {
_buildsToShow = _builds; _buildsToShow = _builds;
@ -256,5 +267,9 @@
{ {
_buildsToShow = _buildsToShow.Where(b => b.DamageType == _filterDamageType).ToList(); _buildsToShow = _buildsToShow.Where(b => b.DamageType == _filterDamageType).ToList();
} }
if(_filterEquipped && _account != null)
{
_buildsToShow = _buildsToShow.Where(b => _account.EquippedBuilds.Where(e => e.GuildWars2BuildId == b.GuildWars2BuildId).Any()).ToList();
}
} }
} }

View file

@ -13,6 +13,6 @@
<p style="text-align: center"><img src="GuildIcon512.svg" alt="guild icon"></p> <p style="text-align: center"><img src="GuildIcon512.svg" alt="guild icon"></p>
</tr> </tr>
<tr> <tr>
<a style="text-align: center" class="nav-link" href="https://discord.gg/VFG3XEBCPj">[LIEB] Discord </a> <a style="text-align: center; width: inherit;" class="nav-link" href="https://discord.gg/VFG3XEBCPj">[LIEB] Discord </a>
</tr> </tr>
</table> </table>