@if (SelectedTrack is null)
{
Select a track from the list to edit its details.
}
else
{
@if (ShowTrackName)
{
}
@if (SelectedTrack.Id.HasValue)
{
@(string.IsNullOrEmpty(SelectedTrack.OriginalFileName) ? "—" : SelectedTrack.OriginalFileName)
Existing track — audio is not editable.
}
else
{
@if (SelectedTrack.WavFile is { } wav)
{
@wav.Name (@FormatBytes(wav.Size))
}
else
{
No WAV file selected.
}
}
@if (SelectedTrack.Status == BatchRowStatus.Failed)
{
@SelectedTrack.ErrorMessage
}
}
@code {
[Parameter] public BatchRowModel? SelectedTrack { get; set; }
[Parameter] public bool Disabled { get; set; }
[Parameter] public EventCallback TrackNameChanged { get; set; }
///
/// 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.
///
[Parameter] public bool ShowTrackName { get; set; } = true;
private static string FormatBytes(long bytes)
{
const long KB = 1024;
const long MB = KB * 1024;
const long GB = MB * 1024;
if (bytes >= GB) return $"{bytes / (double)GB:F2} GB";
if (bytes >= MB) return $"{bytes / (double)MB:F2} MB";
if (bytes >= KB) return $"{bytes / (double)KB:F2} KB";
return $"{bytes} bytes";
}
}