@namespace DeepDrftPublic.Client.Controls @* The single release-card grid for every browse surface (Sessions, Mixes, Cuts, Archive). Cards open a detail page; how a card computes its href is the only real divergence across surfaces, so the parent supplies it one of two ways: - DetailRoute (the simple default): every card links /{DetailRoute}/{entryKey} (Sessions, Mixes). - HrefResolver (per-card): each card links HrefResolver(release), so Archive routes each card by its own medium through the one ReleaseRoutes table, and Cuts routes to /cuts/{entryKey}. HrefResolver wins when both are supplied. The card subtitle defaults to the artist; SubtitleResolver overrides it (Cuts shows a track count instead). Fully controlled by the parent: loading and item state are passed in. *@
@if (Loading) { @foreach (var _ in Enumerable.Range(0, 8)) {
}
} else if (Releases.Count == 0) { } else { @foreach (var release in Releases) { } }
@code { [Parameter] public required IReadOnlyList Releases { get; set; } [Parameter] public bool Loading { get; set; } /// /// Route segment for a card's detail page; a card links to /{DetailRoute}/{entryKey}. The simple /// fixed-route default used by Sessions/Mixes. Ignored when is supplied. /// [Parameter] public string? DetailRoute { get; set; } /// /// Per-card href resolver. When supplied, a card links to its result instead of the /// -based href, letting Archive route each card by its own medium and /// Cuts route to /cuts/{entryKey} (both via ReleaseRoutes.DetailHref). /// [Parameter] public Func? HrefResolver { get; set; } /// /// Optional override for a card's subtitle line (defaults to the release artist). Cuts pass a /// track-count label here. /// [Parameter] public Func? SubtitleResolver { get; set; } [Parameter] public string EmptyMessage { get; set; } = "Nothing here yet"; private string CardHref(DeepDrftModels.DTOs.ReleaseDto release) => HrefResolver?.Invoke(release) ?? $"/{DetailRoute}/{release.EntryKey}"; }