@using Microsoft.AspNetCore.Components.Forms
@* Session-medium fields. When AllowHeroUpload is true (BatchUpload create path), the hero image
file picker is shown — the file is held by the parent and POSTed after the release is created.
When false (edit paths: BatchEdit, TrackEdit, TrackNew), the original guidance alert is rendered
instead, directing the admin to the Sessions browser per-row replace action. This gate prevents
a dead/inert control on edit forms that do not wire the hero callbacks. *@
@if (AllowHeroUpload)
{
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.
}
}
else
{
Sessions are single-track live releases. After upload, set the hero image from the
Release Archive → Sessions browser.
}
@code {
[Parameter] public IBrowserFile? HeroImageFile { get; set; }
[Parameter] public EventCallback HeroImageFileChanged { get; set; }
[Parameter] public bool Disabled { get; set; }
// When true (BatchUpload create path), render the hero file picker.
// When false/absent (edit paths), render the guidance alert directing the admin to the
// Sessions browser — no dead control where callbacks are unwired.
[Parameter] public bool AllowHeroUpload { get; set; }
private Task HandleHeroFileSelected(InputFileChangeEventArgs e) =>
HeroImageFileChanged.InvokeAsync(e.File);
private Task ClearHeroFile() =>
HeroImageFileChanged.InvokeAsync(null);
}