feat(cms): dedicated grid columns for medium-specific row actions

Replace CmsAlbumBrowser's single RowActions slot with a SpecialColumns
list (header + per-row cell). Mix renders a Waveform column, Session a
Hero column, between Tracks and Actions; Edit/Delete stay rightmost.
Child-row colspan now computed from column count. Cut/ALL unchanged.
This commit is contained in:
daniel-c-harvey
2026-06-15 11:16:15 -04:00
parent 4df2b8fb57
commit 5941f1f23a
4 changed files with 126 additions and 81 deletions
@@ -53,48 +53,56 @@ else
protected override ReleaseDto ReleaseOf(SessionRow row) => row.Release;
// The grid itself — identical in the embedded and standalone contexts. Defined once as a fragment so
// both branches above render the same markup without duplication. The hero upload is the Session's
// medium-specific RowActions content; the grid hands it each release, and RowFor recovers the
// matching SessionRow's upload state.
// both branches above render the same markup without duplication. The Session declares one dedicated
// "Hero" special-action column; the grid renders it between Tracks and Actions, handing the cell each
// release, and RowFor recovers the matching SessionRow's upload state.
private RenderFragment GridContent => @<CmsAlbumBrowser Releases="Releases"
IsLoading="Loading"
OnReleasesChanged="ReloadAsync">
<RowActions Context="release">
@{ var row = RowFor(release); }
@if (row is not null)
OnReleasesChanged="ReloadAsync"
SpecialColumns="_specialColumns" />;
private IReadOnlyList<SpecialActionColumn> _specialColumns => new[]
{
new SpecialActionColumn("Hero", HeroCell)
};
// Per-row cell for the dedicated "Hero" column: thumbnail preview plus set/replace upload button with
// progress. Recovers the typed SessionRow via RowFor; skips rendering for a release not on the page.
private RenderFragment<ReleaseDto> HeroCell => release =>@<text>
@{ var row = RowFor(release); }
@if (row is not null)
{
@if (row.HeroImageEntryKey is { Length: > 0 } heroKey)
{
@if (row.HeroImageEntryKey is { Length: > 0 } heroKey)
{
<div class="cms-album-thumb" style="background-image: url('@ThumbUrl(heroKey)');"></div>
}
else
{
<div class="cms-album-thumb cms-album-thumb--fallback"></div>
}
<MudFileUpload T="IBrowserFile"
Accept="image/*"
FilesChanged="@(file => UploadHeroAsync(row, file))"
Disabled="@row.IsUploading">
<ActivatorContent>
<MudButton Variant="Variant.Outlined"
Size="Size.Small"
StartIcon="@Icons.Material.Filled.Image"
Disabled="@row.IsUploading">
@if (row.IsUploading)
{
<MudProgressCircular Class="mr-2" Size="Size.Small" Indeterminate="true" />
<span>Uploading…</span>
}
else
{
<span>@(row.HeroImageEntryKey is { Length: > 0 } ? "Replace hero" : "Set hero")</span>
}
</MudButton>
</ActivatorContent>
</MudFileUpload>
<div class="cms-album-thumb" style="background-image: url('@ThumbUrl(heroKey)');"></div>
}
</RowActions>
</CmsAlbumBrowser>;
else
{
<div class="cms-album-thumb cms-album-thumb--fallback"></div>
}
<MudFileUpload T="IBrowserFile"
Accept="image/*"
FilesChanged="@(file => UploadHeroAsync(row, file))"
Disabled="@row.IsUploading">
<ActivatorContent>
<MudButton Variant="Variant.Outlined"
Size="Size.Small"
StartIcon="@Icons.Material.Filled.Image"
Disabled="@row.IsUploading">
@if (row.IsUploading)
{
<MudProgressCircular Class="mr-2" Size="Size.Small" Indeterminate="true" />
<span>Uploading…</span>
}
else
{
<span>@(row.HeroImageEntryKey is { Length: > 0 } ? "Replace hero" : "Set hero")</span>
}
</MudButton>
</ActivatorContent>
</MudFileUpload>
}
</text>;
private async Task UploadHeroAsync(SessionRow row, IBrowserFile? file)
{