407ed90341
fix: TrackNumber sort case, stale _imagePath reset, skip Done rows on retry in BatchEdit
61 lines
2.2 KiB
Plaintext
61 lines
2.2 KiB
Plaintext
@if (SelectedTrack is null)
|
|
{
|
|
<MudText Typo="Typo.body1" Color="Color.Default">Select a track from the list to edit its details.</MudText>
|
|
}
|
|
else
|
|
{
|
|
<MudStack Spacing="4">
|
|
<MudTextField Value="SelectedTrack.TrackName"
|
|
ValueChanged="@((string v) => TrackNameChanged.InvokeAsync(v))"
|
|
T="string"
|
|
Label="Track Name"
|
|
Required="true"
|
|
RequiredError="Track Name is required"
|
|
Variant="Variant.Outlined"
|
|
Disabled="Disabled" />
|
|
|
|
@if (SelectedTrack.Id.HasValue)
|
|
{
|
|
<MudField Label="Original File" Variant="Variant.Outlined" InnerPadding="false">
|
|
<MudText Typo="Typo.body2">@(string.IsNullOrEmpty(SelectedTrack.OriginalFileName) ? "—" : SelectedTrack.OriginalFileName)</MudText>
|
|
<MudText Typo="Typo.caption" Color="Color.Default">Existing track — audio is not editable.</MudText>
|
|
</MudField>
|
|
}
|
|
else
|
|
{
|
|
<MudField Label="WAV File" Variant="Variant.Outlined" InnerPadding="false">
|
|
@if (SelectedTrack.WavFile is { } wav)
|
|
{
|
|
<MudText Typo="Typo.body2">@wav.Name (@FormatBytes(wav.Size))</MudText>
|
|
}
|
|
else
|
|
{
|
|
<MudText Typo="Typo.body2" Color="Color.Error">No WAV file selected.</MudText>
|
|
}
|
|
</MudField>
|
|
}
|
|
|
|
@if (SelectedTrack.Status == BatchRowStatus.Failed)
|
|
{
|
|
<MudAlert Severity="Severity.Error">@SelectedTrack.ErrorMessage</MudAlert>
|
|
}
|
|
</MudStack>
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public BatchRowModel? SelectedTrack { get; set; }
|
|
[Parameter] public bool Disabled { get; set; }
|
|
[Parameter] public EventCallback<string> TrackNameChanged { get; set; }
|
|
|
|
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";
|
|
}
|
|
}
|