diff --git a/DeepDrftManager/Components/Pages/Tracks/AlbumHeaderFields.razor b/DeepDrftManager/Components/Pages/Tracks/AlbumHeaderFields.razor index 9ca6ca1..113c85d 100644 --- a/DeepDrftManager/Components/Pages/Tracks/AlbumHeaderFields.razor +++ b/DeepDrftManager/Components/Pages/Tracks/AlbumHeaderFields.razor @@ -68,6 +68,7 @@ @bind-ReleaseType="ReleaseTypeBinding" HeroImageFile="HeroImageFile" HeroImageFileChanged="HeroImageFileChanged" + AllowHeroUpload="AllowHeroUpload" Disabled="Disabled" /> @@ -92,6 +93,10 @@ [Parameter] public IBrowserFile? HeroImageFile { get; set; } [Parameter] public EventCallback HeroImageFileChanged { get; set; } + // Gates the hero file picker in SessionFields (threaded to MediumFields → SessionFields). + // Set true only on the BatchUpload create path; leave false/absent on all edit paths. + [Parameter] public bool AllowHeroUpload { 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; } diff --git a/DeepDrftManager/Components/Pages/Tracks/BatchUpload.razor b/DeepDrftManager/Components/Pages/Tracks/BatchUpload.razor index a091edf..66ee1ea 100644 --- a/DeepDrftManager/Components/Pages/Tracks/BatchUpload.razor +++ b/DeepDrftManager/Components/Pages/Tracks/BatchUpload.razor @@ -27,6 +27,7 @@ MediumChanged="OnMediumChanged" @bind-SelectedImageFile="_selectedImageFile" @bind-HeroImageFile="_heroImageFile" + AllowHeroUpload="true" Disabled="_uploading" /> @if (_medium == ReleaseMedium.Cut) @@ -72,6 +73,11 @@ @_errorMessage } + @if (!string.IsNullOrEmpty(_warningMessage)) + { + @_warningMessage + } + break; case ReleaseMedium.Mix: @@ -49,5 +50,9 @@ [Parameter] public IBrowserFile? HeroImageFile { get; set; } [Parameter] public EventCallback HeroImageFileChanged { get; set; } + // Gates the hero file picker in SessionFields. True on the BatchUpload create path; + // false/absent on all edit paths so SessionFields falls back to the guidance alert. + [Parameter] public bool AllowHeroUpload { get; set; } + [Parameter] public bool Disabled { get; set; } } diff --git a/DeepDrftManager/Components/Pages/Tracks/SessionFields.razor b/DeepDrftManager/Components/Pages/Tracks/SessionFields.razor index e62e24a..cee4777 100644 --- a/DeepDrftManager/Components/Pages/Tracks/SessionFields.razor +++ b/DeepDrftManager/Components/Pages/Tracks/SessionFields.razor @@ -1,48 +1,65 @@ @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. - +@* 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 { } selectedHero) + { + + Selected: @selectedHero.Name + + + } + else + { + No hero image — optional, but recommended. + } - - @if (HeroImageFile is not null) - { - Will upload on submit. - } - - - + + @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);