Add hex stalagmite support for tile bottom models

- TileBottomModel gains a Shape column (Square/Hex, default Square)
  so admins can manage separate stalagmite pools per tile grid type
- EF migration 20260407153312_AddTileBottomModelShape adds the column
  with a default of 'Square' to preserve existing data
- Admin UI splits the Tile Bottom Models section into Square and Hex
  cards, each with their own Add/toggle/delete controls
- content.tile_bottoms response now returns squareUrls and hexUrls
  separately; handler queries each shape independently
- ContentCache splits into _tile_bottom_urls_square / _hex and
  get_random_tile_bottom_url() now takes a shape parameter
- game_screen: hex tiles with no 3D model now receive a hex stalagmite
  instead of silently skipping; 3D-model path passes shape_key through

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:
dingo
2026-04-07 11:34:46 -04:00
co-authored by Claude Happy
parent be8b1f7765
commit 4ac92d0139
10 changed files with 780 additions and 77 deletions
@@ -83,57 +83,64 @@ else
}
<!-- ── Tile Bottoms (stalagmite undersides) ── -->
<div class="card shadow-sm mb-4">
<div class="card-header fw-medium d-flex justify-content-between align-items-center">
<span>Tile Bottom Models <span class="text-muted small fw-normal">(stalagmites, randomly selected per tile)</span></span>
<button class="btn btn-sm btn-outline-primary" @onclick="OpenBottomPickerAsync">
<i class="bi bi-plus me-1"></i>Add
</button>
</div>
<div class="card-body p-0">
@if (_bottomModels.Count == 0)
{
<div class="text-muted text-center py-3 small">No bottom models yet — upload GLBs and add them here.</div>
}
else
{
<table class="table table-sm table-hover mb-0">
<thead class="table-light">
<tr>
<th>Model</th>
<th style="width:80px">Active</th>
<th style="width:100px"></th>
</tr>
</thead>
<tbody>
@foreach (var bottom in _bottomModels)
{
var b = bottom;
@foreach (var (shapeLabel, bottomShape) in new[] { ("Square", TileShape.Square), ("Hex", TileShape.Hex) })
{
var shapeModels = _bottomModels.Where(m => m.Shape == bottomShape).ToList();
<div class="card shadow-sm mb-4">
<div class="card-header fw-medium d-flex justify-content-between align-items-center">
<span>
Tile Bottom Models — <span class="badge bg-secondary">@shapeLabel</span>
<span class="text-muted small fw-normal ms-2">(stalagmites, randomly selected per @shapeLabel.ToLower() tile)</span>
</span>
<button class="btn btn-sm btn-outline-primary" @onclick="() => OpenBottomPickerAsync(bottomShape)">
<i class="bi bi-plus me-1"></i>Add
</button>
</div>
<div class="card-body p-0">
@if (shapeModels.Count == 0)
{
<div class="text-muted text-center py-3 small">No @shapeLabel.ToLower() bottom models yet — upload GLBs and add them here.</div>
}
else
{
<table class="table table-sm table-hover mb-0">
<thead class="table-light">
<tr>
<td class="align-middle font-monospace small text-break">
@(b.CdnKey.Contains('/') ? b.CdnKey[(b.CdnKey.LastIndexOf('/') + 1)..] : b.CdnKey)
</td>
<td class="align-middle">
<input type="checkbox" class="form-check-input" checked="@b.IsActive"
@onchange="e => ToggleBottomActiveAsync(b, (bool)e.Value!)" />
</td>
<td class="align-middle text-end pe-2">
<button class="btn btn-sm btn-outline-info py-0 me-1"
@onclick="() => _previewUrl = b.PublicUrl" title="Preview">
<i class="bi bi-box"></i>
</button>
<button class="btn btn-sm btn-outline-danger py-0"
@onclick="() => DeleteBottomAsync(b)" title="Delete">
<i class="bi bi-trash"></i>
</button>
</td>
<th>Model</th>
<th style="width:80px">Active</th>
<th style="width:100px"></th>
</tr>
}
</tbody>
</table>
}
</thead>
<tbody>
@foreach (var bottom in shapeModels)
{
var b = bottom;
<tr>
<td class="align-middle font-monospace small text-break">
@(b.CdnKey.Contains('/') ? b.CdnKey[(b.CdnKey.LastIndexOf('/') + 1)..] : b.CdnKey)
</td>
<td class="align-middle">
<input type="checkbox" class="form-check-input" checked="@b.IsActive"
@onchange="e => ToggleBottomActiveAsync(b, (bool)e.Value!)" />
</td>
<td class="align-middle text-end pe-2">
<button class="btn btn-sm btn-outline-info py-0 me-1"
@onclick="() => _previewUrl = b.PublicUrl" title="Preview">
<i class="bi bi-box"></i>
</button>
<button class="btn btn-sm btn-outline-danger py-0"
@onclick="() => DeleteBottomAsync(b)" title="Delete">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
</div>
}
<!-- Assign / Picker Modal -->
@if (_pickerOpen)
@@ -265,7 +272,7 @@ else
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Tile Bottom Model</h5>
<h5 class="modal-title">Add Tile Bottom Model <span class="badge bg-secondary ms-2">@_bottomPickerShape</span></h5>
<button type="button" class="btn-close" @onclick="() => _bottomPickerOpen = false"></button>
</div>
<div class="modal-body">
@@ -434,6 +441,7 @@ else
// Tile bottom models
private List<TileBottomModel> _bottomModels = new();
private bool _bottomPickerOpen;
private TileShape _bottomPickerShape = TileShape.Square;
private string _bottomPickerSearch = "";
private string? _bottomPickerSelected;
@@ -721,8 +729,9 @@ else
// ── Tile Bottom Models ────────────────────────────────────────────────────
private async Task OpenBottomPickerAsync()
private async Task OpenBottomPickerAsync(TileShape shape)
{
_bottomPickerShape = shape;
_bottomPickerSelected = null;
_bottomPickerSearch = "";
_bottomPickerOpen = true;
@@ -748,6 +757,7 @@ else
var publicUrl = BuildPublicUrl(options, _bottomPickerSelected);
var model = new TileBottomModel
{
Shape = _bottomPickerShape,
CdnKey = _bottomPickerSelected,
PublicUrl = publicUrl,
IsActive = true,