Collapse BatchEdit to single-track form for Session/Mix media
Mirror BatchUpload.OnMediumChanged: switching to Session/Mix trims the track list to one row and hides the add-track affordance, enforcing the §9.3 single-track invariant on the edit path. Cut releases unchanged.
This commit is contained in:
@@ -53,15 +53,15 @@
|
||||
</MudStack>
|
||||
}
|
||||
|
||||
@* Session/Mix are single-track releases (§9.3): suppress the add-track affordance and keep the
|
||||
list collapsed to one row — OnMediumChanged trims rows 2..n when the medium switches to a
|
||||
single-track medium, mirroring BatchUpload's same-named collapse. Cut keeps the full list. *@
|
||||
<MudGrid>
|
||||
<MudItem xs="12" md="5">
|
||||
@* The medium write path persists _medium on save (9.5.B). BatchEdit still shows the full
|
||||
multi-track list for every medium; collapsing to a single-track slot for Session/Mix
|
||||
(matching BatchUpload's @if (_medium == ReleaseMedium.Cut) guard) is deferred form-shape
|
||||
work, not part of the write-path wiring. *@
|
||||
<BatchTrackList Tracks="_tracks"
|
||||
@bind-SelectedIndex="_selectedIndex"
|
||||
Disabled="_saving"
|
||||
AllowNewTracks="@(_medium == ReleaseMedium.Cut)"
|
||||
OnWavFilesSelected="HandleWavFilesSelected"
|
||||
OnMoveUp="MoveUp"
|
||||
OnMoveDown="MoveDown"
|
||||
@@ -135,7 +135,20 @@
|
||||
// The medium selector drives ReleaseType visibility and is persisted on save: every UpdateAsync /
|
||||
// UploadTrackAsync call below passes _medium, and PUT api/track/meta resets ReleaseType to its
|
||||
// default server-side for a non-Cut medium.
|
||||
private void OnMediumChanged(ReleaseMedium medium) => _medium = medium;
|
||||
//
|
||||
// Switching to a single-track medium (Session/Mix) collapses any multi-track list to the first row
|
||||
// so the single-track invariant (§9.3) holds before save — the same collapse BatchUpload.OnMediumChanged
|
||||
// performs. Dropping rows 2..n is an in-memory trim only; existing tracks are not deleted server-side
|
||||
// (RemoveRow owns deletion), so the hidden rows simply fall out of this edit session.
|
||||
private void OnMediumChanged(ReleaseMedium medium)
|
||||
{
|
||||
_medium = medium;
|
||||
if (medium != ReleaseMedium.Cut && _tracks.Count > 1)
|
||||
{
|
||||
_tracks.RemoveRange(1, _tracks.Count - 1);
|
||||
_selectedIndex = _tracks.Count > 0 ? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user