Vibe Card Library Update

This commit is contained in:
2026-06-17 11:20:16 -04:00
parent 2a8be6b74a
commit 4d45094492
591 changed files with 5271 additions and 18 deletions
+5
View File
@@ -24,6 +24,11 @@
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="cards">
<span class="bi bi-collection-fill-nav-menu" aria-hidden="true"></span> Cards
</NavLink>
</div>
</nav>
</div>
+37
View File
@@ -0,0 +1,37 @@
using System.Text.Json.Serialization;
namespace Web.Models;
public class CardCatalog
{
[JsonPropertyName("cards")]
public List<CardData> Cards { get; set; } = [];
}
public class CardData
{
[JsonPropertyName("name")] public string Name { get; set; } = "";
[JsonPropertyName("category")] public string Category { get; set; } = "";
[JsonPropertyName("cost")] public int? Cost { get; set; }
[JsonPropertyName("attack")] public int? Attack { get; set; }
[JsonPropertyName("health")] public int? Health { get; set; }
[JsonPropertyName("description")] public string? Description { get; set; }
[JsonPropertyName("faction")] public string? Faction { get; set; }
[JsonPropertyName("set")] public string? Set { get; set; }
[JsonPropertyName("speed")] public string? Speed { get; set; }
[JsonPropertyName("archetypes")] public List<string>? Archetypes { get; set; }
[JsonPropertyName("immortalizeTo")] public List<string>? ImmortalizeTo { get; set; }
[JsonPropertyName("immortalizeFrom")] public string? ImmortalizeFrom { get; set; }
[JsonPropertyName("immortalizeWhen")] public string? ImmortalizeWhen { get; set; }
[JsonPropertyName("imageFile")] public string? ImageFile { get; set; }
public bool IsAgent => Category == "Agent";
public bool IsSpell => Category == "Spell";
public bool IsToken => Category == "Token";
public string? CostDisplay => Cost?.ToString();
public string? AttackDisplay => Attack.HasValue ? Attack.Value.ToString() : null;
public string? HealthDisplay => Health.HasValue ? Health.Value.ToString() : null;
public bool HasImmortalize => ImmortalizeTo is { Count: > 0 };
public bool IsImmortalized => ImmortalizeFrom != null;
public string ImagePath => $"cards/{ImageFile ?? "placeholder.png"}";
}
+190
View File
@@ -0,0 +1,190 @@
@page "/cards"
@using System.Text.Json
@using Web.Models
@inject HttpClient Http
<PageTitle>Card Gallery</PageTitle>
<div class="gallery-container">
<h1 class="mb-3">Card Gallery</h1>
<div class="row g-2 mb-3 filters">
<div class="col-md-4">
<input @bind="search" @bind:event="oninput" class="form-control" placeholder="Search cards..." />
</div>
<div class="col-md-2">
<select @bind="categoryFilter" class="form-select">
<option value="">All Categories</option>
<option value="Agent">Agents</option>
<option value="Spell">Spells</option>
<option value="Token">Tokens</option>
</select>
</div>
<div class="col-md-2">
<select @bind="factionFilter" class="form-select">
<option value="">All Factions</option>
@foreach (var f in factions)
{
<option value="@f">@f</option>
}
</select>
</div>
<div class="col-md-2">
<select @bind="costFilter" class="form-select">
<option value="">All Costs</option>
@for (int i = 0; i <= 12; i++)
{
<option value="@i">@i</option>
}
</select>
</div>
<div class="col-md-2">
<button class="btn btn-outline-secondary w-100" @onclick="ClearFilters">Clear</button>
</div>
</div>
<div class="text-muted mb-2">@filteredCards.Count() cards shown</div>
@if (filteredCards.Any())
{
<div class="card-grid">
@foreach (var card in filteredCards)
{
<div class="card-cell @(selectedCard == card ? "selected" : "")"
@onclick="() => SelectCard(card)">
<div class="card-image-wrapper">
<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%23333%22 width=%22200%22 height=%22280%22/><text fill=%22%23999%22 font-size=%2214%22 x=%22100%22 y=%22140%22 text-anchor=%22middle%22 dominant-baseline=%22middle%22>No Image</text></svg>'"/>
</div>
<div class="card-label">
<div class="card-name">@card.Name</div>
<div class="card-cost">@(card.CostDisplay != null ? $"⚡{card.CostDisplay}" : "")</div>
</div>
</div>
}
</div>
}
else
{
<div class="alert alert-info">No cards match your filters.</div>
}
</div>
@if (selectedCard != null)
{
<div class="modal-backdrop" @onclick="CloseDetail"></div>
<div class="card-detail">
<button class="btn-close detail-close" @onclick="CloseDetail"></button>
<div class="detail-layout">
<div class="detail-image">
<img src="@selectedCard.ImagePath" alt="@selectedCard.Name" />
</div>
<div class="detail-info">
<h2>@selectedCard.Name</h2>
<div class="detail-meta">
<span class="badge bg-primary">@selectedCard.Category</span>
@if (selectedCard.Cost.HasValue)
{
<span class="badge bg-warning text-dark">Cost: @selectedCard.Cost</span>
}
@if (selectedCard.Attack.HasValue)
{
<span class="badge bg-danger">ATK: @selectedCard.Attack</span>
}
@if (selectedCard.Health.HasValue)
{
<span class="badge bg-success">HP: @selectedCard.Health</span>
}
@if (selectedCard.Speed != null)
{
<span class="badge bg-info text-dark">@selectedCard.Speed</span>
}
</div>
@if (selectedCard.Faction != null)
{
<p><strong>Faction:</strong> @selectedCard.Faction</p>
}
@if (selectedCard.Description != null)
{
<p><strong>Description:</strong> @selectedCard.Description</p>
}
@if (selectedCard.Set != null)
{
<p><strong>Set:</strong> @selectedCard.Set</p>
}
@if (selectedCard.Archetypes is { Count: > 0 })
{
<p><strong>Archetypes:</strong> @string.Join(", ", selectedCard.Archetypes)</p>
}
@if (selectedCard.ImmortalizeWhen != null)
{
<p><strong>Immortalize When:</strong> @selectedCard.ImmortalizeWhen</p>
}
@if (selectedCard.HasImmortalize)
{
<p><strong>Immortalizes To:</strong> @string.Join(", ", selectedCard.ImmortalizeTo!)</p>
}
@if (selectedCard.ImmortalizeFrom != null)
{
<p><strong>Immortalizes From:</strong> @selectedCard.ImmortalizeFrom</p>
}
</div>
</div>
</div>
}
@code {
private List<CardData> allCards = [];
private IEnumerable<CardData> filteredCards => ApplyFilters();
private string search = "";
private string categoryFilter = "";
private string factionFilter = "";
private string costFilter = "";
private CardData? selectedCard;
private List<string> factions = [];
protected override async Task OnInitializedAsync()
{
try
{
var catalog = await Http.GetFromJsonAsync<CardCatalog>("sample-data/cards.json");
if (catalog?.Cards != null)
{
allCards = catalog.Cards;
factions = allCards
.Select(c => c.Faction)
.Where(f => f != null)
.Distinct()
.OrderBy(f => f)
.ToList()!;
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"Failed to load cards: {ex.Message}");
}
}
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)) &&
(categoryFilter == "" || c.Category == categoryFilter) &&
(factionFilter == "" || c.Faction == factionFilter) &&
(costFilter == "" || c.Cost?.ToString() == costFilter)
);
}
private void SelectCard(CardData card) => selectedCard = card;
private void CloseDetail() => selectedCard = null;
private void ClearFilters()
{
search = "";
categoryFilter = "";
factionFilter = "";
costFilter = "";
}
}
+160
View File
@@ -0,0 +1,160 @@
.gallery-container {
padding: 1rem;
}
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 1rem;
}
.card-cell {
cursor: pointer;
border-radius: 8px;
overflow: hidden;
background: #1a1a2e;
transition: transform 0.15s, box-shadow 0.15s;
border: 2px solid transparent;
}
.card-cell:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.card-cell.selected {
border-color: #ffd700;
box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}
.card-image-wrapper {
width: 100%;
aspect-ratio: 5 / 7;
overflow: hidden;
background: #16213e;
}
.card-image-wrapper img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.card-label {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.4rem 0.6rem;
background: #0f3460;
color: #eee;
font-size: 0.8rem;
}
.card-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
min-width: 0;
}
.card-cost {
flex-shrink: 0;
margin-left: 0.4rem;
font-weight: bold;
color: #ffd700;
}
.filters {
align-items: stretch;
}
.card-detail {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1050;
background: #1a1a2e;
border-radius: 12px;
padding: 0;
max-width: 700px;
width: 90vw;
max-height: 85vh;
overflow-y: auto;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
color: #eee;
}
.detail-close {
position: absolute;
top: 0.5rem;
right: 0.5rem;
z-index: 1;
filter: invert(1);
}
.detail-layout {
display: flex;
gap: 1.5rem;
padding: 1.5rem;
}
.detail-image {
flex: 0 0 240px;
}
.detail-image img {
width: 100%;
border-radius: 8px;
}
.detail-info {
flex: 1;
min-width: 0;
}
.detail-info h2 {
margin-top: 0;
margin-bottom: 0.75rem;
font-size: 1.4rem;
}
.detail-meta {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-bottom: 1rem;
}
.detail-info p {
margin-bottom: 0.5rem;
font-size: 0.9rem;
line-height: 1.4;
}
.modal-backdrop {
position: fixed;
inset: 0;
z-index: 1040;
background: rgba(0, 0, 0, 0.6);
}
@media (max-width: 600px) {
.detail-layout {
flex-direction: column;
padding: 1rem;
}
.detail-image {
flex: 0 0 auto;
max-width: 200px;
margin: 0 auto;
}
.card-grid {
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
gap: 0.75rem;
}
}
+7
View File
@@ -12,4 +12,11 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.9" PrivateAssets="all"/>
</ItemGroup>
<Target Name="RunBuild" BeforeTargets="BeforeBuild">
<PropertyGroup>
<_BuildProject>$(MSBuildThisFileDirectory)..\Build\Build.csproj</_BuildProject>
</PropertyGroup>
<Message Text="=== Running Build project (card metadata generation) ===" Importance="high" />
<Exec Command="dotnet run --project &quot;$(_BuildProject)&quot;" />
</Target>
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Some files were not shown because too many files have changed in this diff Show More