Fixing broken image links in Card Gallery and adding Immortal filter
This commit is contained in:
@@ -13,12 +13,18 @@
|
||||
<button class="tab @(categoryFilter == "" ? "active" : "")" @onclick='@(() => SetCategory(""))'>
|
||||
<i class="bi bi-grid-3x3-gap-fill"></i> All
|
||||
</button>
|
||||
<button class="tab agent @(categoryFilter == "Immortalized" ? "active" : "")" @onclick='@(() => SetCategory("IsImmortalized"))'>
|
||||
<i class="bi bi-person-fill"></i> Agents
|
||||
</button>
|
||||
|
||||
<button class="tab agent @(categoryFilter == "Agent" ? "active" : "")" @onclick='@(() => SetCategory("Agent"))'>
|
||||
<i class="bi bi-person-fill"></i> Agents
|
||||
</button>
|
||||
<button class="tab agent @(categoryFilter == "Immortalized" ? "active" : "")" @onclick='@(() => SetCategory("Immortalized"))'>
|
||||
<i class="bi bi-person-fill"></i> Immortalized
|
||||
</button>
|
||||
<!-- //Todo make agent being linked to immortal for side by side sorting
|
||||
<button class="tab agent @(agentLink ? "active" : "")" @onclick='@(() => ToggleAgentLink())'>
|
||||
<i class="bi bi-person-fill"></i> Link
|
||||
</button>
|
||||
-->
|
||||
<button class="tab spell @(categoryFilter == "Spell" ? "active" : "")" @onclick='@(() => SetCategory("Spell"))'>
|
||||
<i class="bi bi-wand"></i> Spells
|
||||
</button>
|
||||
@@ -50,8 +56,8 @@
|
||||
</select>
|
||||
<div class="sort-group d-flex gap-1">
|
||||
<select @bind="sortBy" class="form-select filter-select sort-select">
|
||||
<option value="Name">Sort by Name</option>
|
||||
<option value="Cost">Sort by Cost</option>
|
||||
<option value="Name">Sort by Name</option>
|
||||
<option value="Attack">Sort by Attack</option>
|
||||
<option value="Health">Sort by Health</option>
|
||||
<option value="Efficiency">Sort by Efficiency</option>
|
||||
@@ -108,7 +114,7 @@
|
||||
{
|
||||
<div class="card-grid @(showDetailedView ? "detailed-view" : "")">
|
||||
@{ var idx = 0; }
|
||||
@foreach (var card in filteredCards.Where(a=>a.Category is "Agent" or "Spell"))
|
||||
@foreach (var card in filteredCards.Where(a=>a.Category is "Agent" or "Spell" or "Immortalized"))
|
||||
{
|
||||
<div class="card-cell @(selectedCard == card ? "selected" : "")"
|
||||
style="--i: @idx"
|
||||
@@ -117,20 +123,16 @@
|
||||
<div class="card-shimmer"></div>
|
||||
<img src="@card.ImagePath" alt="@card.Name" loading="lazy"
|
||||
onerror="this.src='data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22280%22><rect fill=%22%23222244%22 width=%22200%22 height=%22280%22/><text fill=%22%23686888%22 font-size=%2214%22 x=%22100%22 y=%22140%22 text-anchor=%22middle%22 dominant-baseline=%22middle%22>No Image</text></svg>'"/>
|
||||
@if (card.Cost.HasValue)
|
||||
{
|
||||
<div class="card-cost-badge">@card.Cost</div>
|
||||
}
|
||||
@if (card.IsImmortalized)
|
||||
{
|
||||
<div class="card-immortalize-badge" title="Immortalizes"><i class="bi bi-star-fill"></i>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-label">
|
||||
<div class="card-name">@card.Name</div>
|
||||
@if (showDetailedView)
|
||||
{
|
||||
@if (showDetailedView)
|
||||
{
|
||||
<div class="card-label">
|
||||
<div class="card-name">@card.Name</div>
|
||||
<div class="card-stats">
|
||||
@if (card.Attack.HasValue)
|
||||
{
|
||||
@@ -142,9 +144,10 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-description-preview">@card.Description</div>
|
||||
}
|
||||
<div class="card-category-badge @card.Category?.ToLowerInvariant()">@card.Category</div>
|
||||
</div>
|
||||
<div class="card-category-badge @card.Category?.ToLowerInvariant()">@card.Category</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
idx++;
|
||||
}
|
||||
@@ -266,6 +269,9 @@
|
||||
private IEnumerable<CardData> filteredCards => ApplyFilters();
|
||||
private string search = "";
|
||||
private string categoryFilter = "";
|
||||
private string immortalFilter = "";
|
||||
private bool agentOnly = true;
|
||||
private bool agentLink = true;
|
||||
private string factionFilter = "";
|
||||
private string costFilter = "";
|
||||
private string sortBy = "Name";
|
||||
@@ -276,7 +282,7 @@
|
||||
private string currentNote = "";
|
||||
private bool isSaving;
|
||||
|
||||
private bool HasActiveFilters => categoryFilter != "" || factionFilter != "" || costFilter != "";
|
||||
private bool HasActiveFilters => categoryFilter != "" || factionFilter != "" || costFilter != "" || immortalFilter != "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
@@ -307,6 +313,16 @@
|
||||
_ => sortDescending ? filtered.OrderByDescending(c => c.Name) : filtered.OrderBy(c => c.Name)
|
||||
};
|
||||
}
|
||||
|
||||
private void SetImmortal(string imm)
|
||||
{
|
||||
immortalFilter = immortalFilter == imm ? "" : imm;
|
||||
}
|
||||
|
||||
private void ClearImmortalFilter()
|
||||
{
|
||||
immortalFilter = "";
|
||||
}
|
||||
|
||||
private void SetCategory(string cat)
|
||||
{
|
||||
@@ -323,6 +339,11 @@
|
||||
factionFilter = "";
|
||||
}
|
||||
|
||||
private void ToggleAgentLink()
|
||||
{
|
||||
agentLink = !agentLink;
|
||||
}
|
||||
|
||||
private void ClearCostFilter()
|
||||
{
|
||||
costFilter = "";
|
||||
|
||||
Reference in New Issue
Block a user