@using Microsoft.AspNetCore.Components.Forms
@* Session-medium fields. The hero image is resource-addressed (POST api/release/{id}/session/hero-image)
and therefore cannot be uploaded until the release exists. The file is selected here, held by the
parent form, and uploaded after the create call returns a release id — the same deferred-upload
pattern AlbumHeaderFields uses for cover art ("Will upload on submit"). The hero is optional; the
parent warns (does not block) when a Session is submitted without one. *@
Sessions are single-track live releases. The hero image is the session's primary visual identity.
@if (HeroImageFile is { } selectedHero)
{
Selected: @selectedHero.Name
}
else
{
No hero image — optional, but recommended.
}
@if (HeroImageFile is not null)
{
Will upload on submit.
}
@code {
[Parameter] public IBrowserFile? HeroImageFile { get; set; }
[Parameter] public EventCallback HeroImageFileChanged { get; set; }
[Parameter] public bool Disabled { get; set; }
private Task HandleHeroFileSelected(InputFileChangeEventArgs e) =>
HeroImageFileChanged.InvokeAsync(e.File);
private Task ClearHeroFile() =>
HeroImageFileChanged.InvokeAsync(null);
}