62dd9d5c03
Edit forms (BatchEdit/TrackEdit/TrackNew) show the guidance alert instead of an inert picker, via an AllowHeroUpload flag. Missing-hero nudge is Severity.Warning; null-ReleaseId hero drop is now logged.
69 lines
3.1 KiB
Plaintext
69 lines
3.1 KiB
Plaintext
@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)
|
|
{
|
|
<MudItem xs="12">
|
|
<MudField Label="Hero Image" Variant="Variant.Outlined" InnerPadding="false">
|
|
<MudStack Spacing="3">
|
|
<MudText Typo="Typo.body2" Color="Color.Default">
|
|
Sessions are single-track live releases. The hero image is the session's primary visual identity.
|
|
</MudText>
|
|
|
|
@if (HeroImageFile is { } selectedHero)
|
|
{
|
|
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
|
<MudText Typo="Typo.body2" Color="Color.Default">Selected: @selectedHero.Name</MudText>
|
|
<MudIconButton Icon="@Icons.Material.Filled.Clear"
|
|
Color="Color.Error"
|
|
Size="Size.Small"
|
|
Disabled="Disabled"
|
|
OnClick="ClearHeroFile"
|
|
aria-label="Cancel hero image selection" />
|
|
</MudStack>
|
|
}
|
|
else
|
|
{
|
|
<MudText Typo="Typo.body2" Color="Color.Default">No hero image — optional, but recommended.</MudText>
|
|
}
|
|
|
|
<InputFile OnChange="HandleHeroFileSelected" accept="image/*" disabled="@Disabled" />
|
|
@if (HeroImageFile is not null)
|
|
{
|
|
<MudText Typo="Typo.caption">Will upload on submit.</MudText>
|
|
}
|
|
</MudStack>
|
|
</MudField>
|
|
</MudItem>
|
|
}
|
|
else
|
|
{
|
|
<MudItem xs="12">
|
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Outlined">
|
|
Sessions are single-track live releases. After upload, set the hero image from the
|
|
<strong>Release Archive → Sessions</strong> browser.
|
|
</MudAlert>
|
|
</MudItem>
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public IBrowserFile? HeroImageFile { get; set; }
|
|
[Parameter] public EventCallback<IBrowserFile?> 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);
|
|
}
|