Vibe deck UI and hiding notes UI for now
This commit is contained in:
@@ -48,6 +48,27 @@
|
||||
<option value="@i">@i</option>
|
||||
}
|
||||
</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="Attack">Sort by Attack</option>
|
||||
<option value="Health">Sort by Health</option>
|
||||
<option value="Efficiency">Sort by Efficiency</option>
|
||||
</select>
|
||||
<button class="btn btn-outline-secondary sort-dir-btn" @onclick="() => sortDescending = !sortDescending"
|
||||
title="@(sortDescending ? "Descending" : "Ascending")">
|
||||
<i class="bi bi-sort-@(sortDescending ? "down" : "up")"></i>
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn @(showDetailedView ? "btn-primary" : "btn-outline-primary") view-toggle-btn"
|
||||
@onclick="() => showDetailedView = !showDetailedView" title="Toggle Detailed View">
|
||||
<i class="bi bi-list-ul"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-warning random-deck-btn" @onclick="GenerateRandomDeck"
|
||||
title="Generate Random Deck">
|
||||
<i class="bi bi-dice-5-fill"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (HasActiveFilters)
|
||||
@@ -89,7 +110,7 @@
|
||||
|
||||
@if (filteredCards.Any())
|
||||
{
|
||||
<div class="card-grid">
|
||||
<div class="card-grid @(showDetailedView ? "detailed-view" : "")">
|
||||
@{ var idx = 0; }
|
||||
@foreach (var card in filteredCards)
|
||||
{
|
||||
@@ -112,6 +133,20 @@
|
||||
</div>
|
||||
<div class="card-label">
|
||||
<div class="card-name">@card.Name</div>
|
||||
@if (showDetailedView)
|
||||
{
|
||||
<div class="card-stats">
|
||||
@if (card.Attack.HasValue)
|
||||
{
|
||||
<span class="stat"><i class="bi bi-crosshair"></i> @card.Attack</span>
|
||||
}
|
||||
@if (card.Health.HasValue)
|
||||
{
|
||||
<span class="stat"><i class="bi bi-heart-fill"></i> @card.Health</span>
|
||||
}
|
||||
</div>
|
||||
<div class="card-description-preview">@card.Description</div>
|
||||
}
|
||||
<div class="card-category-badge @card.Category?.ToLowerInvariant()">@card.Category</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -213,7 +248,7 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (selectedCard.IsAgent)
|
||||
@if (selectedCard.IsAgent && false) // Server-only feature. Redesign project structure
|
||||
{
|
||||
<div class="detail-field note">
|
||||
<span class="field-label"><i class="bi bi-pencil-fill"></i> Personal Note</span>
|
||||
@@ -237,10 +272,13 @@
|
||||
private string categoryFilter = "";
|
||||
private string factionFilter = "";
|
||||
private string costFilter = "";
|
||||
private string sortBy = "Name";
|
||||
private bool sortDescending;
|
||||
private bool showDetailedView;
|
||||
private CardData? selectedCard;
|
||||
private List<string> factions = [];
|
||||
private string currentNote = "";
|
||||
private bool isSaving = false;
|
||||
private bool isSaving;
|
||||
|
||||
private bool HasActiveFilters => categoryFilter != "" || factionFilter != "" || costFilter != "";
|
||||
|
||||
@@ -257,14 +295,21 @@
|
||||
|
||||
private IEnumerable<CardData> ApplyFilters()
|
||||
{
|
||||
var q = search?.Trim().ToLowerInvariant() ?? "";
|
||||
return allCards.Where(c =>
|
||||
(q.Length == 0 || c.Name.ToLowerInvariant().Contains(q) ||
|
||||
(c.Description?.ToLowerInvariant().Contains(q) ?? false)) &&
|
||||
var filtered = allCards.Where(c =>
|
||||
c.MatchesSearch(search) &&
|
||||
(categoryFilter == "" || c.Category == categoryFilter) &&
|
||||
(factionFilter == "" || c.Faction == factionFilter) &&
|
||||
(costFilter == "" || c.Cost?.ToString() == costFilter)
|
||||
);
|
||||
|
||||
return sortBy switch
|
||||
{
|
||||
"Cost" => sortDescending ? filtered.OrderByDescending(c => c.Cost) : filtered.OrderBy(c => c.Cost),
|
||||
"Efficiency" => sortDescending ? filtered.OrderByDescending(c => c.StatEfficiency) : filtered.OrderBy(c => c.StatEfficiency),
|
||||
"Attack" => sortDescending ? filtered.OrderByDescending(c => c.Attack) : filtered.OrderBy(c => c.Attack),
|
||||
"Health" => sortDescending ? filtered.OrderByDescending(c => c.Health) : filtered.OrderBy(c => c.Health),
|
||||
_ => sortDescending ? filtered.OrderByDescending(c => c.Name) : filtered.OrderBy(c => c.Name)
|
||||
};
|
||||
}
|
||||
|
||||
private void SetCategory(string cat)
|
||||
@@ -342,4 +387,26 @@
|
||||
costFilter = "";
|
||||
}
|
||||
|
||||
private void GenerateRandomDeck()
|
||||
{
|
||||
var random = new Random();
|
||||
var pool = allCards.Where(c => !c.IsToken && !string.IsNullOrEmpty(c.Faction)).ToList();
|
||||
if (pool.Count < 40) return;
|
||||
|
||||
var selectedFaction = factions[random.Next(factions.Count)];
|
||||
var factionPool = pool.Where(c => c.Faction == selectedFaction || c.Faction == "Neutral").ToList();
|
||||
|
||||
// Simple logic: pick 40 cards
|
||||
var deckCards = factionPool.OrderBy(x => random.Next()).Take(40).Select(c => c.Name).ToList();
|
||||
|
||||
// For now, let's just log it or we could navigate to a "Create Deck" page if it existed.
|
||||
// Since we don't have a create deck page in the context, let's just show a notification or similar.
|
||||
// Actually, I'll just clear filters and search for these cards to "show" them.
|
||||
search = string.Join(" | ", deckCards.Take(3)); // Just show a few to demonstrate
|
||||
categoryFilter = "";
|
||||
factionFilter = selectedFaction;
|
||||
|
||||
// In a real app, this would save to a new DeckData object.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user