feat(routing): add ReleaseRoutes.DetailHref resolver; repoint release click sites and add /tracks/{id} redirect (P11 W2 §2)

This commit is contained in:
daniel-c-harvey
2026-06-16 10:56:28 -04:00
parent 74b9c02722
commit 55515981a9
8 changed files with 128 additions and 18 deletions
@@ -0,0 +1,26 @@
@page "/tracks/{Id:long}"
@using DeepDrftPublic.Client.Services
@inject IReleaseDataService ReleaseData
@inject NavigationManager Navigation
@* Addressable deep-link fallback for a bare release id (Phase 11 §2, shape iii). Unlike the player
bar / Archive / AlbumsView call sites, an external /tracks/{id} link carries only the id, so this
page fetches the release to discover its medium, then forwards through the same ReleaseRoutes
resolver — one medium→route table, no second source. replace:true keeps the router out of history
so Back skips this hop. Capture Id before the await per the InteractiveAuto route-param convention. *@
@code {
[Parameter] public long Id { get; set; }
protected override async Task OnParametersSetAsync()
{
var id = Id;
var result = await ReleaseData.GetById(id);
var target = result is { Success: true, Value: { } release }
? ReleaseRoutes.DetailHref(release)
: "/cuts"; // Unknown id: fall back to the Cuts gallery rather than 404.
Navigation.NavigateTo(target, forceLoad: false, replace: true);
}
}