Merge p9-w8-8l-name-collapse into dev (8.L: collapse release/track name for single-track media)

This commit is contained in:
daniel-c-harvey
2026-06-13 20:07:52 -04:00
3 changed files with 34 additions and 12 deletions
@@ -72,6 +72,7 @@
<MudPaper Class="pa-4" Elevation="2"> <MudPaper Class="pa-4" Elevation="2">
<BatchTrackDetail SelectedTrack="@(_selectedIndex >= 0 && _tracks.Count > 0 ? _tracks[_selectedIndex] : null)" <BatchTrackDetail SelectedTrack="@(_selectedIndex >= 0 && _tracks.Count > 0 ? _tracks[_selectedIndex] : null)"
Disabled="_saving" Disabled="_saving"
ShowTrackName="@(!MediumRules.CardinalityOf(_medium).IsSingleTrack)"
TrackNameChanged="@(name => { if (_selectedIndex >= 0) { _tracks[_selectedIndex].TrackName = name; } })" /> TrackNameChanged="@(name => { if (_selectedIndex >= 0) { _tracks[_selectedIndex].TrackName = name; } })" />
</MudPaper> </MudPaper>
</MudItem> </MudItem>
@@ -337,6 +338,14 @@
var album = string.IsNullOrWhiteSpace(_albumName) ? null : _albumName; var album = string.IsNullOrWhiteSpace(_albumName) ? null : _albumName;
var genre = string.IsNullOrWhiteSpace(_genre) ? null : _genre; var genre = string.IsNullOrWhiteSpace(_genre) ? null : _genre;
// For single-track media (Session/Mix) the track name is derived from the Release Name —
// no separate Track Name editor is shown. Sync here so changes to the Release Name always
// carry through to the stored track name.
if (MediumRules.CardinalityOf(_medium).IsSingleTrack && _tracks.Count > 0)
{
_tracks[0].TrackName = _albumName;
}
_imagePath = null; // Clear any stale uploaded path from a prior partial attempt. _imagePath = null; // Clear any stale uploaded path from a prior partial attempt.
_saving = true; _saving = true;
_processedCount = 0; _processedCount = 0;
@@ -5,14 +5,17 @@
else else
{ {
<MudStack Spacing="4"> <MudStack Spacing="4">
<MudTextField Value="SelectedTrack.TrackName" @if (ShowTrackName)
ValueChanged="@((string v) => TrackNameChanged.InvokeAsync(v))" {
T="string" <MudTextField Value="SelectedTrack.TrackName"
Label="Track Name" ValueChanged="@((string v) => TrackNameChanged.InvokeAsync(v))"
Required="true" T="string"
RequiredError="Track Name is required" Label="Track Name"
Variant="Variant.Outlined" Required="true"
Disabled="Disabled" /> RequiredError="Track Name is required"
Variant="Variant.Outlined"
Disabled="Disabled" />
}
@if (SelectedTrack.Id.HasValue) @if (SelectedTrack.Id.HasValue)
{ {
@@ -46,6 +49,12 @@ else
[Parameter] public BatchRowModel? SelectedTrack { get; set; } [Parameter] public BatchRowModel? SelectedTrack { get; set; }
[Parameter] public bool Disabled { get; set; } [Parameter] public bool Disabled { get; set; }
[Parameter] public EventCallback<string> TrackNameChanged { get; set; } [Parameter] public EventCallback<string> TrackNameChanged { get; set; }
/// <summary>
/// When false (single-track Session/Mix), the Track Name field is suppressed — the name is
/// derived from the Release Name by the parent form and never entered independently.
/// Defaults to true so the Cut multi-track path is unchanged.
/// </summary>
[Parameter] public bool ShowTrackName { get; set; } = true;
private static string FormatBytes(long bytes) private static string FormatBytes(long bytes)
{ {
@@ -59,10 +59,7 @@
<InputFile OnChange="HandleSingleWavSelected" accept=".wav,audio/wav,audio/x-wav" disabled="@_uploading" /> <InputFile OnChange="HandleSingleWavSelected" accept=".wav,audio/wav,audio/x-wav" disabled="@_uploading" />
@if (_tracks.Count > 0) @if (_tracks.Count > 0)
{ {
<MudTextField @bind-Value="_tracks[0].TrackName" @* Track name is derived from the Release Name for Session/Mix — no separate input. *@
Label="Track Name"
Variant="Variant.Outlined"
Disabled="_uploading" />
<MudText Typo="Typo.caption">Selected: @(_tracks[0].WavFile?.Name ?? "—")</MudText> <MudText Typo="Typo.caption">Selected: @(_tracks[0].WavFile?.Name ?? "—")</MudText>
} }
</MudStack> </MudStack>
@@ -247,6 +244,13 @@
return; return;
} }
// For single-track media (Session/Mix) the track name is derived from the Release Name —
// no separate Track Name input is shown. Sync here so the stored name always matches.
if (MediumRules.CardinalityOf(_medium).IsSingleTrack && _tracks.Count > 0)
{
_tracks[0].TrackName = _albumName;
}
_imagePath = null; // Clear any stale uploaded path from a prior partial attempt. _imagePath = null; // Clear any stale uploaded path from a prior partial attempt.
_uploading = true; _uploading = true;
_uploadedCount = 0; _uploadedCount = 0;