feat(player): add append-only "Add to Queue" buttons beside detail-page play affordances
Cut header (release → EnqueueRange), Cut track rows + Session/Mix hero (track → Enqueue). Reuses existing engine path; add is not play.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
@namespace DeepDrftPublic.Client.Controls
|
||||
@using DeepDrftModels.DTOs
|
||||
@using DeepDrftPublic.Client.Services
|
||||
|
||||
@* Append-only "Add to Queue" affordance placed beside a play control. Add is NOT play: it calls the
|
||||
cascaded IQueueService's Enqueue/EnqueueRange (which append without disturbing current playback and
|
||||
leave a coherent CurrentIndex on a first add into a dormant queue) — never PlayRelease/Start/Select.
|
||||
Track mode (Track set) appends a single track; release mode (ReleaseTracks set) appends the whole
|
||||
ordered list. Reads queue state from the layout-level cascade (C1); owns no data fetch. *@
|
||||
|
||||
<MudTooltip Text="@Tooltip">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.PlaylistAdd"
|
||||
Color="@Color"
|
||||
Size="@Size"
|
||||
Disabled="@(Queue is null || !RendererInfo.IsInteractive)"
|
||||
OnClick="@AddToQueue" />
|
||||
</MudTooltip>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] public IQueueService? Queue { get; set; }
|
||||
|
||||
/// <summary>Single track to append (track mode). Mutually exclusive with <see cref="ReleaseTracks"/>.</summary>
|
||||
[Parameter] public TrackDto? Track { get; set; }
|
||||
|
||||
/// <summary>Ordered release tracks to append (release mode). Mutually exclusive with <see cref="Track"/>.</summary>
|
||||
[Parameter] public IReadOnlyList<TrackDto>? ReleaseTracks { get; set; }
|
||||
|
||||
[Parameter] public Size Size { get; set; } = Size.Medium;
|
||||
[Parameter] public Color Color { get; set; } = Color.Secondary;
|
||||
|
||||
private string Tooltip => ReleaseTracks is not null ? "Add release to queue" : "Add to queue";
|
||||
|
||||
private void AddToQueue()
|
||||
{
|
||||
if (Queue is null) return;
|
||||
|
||||
if (ReleaseTracks is not null)
|
||||
{
|
||||
Queue.EnqueueRange(ReleaseTracks);
|
||||
}
|
||||
else if (Track is not null)
|
||||
{
|
||||
Queue.Enqueue(Track);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user