Add starter deck system and AI art tracker
- PlayerCard.IsTradeable (default true; false for starter deck grants) - PrebuiltDeck.IsStarterDeck flag + index - Account.StarterDeckSelectedAt one-time onboarding gate - CardAsset.IsAiGenerated + CardAnimationBinding.IsAiGenerated - Handlers: CollectionGetStarterDecks, CollectionSelectStarterDeck - CollectionGetCards passes IsTradeable through to PlayerCardDto - Admin: PrebuiltDeckEditor Starter checkbox, CardEditor AI Generated checkboxes on assets and animation rows - Admin: /content/ai-assets AI Art Tracker page + NavMenu entry - 4 EF migrations applied to pg-forge-01 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -67,11 +67,17 @@ else
|
||||
class="form-control" placeholder="—" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 d-flex align-items-end">
|
||||
<div class="col-md-4 d-flex align-items-end gap-4">
|
||||
<div class="form-check">
|
||||
<input @bind="_deck.IsActive" type="checkbox" class="form-check-input" id="chkActive" />
|
||||
<label class="form-check-label fw-medium" for="chkActive">Active</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input @bind="_deck.IsStarterDeck" type="checkbox" class="form-check-input" id="chkStarter" />
|
||||
<label class="form-check-label fw-medium text-warning" for="chkStarter">
|
||||
<i class="bi bi-star-fill me-1"></i>Starter
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -282,6 +282,14 @@ else
|
||||
</div>
|
||||
<input @bind="asset.MimeType" class="form-control form-control-sm mb-2"
|
||||
placeholder="MIME type (e.g. image/webp, model/gltf-binary)" />
|
||||
<div class="form-check mb-2">
|
||||
<input @bind="asset.IsAiGenerated" type="checkbox"
|
||||
class="form-check-input" id="ai_asset_@asset.Id" />
|
||||
<label class="form-check-label small text-warning"
|
||||
for="ai_asset_@asset.Id">
|
||||
<i class="bi bi-robot me-1"></i>AI Generated
|
||||
</label>
|
||||
</div>
|
||||
<label class="btn btn-sm btn-outline-primary @(_uploading.Contains(capturedAsset.Id) ? "disabled" : "")">
|
||||
@if (_uploading.Contains(capturedAsset.Id))
|
||||
{
|
||||
@@ -314,7 +322,7 @@ else
|
||||
|
||||
<h6 class="text-muted mb-3">Animation Bindings</h6>
|
||||
<table class="table table-sm">
|
||||
<thead><tr><th>Action</th><th>CDN URL</th><th>Upload</th><th></th></tr></thead>
|
||||
<thead><tr><th>Action</th><th>CDN URL</th><th>AI</th><th>Upload</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
@foreach (var anim in _card.AnimationBindings)
|
||||
{
|
||||
@@ -328,6 +336,13 @@ else
|
||||
<input @bind="anim.AnimationCdnUrl" class="form-control form-control-sm"
|
||||
placeholder="https://cdn.sor.gg/…" />
|
||||
</td>
|
||||
<td style="width:50px" class="text-center align-middle">
|
||||
<div class="form-check d-flex justify-content-center">
|
||||
<input @bind="anim.IsAiGenerated" type="checkbox"
|
||||
class="form-check-input" title="AI Generated"
|
||||
id="ai_anim_@anim.Id" />
|
||||
</div>
|
||||
</td>
|
||||
<td style="width:110px">
|
||||
<label class="btn btn-sm btn-outline-primary @(_uploading.Contains(capturedAnim.Id) ? "disabled" : "")">
|
||||
@if (_uploading.Contains(capturedAnim.Id))
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
@page "/content/ai-assets"
|
||||
@attribute [Authorize(Roles = "Admin,SuperAdmin")]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using SOR.Database.Contexts
|
||||
@using SOR.Database.Entities.Catalog
|
||||
@inject CatalogDbContext Db
|
||||
|
||||
<PageTitle>AI Art Tracker – SOR Admin</PageTitle>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="mb-0">AI Art Tracker</h1>
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="LoadAsync">
|
||||
<i class="bi bi-arrow-clockwise me-1"></i>Refresh
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="text-muted">
|
||||
All assets and animations flagged as AI-generated across the card catalog.
|
||||
</p>
|
||||
|
||||
@if (_loading)
|
||||
{
|
||||
<p class="text-muted">Loading…</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<!-- Static Assets -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header fw-medium d-flex justify-content-between align-items-center">
|
||||
<span>
|
||||
<i class="bi bi-image me-2"></i>Static Assets
|
||||
<span class="badge bg-warning text-dark ms-2">@_assets.Count AI-generated</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
@if (_assets.Count == 0)
|
||||
{
|
||||
<p class="text-muted p-3 mb-0">No AI-generated static assets.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Card</th>
|
||||
<th>Type</th>
|
||||
<th>Asset Type</th>
|
||||
<th>MIME</th>
|
||||
<th>CDN URL</th>
|
||||
<th>Created</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var a in _assets)
|
||||
{
|
||||
<tr>
|
||||
<td class="fw-medium">@a.CardName</td>
|
||||
<td><span class="badge bg-secondary">@a.CardType</span></td>
|
||||
<td><span class="badge bg-primary">@a.AssetType</span></td>
|
||||
<td class="text-muted small">@a.MimeType</td>
|
||||
<td>
|
||||
@if (!string.IsNullOrEmpty(a.CdnUrl))
|
||||
{
|
||||
<a href="@a.CdnUrl" target="_blank"
|
||||
class="text-decoration-none small font-monospace">
|
||||
@TruncateUrl(a.CdnUrl)
|
||||
<i class="bi bi-box-arrow-up-right ms-1"></i>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">—</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-muted small">@a.CreatedAt.ToString("yyyy-MM-dd")</td>
|
||||
<td>
|
||||
<a href="/cards/@a.CardId" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Animation Bindings -->
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header fw-medium d-flex justify-content-between align-items-center">
|
||||
<span>
|
||||
<i class="bi bi-camera-video me-2"></i>Animation Bindings
|
||||
<span class="badge bg-warning text-dark ms-2">@_animations.Count AI-generated</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
@if (_animations.Count == 0)
|
||||
{
|
||||
<p class="text-muted p-3 mb-0">No AI-generated animation bindings.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Card</th>
|
||||
<th>Type</th>
|
||||
<th>Action</th>
|
||||
<th>CDN URL</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var a in _animations)
|
||||
{
|
||||
<tr>
|
||||
<td class="fw-medium">@a.CardName</td>
|
||||
<td><span class="badge bg-secondary">@a.CardType</span></td>
|
||||
<td class="font-monospace small">@a.ActionName</td>
|
||||
<td>
|
||||
@if (!string.IsNullOrEmpty(a.CdnUrl))
|
||||
{
|
||||
<a href="@a.CdnUrl" target="_blank"
|
||||
class="text-decoration-none small font-monospace">
|
||||
@TruncateUrl(a.CdnUrl)
|
||||
<i class="bi bi-box-arrow-up-right ms-1"></i>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">—</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<a href="/cards/@a.CardId" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
private bool _loading = true;
|
||||
|
||||
private record AssetRow(
|
||||
Guid CardId,
|
||||
string CardName,
|
||||
string CardType,
|
||||
string AssetType,
|
||||
string? MimeType,
|
||||
string? CdnUrl,
|
||||
DateTimeOffset CreatedAt);
|
||||
|
||||
private record AnimationRow(
|
||||
Guid CardId,
|
||||
string CardName,
|
||||
string CardType,
|
||||
string? ActionName,
|
||||
string? CdnUrl);
|
||||
|
||||
private List<AssetRow> _assets = new();
|
||||
private List<AnimationRow> _animations = new();
|
||||
|
||||
protected override async Task OnInitializedAsync() => await LoadAsync();
|
||||
|
||||
private async Task LoadAsync()
|
||||
{
|
||||
_loading = true;
|
||||
|
||||
_assets = await Db.CardAssets
|
||||
.Where(a => a.IsAiGenerated)
|
||||
.Include(a => a.CardDefinition)
|
||||
.OrderBy(a => a.CardDefinition.Name)
|
||||
.ThenBy(a => a.AssetType)
|
||||
.Select(a => new AssetRow(
|
||||
a.CardDefinitionId,
|
||||
a.CardDefinition.Name,
|
||||
a.CardDefinition.CardType.ToString(),
|
||||
a.AssetType.ToString(),
|
||||
a.MimeType,
|
||||
a.CdnUrl,
|
||||
a.CreatedAt))
|
||||
.ToListAsync();
|
||||
|
||||
_animations = await Db.AnimationBindings
|
||||
.Where(a => a.IsAiGenerated)
|
||||
.Include(a => a.CardDefinition)
|
||||
.OrderBy(a => a.CardDefinition.Name)
|
||||
.ThenBy(a => a.ActionName)
|
||||
.Select(a => new AnimationRow(
|
||||
a.CardDefinitionId,
|
||||
a.CardDefinition.Name,
|
||||
a.CardDefinition.CardType.ToString(),
|
||||
a.ActionName,
|
||||
a.AnimationCdnUrl))
|
||||
.ToListAsync();
|
||||
|
||||
_loading = false;
|
||||
}
|
||||
|
||||
private static string TruncateUrl(string url)
|
||||
{
|
||||
const int max = 40;
|
||||
if (url.Length <= max) return url;
|
||||
var last = url.LastIndexOf('/');
|
||||
return last > 0 ? "…/" + url[(last + 1)..] : "…" + url[^max..];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user