@using DeepDrftModels.Enums
@using Microsoft.AspNetCore.Components.Forms
@foreach (var rt in Enum.GetValues())
{
@rt
}
@if (SelectedImageFile is { } selectedImage)
{
Selected: @selectedImage.Name
}
else if (ExistingImagePreviewUrl is { } previewUrl)
{
Current cover art.
}
else
{
No cover art — optional.
}
@if (SelectedImageFile is not null)
{
Will upload on submit.
}
@code {
[Parameter] public string AlbumName { get; set; } = string.Empty;
[Parameter] public EventCallback AlbumNameChanged { get; set; }
[Parameter] public string Artist { get; set; } = string.Empty;
[Parameter] public EventCallback ArtistChanged { get; set; }
[Parameter] public string Genre { get; set; } = string.Empty;
[Parameter] public EventCallback GenreChanged { get; set; }
[Parameter] public string ReleaseDate { get; set; } = string.Empty;
[Parameter] public EventCallback ReleaseDateChanged { get; set; }
[Parameter] public ReleaseType ReleaseType { get; set; } = ReleaseType.Single;
[Parameter] public EventCallback ReleaseTypeChanged { get; set; }
[Parameter] public IBrowserFile? SelectedImageFile { get; set; }
[Parameter] public EventCallback SelectedImageFileChanged { get; set; }
// BatchEdit only: when set (and no new file picked), preview the release's current cover.
// The parent nulls this to drop the preview when the admin clears the existing cover.
[Parameter] public string? ExistingImagePath { get; set; }
[Parameter] public bool Disabled { get; set; }
// Relative path — resolves against the Manager's own origin, proxied by ImageProxyController.
private string? ExistingImagePreviewUrl =>
string.IsNullOrEmpty(ExistingImagePath)
? null
: $"/api/image/{Uri.EscapeDataString(ExistingImagePath)}";
private Task HandleImageFileSelected(InputFileChangeEventArgs e) =>
SelectedImageFileChanged.InvokeAsync(e.File);
private Task ClearSelectedFile() =>
SelectedImageFileChanged.InvokeAsync(null);
}