114 lines
4.9 KiB
Plaintext
114 lines
4.9 KiB
Plaintext
@page "/admin/spritesheets"
|
|
@model SpriteSheets.IndexModel
|
|
@{
|
|
ViewData["Title"] = "Sprite Sheets";
|
|
}
|
|
|
|
<div class="space-y-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-3xl font-bold text-white">Sprite Sheets</h1>
|
|
<p class="text-gray-400 mt-1">Manage sprite sheets and animations for mobs (@Model.TotalCount total)</p>
|
|
</div>
|
|
<a href="/admin/spritesheets/edit" class="btn btn-primary">+ New Sprite Sheet</a>
|
|
</div>
|
|
|
|
@if (TempData["Message"] != null)
|
|
{
|
|
<div class="p-4 rounded-lg bg-green-900/50 border border-green-700 text-green-300">
|
|
@TempData["Message"]
|
|
</div>
|
|
}
|
|
@if (TempData["Error"] != null)
|
|
{
|
|
<div class="p-4 rounded-lg bg-red-900/50 border border-red-700 text-red-300">
|
|
@TempData["Error"]
|
|
</div>
|
|
}
|
|
|
|
<!-- Search/Filter -->
|
|
<div class="card p-4">
|
|
<form method="get" class="flex flex-wrap gap-3">
|
|
<div class="flex-1 min-w-[200px]">
|
|
<input type="text" name="search" value="@Model.Search"
|
|
class="input w-full text-sm" placeholder="Search by name or path..." />
|
|
</div>
|
|
<select name="enabled" class="input text-sm">
|
|
<option value="">All Status</option>
|
|
<option value="true" selected="@(Model.EnabledFilter == true)">Enabled Only</option>
|
|
<option value="false" selected="@(Model.EnabledFilter == false)">Disabled Only</option>
|
|
</select>
|
|
<button type="submit" class="btn btn-secondary text-sm">Search</button>
|
|
<a href="/admin/spritesheets" class="btn btn-ghost text-sm">Clear</a>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
@foreach (var sheet in Model.SpriteSheets)
|
|
{
|
|
<div class="card p-4">
|
|
<div class="flex items-start justify-between mb-3">
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-white">@sheet.Name</h3>
|
|
<p class="text-sm text-gray-400 font-mono truncate max-w-[200px]" title="@sheet.CdnPath">@sheet.CdnPath</p>
|
|
</div>
|
|
@if (sheet.IsEnabled)
|
|
{
|
|
<span class="badge bg-green-600">Enabled</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge bg-gray-600">Disabled</span>
|
|
}
|
|
</div>
|
|
|
|
<!-- Preview -->
|
|
@if (!string.IsNullOrEmpty(sheet.CdnPath))
|
|
{
|
|
<div class="mb-3 bg-gray-900 rounded p-2 flex justify-center overflow-hidden" style="max-height: 80px;">
|
|
<img src="@Model.GetCdnUrl(sheet.CdnPath)"
|
|
alt="@sheet.Name"
|
|
style="max-height: 76px; image-rendering: pixelated;"
|
|
onerror="this.style.display='none'" />
|
|
</div>
|
|
}
|
|
|
|
<div class="grid grid-cols-2 gap-2 text-sm mb-3">
|
|
<div class="text-gray-400">Sheet Size:</div>
|
|
<div class="text-white">@sheet.SheetWidth x @sheet.SheetHeight</div>
|
|
<div class="text-gray-400">Frame Size:</div>
|
|
<div class="text-white">@sheet.FrameWidth x @sheet.FrameHeight</div>
|
|
<div class="text-gray-400">Grid:</div>
|
|
<div class="text-white">@sheet.Columns x @sheet.Rows (@sheet.TotalFrames frames)</div>
|
|
<div class="text-gray-400">Animations:</div>
|
|
<div class="text-white">@(sheet.Animations?.Count ?? 0)</div>
|
|
</div>
|
|
|
|
<div class="flex gap-2">
|
|
<a href="/admin/spritesheets/edit?id=@sheet.Id" class="btn btn-sm btn-secondary flex-1">Edit</a>
|
|
<form method="post" asp-page-handler="Delete" class="inline" onsubmit="return confirm('Delete this sprite sheet and all its animations?')">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="id" value="@sheet.Id" />
|
|
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
@if (Model.SpriteSheets.Count == 0)
|
|
{
|
|
<div class="card p-8 text-center text-gray-400">
|
|
@if (!string.IsNullOrEmpty(Model.Search))
|
|
{
|
|
<span>No sprite sheets found matching "@Model.Search". </span>
|
|
}
|
|
else
|
|
{
|
|
<span>No sprite sheets found. </span>
|
|
}
|
|
<a href="/admin/spritesheets/edit" class="text-indigo-400 hover:underline">Create one</a>
|
|
</div>
|
|
}
|
|
</div>
|