Merge p11-w5-release-entrykey into dev (P11 11.H: release EntryKey on the public addressing surface; migration authored, not applied)
This commit is contained in:
@@ -69,9 +69,9 @@ public class ReleaseClient
|
||||
: ApiResult<PagedResult<ReleaseDto>>.CreateFailResult("Failed to deserialize response");
|
||||
}
|
||||
|
||||
public async Task<ApiResult<ReleaseDto>> GetById(long id)
|
||||
public async Task<ApiResult<ReleaseDto>> GetByEntryKey(string entryKey)
|
||||
{
|
||||
var response = await _http.GetAsync($"api/release/{id}");
|
||||
var response = await _http.GetAsync($"api/release/{Uri.EscapeDataString(entryKey)}");
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return ApiResult<ReleaseDto>.CreateFailResult($"HTTP {(int)response.StatusCode}");
|
||||
@@ -85,13 +85,13 @@ public class ReleaseClient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the high-res waveform datum for a Mix release. A 404 means no datum is stored
|
||||
/// (not yet generated, or not a Mix) — a valid state, so it returns a pass result with a
|
||||
/// null value. Any other non-success status is a genuine failure.
|
||||
/// Fetches the high-res waveform datum for a Mix release, addressed by its public EntryKey. A 404
|
||||
/// means no datum is stored (not yet generated, or not a Mix) — a valid state, so it returns a pass
|
||||
/// result with a null value. Any other non-success status is a genuine failure.
|
||||
/// </summary>
|
||||
public async Task<ApiResult<WaveformProfileDto?>> GetMixWaveform(long id)
|
||||
public async Task<ApiResult<WaveformProfileDto?>> GetMixWaveform(string entryKey)
|
||||
{
|
||||
var response = await _http.GetAsync($"api/release/{id}/mix/waveform");
|
||||
var response = await _http.GetAsync($"api/release/{Uri.EscapeDataString(entryKey)}/mix/waveform");
|
||||
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
return ApiResult<WaveformProfileDto?>.CreatePassResult(null);
|
||||
|
||||
@@ -14,17 +14,19 @@ namespace DeepDrftPublic.Client.Common;
|
||||
public static class ReleaseRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// The dedicated detail route for a release: <c>/cuts/{id}</c>, <c>/sessions/{id}</c>, or
|
||||
/// <c>/mixes/{id}</c>. Cut is the default arm so a new medium without an entry here surfaces a
|
||||
/// build-visible gap rather than a silent fallthrough — extend the switch when a fourth medium lands.
|
||||
/// The dedicated detail route for a release: <c>/cuts/{entryKey}</c>, <c>/sessions/{entryKey}</c>,
|
||||
/// or <c>/mixes/{entryKey}</c>. The route carries the release's opaque public EntryKey (Phase 11
|
||||
/// §3e) — never the transparent int PK. Cut is the default arm so a new medium without an entry
|
||||
/// here surfaces a build-visible gap rather than a silent fallthrough — extend the switch when a
|
||||
/// fourth medium lands.
|
||||
/// </summary>
|
||||
public static string DetailHref(long id, ReleaseMedium medium) => medium switch
|
||||
public static string DetailHref(string entryKey, ReleaseMedium medium) => medium switch
|
||||
{
|
||||
ReleaseMedium.Session => $"/sessions/{id}",
|
||||
ReleaseMedium.Mix => $"/mixes/{id}",
|
||||
_ => $"/cuts/{id}",
|
||||
ReleaseMedium.Session => $"/sessions/{entryKey}",
|
||||
ReleaseMedium.Mix => $"/mixes/{entryKey}",
|
||||
_ => $"/cuts/{entryKey}",
|
||||
};
|
||||
|
||||
/// <summary>Convenience overload for call sites holding a <see cref="ReleaseDto"/>.</summary>
|
||||
public static string DetailHref(ReleaseDto release) => DetailHref(release.Id, release.Medium);
|
||||
public static string DetailHref(ReleaseDto release) => DetailHref(release.EntryKey, release.Medium);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@* Full-page scrolling Mix waveform background (Phase 9, 8.K). A windowed slice of the mix's loudness
|
||||
datum scrolls bottom-to-top, coupled to playback; a zoom slider controls the visible time-span (and
|
||||
so the apparent scroll speed, Guitar-Hero style). Strictly read-only: it self-fetches its datum from
|
||||
ReleaseId, takes playback as one-way input only, and never seeks or writes back. The rAF loop and all
|
||||
ReleaseEntryKey, takes playback as one-way input only, and never seeks or writes back. The rAF loop and all
|
||||
scroll/zoom/compositing math live in the MixVisualizer.ts interop module; this component is a thin
|
||||
bridge that feeds it datum + playback + zoom + theme. Deliberately NOT the player-bar peak-bar idiom. *@
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace DeepDrftPublic.Client.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Full-page scrolling Mix waveform background. Standalone and reusable: give it a
|
||||
/// <see cref="ReleaseId"/> and it fetches its own loudness datum. The rendering itself — a windowed,
|
||||
/// <see cref="ReleaseEntryKey"/> and it fetches its own loudness datum. The rendering itself — a windowed,
|
||||
/// bottom-to-top, playback-coupled scroll with a glassy theme-aware gradient — lives in the
|
||||
/// MixVisualizer.ts interop module; this component is the bridge that feeds it datum, playback
|
||||
/// position, zoom, and theme, and owns the module lifecycle.
|
||||
@@ -36,8 +36,8 @@ public partial class MixWaveformVisualizer : ComponentBase, IAsyncDisposable
|
||||
// us, and OnAfterRender pushes fresh palette colours into the module.
|
||||
[CascadingParameter] public DarkModeSettings? DarkMode { get; set; }
|
||||
|
||||
/// <summary>The Mix release whose waveform datum to fetch and render.</summary>
|
||||
[Parameter] public required long ReleaseId { get; set; }
|
||||
/// <summary>The opaque public EntryKey of the Mix release whose waveform datum to fetch and render.</summary>
|
||||
[Parameter] public required string ReleaseEntryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The id of this mix's playable track. Used to gate the cascaded player as the live source: we
|
||||
@@ -75,7 +75,7 @@ public partial class MixWaveformVisualizer : ComponentBase, IAsyncDisposable
|
||||
|
||||
private IStreamingPlayerService? _subscribedService;
|
||||
private WaveformProfileDto? _profile;
|
||||
private long? _loadedReleaseId;
|
||||
private string? _loadedReleaseKey;
|
||||
|
||||
// Whether we are subscribed to the shared control state's Changed event. The controls row (a
|
||||
// sibling component) mutates ControlState and raises Changed; we push the affected uniforms.
|
||||
@@ -114,21 +114,21 @@ public partial class MixWaveformVisualizer : ComponentBase, IAsyncDisposable
|
||||
_subscribedService.StateChanged -= OnPlayerStateChanged;
|
||||
PlayerService.StateChanged += OnPlayerStateChanged;
|
||||
_subscribedService = PlayerService;
|
||||
DebugLog($"subscribed to player StateChanged. ReleaseId={ReleaseId}, TrackId={TrackId?.ToString() ?? "null"}.");
|
||||
DebugLog($"subscribed to player StateChanged. ReleaseEntryKey={ReleaseEntryKey}, TrackId={TrackId?.ToString() ?? "null"}.");
|
||||
}
|
||||
else if (PlayerService is null)
|
||||
{
|
||||
DebugLog($"NO player cascade — playback will never couple. ReleaseId={ReleaseId}, TrackId={TrackId?.ToString() ?? "null"}.");
|
||||
DebugLog($"NO player cascade — playback will never couple. ReleaseEntryKey={ReleaseEntryKey}, TrackId={TrackId?.ToString() ?? "null"}.");
|
||||
}
|
||||
|
||||
// ReleaseId is the only fetch input; fetch once per id. Position/zoom/theme changes re-render
|
||||
// but must not refetch, and a release with no datum must not refetch either — so the guard
|
||||
// keys on the fetched id, not on whether a profile came back.
|
||||
if (_loadedReleaseId == ReleaseId) return;
|
||||
_loadedReleaseId = ReleaseId;
|
||||
// ReleaseEntryKey is the only fetch input; fetch once per key. Position/zoom/theme changes
|
||||
// re-render but must not refetch, and a release with no datum must not refetch either — so the
|
||||
// guard keys on the fetched key, not on whether a profile came back.
|
||||
if (_loadedReleaseKey == ReleaseEntryKey) return;
|
||||
_loadedReleaseKey = ReleaseEntryKey;
|
||||
|
||||
DebugLog($"fetching mix waveform datum for ReleaseId={ReleaseId}…");
|
||||
var result = await ReleaseData.GetMixWaveform(ReleaseId);
|
||||
DebugLog($"fetching mix waveform datum for ReleaseEntryKey={ReleaseEntryKey}…");
|
||||
var result = await ReleaseData.GetMixWaveform(ReleaseEntryKey);
|
||||
if (result is { Success: true, Value: { } profile } && profile.BucketCount > 0 && profile.Data.Length > 0)
|
||||
{
|
||||
_profile = profile;
|
||||
@@ -140,7 +140,7 @@ public partial class MixWaveformVisualizer : ComponentBase, IAsyncDisposable
|
||||
// renders its content over a plain background.
|
||||
_profile = null;
|
||||
DebugLog(result.Success
|
||||
? $"datum fetch returned EMPTY/absent (no stored datum for ReleaseId={ReleaseId}) — backdrop stays blank."
|
||||
? $"datum fetch returned EMPTY/absent (no stored datum for ReleaseEntryKey={ReleaseEntryKey}) — backdrop stays blank."
|
||||
: $"datum fetch FAILED ({result.GetMessage() ?? "unknown error"}) — backdrop stays blank.");
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
the parent supplies it one of two ways:
|
||||
- DetailRoute (the simple default): every card links /{DetailRoute}/{id} (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/{id}.
|
||||
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. *@
|
||||
@@ -82,7 +82,7 @@
|
||||
/// <summary>
|
||||
/// Per-card href resolver. When supplied, a card links to its result instead of the
|
||||
/// <see cref="DetailRoute"/>-based href, letting Archive route each card by its own medium and
|
||||
/// Cuts route to /cuts/{id} (both via <c>ReleaseRoutes.DetailHref</c>).
|
||||
/// Cuts route to /cuts/{entryKey} (both via <c>ReleaseRoutes.DetailHref</c>).
|
||||
/// </summary>
|
||||
[Parameter] public Func<DeepDrftModels.DTOs.ReleaseDto, string>? HrefResolver { get; set; }
|
||||
|
||||
@@ -95,5 +95,5 @@
|
||||
[Parameter] public string EmptyMessage { get; set; } = "Nothing here yet";
|
||||
|
||||
private string CardHref(DeepDrftModels.DTOs.ReleaseDto release)
|
||||
=> HrefResolver?.Invoke(release) ?? $"/{DetailRoute}/{release.Id}";
|
||||
=> HrefResolver?.Invoke(release) ?? $"/{DetailRoute}/{release.EntryKey}";
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace DeepDrftPublic.Client.Controls;
|
||||
/// <summary>
|
||||
/// Share affordance with two modes from one source of clipboard/popover-chrome logic
|
||||
/// (Phase 11 §3b). Track mode (<see cref="EntryKey"/> set) offers a canonical-link copy plus an
|
||||
/// optional iframe embed snippet. Release mode (<see cref="ReleaseId"/> set) is copy-link-only —
|
||||
/// optional iframe embed snippet. Release mode (<see cref="ReleaseEntryKey"/> set) is copy-link-only —
|
||||
/// it copies the absolute form of the release's canonical detail URL and hides the embed
|
||||
/// affordance, since a release page is not a single-track embed. Clipboard writes go through
|
||||
/// navigator.clipboard; each copy shows a transient "Copied!" confirmation that resets after a
|
||||
@@ -19,8 +19,8 @@ public partial class SharePopover : ComponentBase, IDisposable
|
||||
/// <summary>Track mode: the vault entry key of the track to share. Mutually exclusive with the release target.</summary>
|
||||
[Parameter] public string? EntryKey { get; set; }
|
||||
|
||||
/// <summary>Release mode: the release id to share. When set (with <see cref="ReleaseMedium"/>), the popover shares the release detail URL and omits the embed option.</summary>
|
||||
[Parameter] public long? ReleaseId { get; set; }
|
||||
/// <summary>Release mode: the release's opaque public EntryKey to share. When set (with <see cref="ReleaseMedium"/>), the popover shares the release detail URL and omits the embed option.</summary>
|
||||
[Parameter] public string? ReleaseEntryKey { get; set; }
|
||||
|
||||
/// <summary>Release mode: the medium of the release, used to resolve its canonical detail route.</summary>
|
||||
[Parameter] public ReleaseMedium ReleaseMedium { get; set; }
|
||||
@@ -28,7 +28,7 @@ public partial class SharePopover : ComponentBase, IDisposable
|
||||
[Inject] public required NavigationManager Navigation { get; set; }
|
||||
[Inject] public required IJSRuntime JS { get; set; }
|
||||
|
||||
private bool IsReleaseMode => ReleaseId is not null;
|
||||
private bool IsReleaseMode => ReleaseEntryKey is not null;
|
||||
|
||||
private bool _open;
|
||||
private bool _embed;
|
||||
@@ -51,7 +51,7 @@ public partial class SharePopover : ComponentBase, IDisposable
|
||||
// route (which carries a leading slash) and composes it against BaseUri (which carries a
|
||||
// trailing slash) — trim one to avoid a doubled separator.
|
||||
private string LinkUrl => IsReleaseMode
|
||||
? $"{Navigation.BaseUri.TrimEnd('/')}{ReleaseRoutes.DetailHref(ReleaseId!.Value, ReleaseMedium)}"
|
||||
? $"{Navigation.BaseUri.TrimEnd('/')}{ReleaseRoutes.DetailHref(ReleaseEntryKey!, ReleaseMedium)}"
|
||||
: TrackUrl;
|
||||
|
||||
private string TrackUrl => $"{Navigation.BaseUri}track/{EntryKey}";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<PageTitle>DeepDrft Cuts</PageTitle>
|
||||
|
||||
@* The shared release-card grid; each card routes to /cuts/{id} via the one ReleaseRoutes table.
|
||||
@* The shared release-card grid; each card routes to /cuts/{entryKey} via the one ReleaseRoutes table.
|
||||
Cuts show a track count where other media show the artist, supplied via SubtitleResolver. *@
|
||||
<ReleaseGallery Releases="@_albums"
|
||||
Loading="@_loading"
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace DeepDrftPublic.Client.Pages;
|
||||
/// Medium-filtered release gallery. Routed at <c>/cuts</c> (Cut releases) and parameterized by
|
||||
/// <see cref="Medium"/> so the same component can back any medium's card grid without a fork.
|
||||
/// Cards open the release's dedicated detail page via <see cref="ReleaseRoutes.DetailHref(ReleaseDto)"/>
|
||||
/// (a Cut routes to <c>/cuts/{id}</c>), the single source for medium→route resolution (Phase 11 §2).
|
||||
/// (a Cut routes to <c>/cuts/{entryKey}</c>), the single source for medium→route resolution (Phase 11 §2).
|
||||
/// </summary>
|
||||
public partial class AlbumsView : ComponentBase, IDisposable
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/cuts/{Id:long}"
|
||||
@page "/cuts/{EntryKey}"
|
||||
@using DeepDrftModels.DTOs
|
||||
@using DeepDrftPublic.Client.Controls
|
||||
@using DeepDrftPublic.Client.Services
|
||||
@@ -79,8 +79,8 @@ else
|
||||
Play
|
||||
</MudButton>
|
||||
|
||||
@* Release-mode share: copies the canonical /cuts/{id} URL, not a single track (§3b). *@
|
||||
<SharePopover ReleaseId="@release.Id" ReleaseMedium="@release.Medium" />
|
||||
@* Release-mode share: copies the canonical /cuts/{entryKey} URL, not a single track (§3b). *@
|
||||
<SharePopover ReleaseEntryKey="@release.EntryKey" ReleaseMedium="@release.Medium" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Components;
|
||||
namespace DeepDrftPublic.Client.Pages;
|
||||
|
||||
/// <summary>
|
||||
/// Load + prerender-bridge logic for the Cut album-detail page (/cuts/{id}). Mirrors
|
||||
/// Load + prerender-bridge logic for the Cut album-detail page (/cuts/{entryKey}). Mirrors
|
||||
/// <see cref="ReleaseDetailBase"/>'s discipline (id-addressed load in OnParametersSetAsync,
|
||||
/// PersistentComponentState bridge guarded on id) but carries the multi-track payload (release +
|
||||
/// ordered track list) the Cut page needs. Kept separate from the single-track base so neither
|
||||
@@ -15,16 +15,16 @@ public abstract class CutDetailBase : ComponentBase, IDisposable
|
||||
{
|
||||
private const string PersistKey = "cut-detail";
|
||||
|
||||
[Parameter] public long Id { get; set; }
|
||||
[Parameter] public string EntryKey { get; set; } = string.Empty;
|
||||
[Inject] public required CutDetailViewModel ViewModel { get; set; }
|
||||
[Inject] public required PersistentComponentState PersistentState { get; set; }
|
||||
|
||||
private PersistingComponentStateSubscription _persistingSubscription;
|
||||
|
||||
// The release id the ViewModel currently holds — tracks param-only navigations (e.g.
|
||||
// /cuts/5 -> /cuts/8) which reuse this component instance and fire OnParametersSet without
|
||||
// The release EntryKey the ViewModel currently holds — tracks param-only navigations (e.g.
|
||||
// /cuts/{a} -> /cuts/{b}) which reuse this component instance and fire OnParametersSet without
|
||||
// re-running OnInitialized. Without it the page would keep the prior album's tracks.
|
||||
private long _loadedId;
|
||||
private string? _loadedKey;
|
||||
private bool _loaded;
|
||||
|
||||
protected override void OnInitialized()
|
||||
@@ -32,25 +32,25 @@ public abstract class CutDetailBase : ComponentBase, IDisposable
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (_loaded && _loadedId == Id) return;
|
||||
if (_loaded && _loadedKey == EntryKey) return;
|
||||
|
||||
// Capture the id synchronously before any await so a re-entrant call (rapid navigation or a
|
||||
// re-render that changes Id while Load is in flight) sees the correct guard state.
|
||||
_loadedId = Id;
|
||||
// Capture the key synchronously before any await so a re-entrant call (rapid navigation or a
|
||||
// re-render that changes EntryKey while Load is in flight) sees the correct guard state.
|
||||
_loadedKey = EntryKey;
|
||||
_loaded = true;
|
||||
|
||||
// The bridged payload carries the release and its ordered tracks so the interactive pass
|
||||
// renders identically without a second round-trip. Guard on the id: a payload for a different
|
||||
// renders identically without a second round-trip. Guard on the key: a payload for a different
|
||||
// release must not seed this page (stale-bridge bleed across navigation).
|
||||
if (PersistentState.TryTakeFromJson<BridgedCut>(PersistKey, out var restored)
|
||||
&& restored?.Release is not null
|
||||
&& restored.Release.Id == Id)
|
||||
&& restored.Release.EntryKey == EntryKey)
|
||||
{
|
||||
ViewModel.Restore(restored.Release, restored.Tracks);
|
||||
}
|
||||
else
|
||||
{
|
||||
await ViewModel.Load(Id);
|
||||
await ViewModel.Load(EntryKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/mixes/{Id:long}"
|
||||
@page "/mixes/{EntryKey}"
|
||||
@using DeepDrftPublic.Client.Controls
|
||||
@inherits ReleaseDetailBase
|
||||
|
||||
@@ -37,7 +37,7 @@ else
|
||||
@* Full-page waveform sits behind the scaffold content. The scaffold's container is positioned
|
||||
above it via the mix-detail-foreground stacking context. TrackId lets the visualizer couple to
|
||||
playback only when the player is on this mix's track. *@
|
||||
<MixWaveformVisualizer ReleaseId="@release.Id" TrackId="@ViewModel.Track?.Id" />
|
||||
<MixWaveformVisualizer ReleaseEntryKey="@release.EntryKey" TrackId="@ViewModel.Track?.Id" />
|
||||
|
||||
<div class="mix-detail-foreground">
|
||||
<MudContainer MaxWidth="MaxWidth.Large" Class="mix-detail-container">
|
||||
|
||||
@@ -13,17 +13,17 @@ namespace DeepDrftPublic.Client.Pages;
|
||||
/// </summary>
|
||||
public abstract class ReleaseDetailBase : ComponentBase, IDisposable
|
||||
{
|
||||
[Parameter] public long Id { get; set; }
|
||||
[Parameter] public string EntryKey { get; set; } = string.Empty;
|
||||
[Inject] public required ReleaseDetailViewModel ViewModel { get; set; }
|
||||
[Inject] public required PersistentComponentState PersistentState { get; set; }
|
||||
|
||||
private PersistingComponentStateSubscription _persistingSubscription;
|
||||
|
||||
// The release id the ViewModel currently holds. Tracks param-only navigations (e.g.
|
||||
// /mixes/5 -> /mixes/8) which reuse this component instance and fire OnParametersSet
|
||||
// The release EntryKey the ViewModel currently holds. Tracks param-only navigations (e.g.
|
||||
// /mixes/{a} -> /mixes/{b}) which reuse this component instance and fire OnParametersSet
|
||||
// without re-running OnInitialized — without this, the page would keep the prior
|
||||
// release's track and Play would stream the wrong audio.
|
||||
private long _loadedId;
|
||||
private string? _loadedKey;
|
||||
private bool _loaded;
|
||||
|
||||
// Distinct keys per medium so a Session restore never lands on a Mix page.
|
||||
@@ -34,31 +34,31 @@ public abstract class ReleaseDetailBase : ComponentBase, IDisposable
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
// Re-run whenever the route id changes. Component instances are reused across
|
||||
// Re-run whenever the route key changes. Component instances are reused across
|
||||
// same-template navigations, so the load decision must live here, not in
|
||||
// OnInitialized (which fires once per instance).
|
||||
if (_loaded && _loadedId == Id) return;
|
||||
if (_loaded && _loadedKey == EntryKey) return;
|
||||
|
||||
// Capture the id synchronously before any await so that a re-entrant call
|
||||
// (rapid navigation or a re-render that changes Id while Load is in flight)
|
||||
// Capture the key synchronously before any await so that a re-entrant call
|
||||
// (rapid navigation or a re-render that changes EntryKey while Load is in flight)
|
||||
// sees the correct guard state. Without this, a second OnParametersSetAsync
|
||||
// for the same Id would bypass the guard above and start a second Load,
|
||||
// for the same key would bypass the guard above and start a second Load,
|
||||
// causing two ViewModel.Load calls to race on the single scoped instance.
|
||||
_loadedId = Id;
|
||||
_loadedKey = EntryKey;
|
||||
_loaded = true;
|
||||
|
||||
// The bridged payload carries both the release and its resolved track so the interactive
|
||||
// pass renders identically without a second round-trip. Guard on the id: a payload for a
|
||||
// pass renders identically without a second round-trip. Guard on the key: a payload for a
|
||||
// different release must not seed this page (stale-bridge bleed across navigation).
|
||||
if (PersistentState.TryTakeFromJson<BridgedDetail>(PersistKey, out var restored)
|
||||
&& restored?.Release is not null
|
||||
&& restored.Release.Id == Id)
|
||||
&& restored.Release.EntryKey == EntryKey)
|
||||
{
|
||||
ViewModel.Restore(restored.Release, restored.Track);
|
||||
}
|
||||
else
|
||||
{
|
||||
await ViewModel.Load(Id);
|
||||
await ViewModel.Load(EntryKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/sessions/{Id:long}"
|
||||
@page "/sessions/{EntryKey}"
|
||||
@using DeepDrftModels.DTOs
|
||||
@using DeepDrftPublic.Client.Controls
|
||||
@using DeepDrftPublic.Client.Services
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
@page "/tracks/{Id:long}"
|
||||
@page "/tracks/{EntryKey}"
|
||||
@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. *@
|
||||
@* Addressable deep-link fallback for a bare release EntryKey (Phase 11 §2, shape iii). Unlike the
|
||||
player bar / Archive / AlbumsView call sites, an external /tracks/{entryKey} link carries only the
|
||||
key, 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 EntryKey before the await per the InteractiveAuto
|
||||
route-param convention. *@
|
||||
|
||||
@code {
|
||||
[Parameter] public long Id { get; set; }
|
||||
[Parameter] public string EntryKey { get; set; } = string.Empty;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
var id = Id;
|
||||
var result = await ReleaseData.GetById(id);
|
||||
var entryKey = EntryKey;
|
||||
var result = await ReleaseData.GetByEntryKey(entryKey);
|
||||
|
||||
var target = result is { Success: true, Value: { } release }
|
||||
? ReleaseRoutes.DetailHref(release)
|
||||
: "/cuts"; // Unknown id: fall back to the Cuts gallery rather than 404.
|
||||
: "/cuts"; // Unknown key: fall back to the Cuts gallery rather than 404.
|
||||
|
||||
Navigation.NavigateTo(target, forceLoad: false, replace: true);
|
||||
}
|
||||
|
||||
@@ -22,12 +22,13 @@ public interface IReleaseDataService
|
||||
string? search = null,
|
||||
string? genre = null);
|
||||
|
||||
/// <summary>Single release with both metadata satellites (nulls for non-matching media).</summary>
|
||||
Task<ApiResult<ReleaseDto>> GetById(long id);
|
||||
/// <summary>Single release resolved by its opaque public EntryKey, with both metadata satellites (nulls for non-matching media).</summary>
|
||||
Task<ApiResult<ReleaseDto>> GetByEntryKey(string entryKey);
|
||||
|
||||
/// <summary>
|
||||
/// The Mix waveform datum. Success with a value when present; success with a null value when
|
||||
/// no datum is stored (a valid state, not a failure); failure on any other transport error.
|
||||
/// The Mix waveform datum for a release addressed by its public EntryKey. Success with a value
|
||||
/// when present; success with a null value when no datum is stored (a valid state, not a failure);
|
||||
/// failure on any other transport error.
|
||||
/// </summary>
|
||||
Task<ApiResult<WaveformProfileDto?>> GetMixWaveform(long id);
|
||||
Task<ApiResult<WaveformProfileDto?>> GetMixWaveform(string entryKey);
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ public class ReleaseClientDataService : IReleaseDataService
|
||||
string? genre = null)
|
||||
=> _releaseClient.GetPaged(medium, page, pageSize, sortColumn, sortDescending, search, genre);
|
||||
|
||||
public Task<ApiResult<ReleaseDto>> GetById(long id)
|
||||
=> _releaseClient.GetById(id);
|
||||
public Task<ApiResult<ReleaseDto>> GetByEntryKey(string entryKey)
|
||||
=> _releaseClient.GetByEntryKey(entryKey);
|
||||
|
||||
public Task<ApiResult<WaveformProfileDto?>> GetMixWaveform(long id)
|
||||
=> _releaseClient.GetMixWaveform(id);
|
||||
public Task<ApiResult<WaveformProfileDto?>> GetMixWaveform(string entryKey)
|
||||
=> _releaseClient.GetMixWaveform(entryKey);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using DeepDrftPublic.Client.Services;
|
||||
namespace DeepDrftPublic.Client.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// State for the Cut album-detail page (/cuts/{id}). Unlike <see cref="ReleaseDetailViewModel"/>
|
||||
/// State for the Cut album-detail page (/cuts/{entryKey}). Unlike <see cref="ReleaseDetailViewModel"/>
|
||||
/// (which resolves a single playable track for Session/Mix), a Cut is multi-track: it loads the
|
||||
/// release and the full ordered track list for that release. The list is fetched through the
|
||||
/// existing releaseId-filtered track page sorted by TrackNumber — the explicit 1-based ordinal
|
||||
@@ -40,7 +40,7 @@ public class CutDetailViewModel
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
public async Task Load(long releaseId)
|
||||
public async Task Load(string entryKey)
|
||||
{
|
||||
IsLoading = true;
|
||||
NotFound = false;
|
||||
@@ -49,7 +49,7 @@ public class CutDetailViewModel
|
||||
|
||||
try
|
||||
{
|
||||
var releaseResult = await _releaseData.GetById(releaseId);
|
||||
var releaseResult = await _releaseData.GetByEntryKey(entryKey);
|
||||
if (releaseResult is not { Success: true, Value: { } release })
|
||||
{
|
||||
NotFound = true;
|
||||
@@ -59,9 +59,11 @@ public class CutDetailViewModel
|
||||
Release = release;
|
||||
|
||||
// The album's tracks via the releaseId-filtered page — an exact join, not a title string
|
||||
// (which collides across same-titled releases and breaks on rename). Sorted by TrackNumber
|
||||
// so rows render in saved order. A Cut with no streamable tracks simply leaves the list
|
||||
// empty (the page renders the header with no rows).
|
||||
// (which collides across same-titled releases and breaks on rename). The public page
|
||||
// addresses the release by EntryKey; the track→release join stays on the internal int FK
|
||||
// (Phase 11 §3e), so use the resolved release.Id here. Sorted by TrackNumber so rows render
|
||||
// in saved order. A Cut with no streamable tracks simply leaves the list empty (the page
|
||||
// renders the header with no rows).
|
||||
var trackResult = await _trackData.GetPage(
|
||||
pageNumber: 1,
|
||||
pageSize: AlbumPageSize,
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ReleaseDetailViewModel
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
public async Task Load(long releaseId)
|
||||
public async Task Load(string entryKey)
|
||||
{
|
||||
IsLoading = true;
|
||||
NotFound = false;
|
||||
@@ -44,7 +44,7 @@ public class ReleaseDetailViewModel
|
||||
|
||||
try
|
||||
{
|
||||
var releaseResult = await _releaseData.GetById(releaseId);
|
||||
var releaseResult = await _releaseData.GetByEntryKey(entryKey);
|
||||
if (releaseResult is not { Success: true, Value: { } release })
|
||||
{
|
||||
NotFound = true;
|
||||
@@ -54,9 +54,11 @@ public class ReleaseDetailViewModel
|
||||
Release = release;
|
||||
|
||||
// Resolve the playable track via the releaseId-filtered track page — an exact join, not a
|
||||
// title string (which collides across same-titled releases and breaks on rename). Session/Mix
|
||||
// releases carry a single track; take the first. A release with no streamable track simply
|
||||
// leaves Track null (the detail page hides the play affordance).
|
||||
// title string (which collides across same-titled releases and breaks on rename). The public
|
||||
// page addresses the release by EntryKey; the track→release join stays on the internal int
|
||||
// FK (Phase 11 §3e leaves internal joins on the int PK), so use the resolved release.Id here.
|
||||
// Session/Mix releases carry a single track; take the first. A release with no streamable
|
||||
// track simply leaves Track null (the detail page hides the play affordance).
|
||||
var trackResult = await _trackData.GetPage(
|
||||
pageNumber: 1, pageSize: 1, releaseId: release.Id);
|
||||
if (trackResult is { Success: true, Value: { Items: { } items } })
|
||||
|
||||
Reference in New Issue
Block a user