Files
deepdrft/DeepDrftManager/Components/Pages/Tracks/MediumFields.razor
T
daniel-c-harvey 4701804594 feat(cms): compose Session hero image into the upload form (8.F)
Session upload now carries a deferred hero-image input; the submit handler
creates the release then POSTs the held hero to the existing resource-addressed
endpoint. Hero is optional with a non-blocking warn-if-missing gate. The
per-row hero upload in CmsSessionBrowser remains the replace/correct path.
2026-06-13 20:46:46 -04:00

54 lines
2.1 KiB
Plaintext

@using DeepDrftModels.Enums
@using Microsoft.AspNetCore.Components.Forms
@* The single dispatch point for medium-conditional form fields. All five upload/edit forms embed this
one component; the @switch below is the ONLY place medium-specific form shape is decided. Adding a
medium is one new section component + one new switch arm here — nowhere else. *@
<MudGrid>
<MudItem xs="12" sm="6">
<MudSelect T="ReleaseMedium"
Value="Medium"
ValueChanged="@(v => MediumChanged.InvokeAsync(v))"
Label="Medium"
Variant="Variant.Outlined"
Disabled="Disabled">
@foreach (var medium in Enum.GetValues<ReleaseMedium>())
{
<MudSelectItem T="ReleaseMedium" Value="medium">@medium</MudSelectItem>
}
</MudSelect>
</MudItem>
@switch (Medium)
{
case ReleaseMedium.Cut:
<CutFields ReleaseType="ReleaseType"
ReleaseTypeChanged="ReleaseTypeChanged"
Disabled="Disabled" />
break;
case ReleaseMedium.Session:
<SessionFields HeroImageFile="HeroImageFile"
HeroImageFileChanged="HeroImageFileChanged"
Disabled="Disabled" />
break;
case ReleaseMedium.Mix:
<MixFields />
break;
}
</MudGrid>
@code {
[Parameter] public ReleaseMedium Medium { get; set; } = ReleaseMedium.Cut;
[Parameter] public EventCallback<ReleaseMedium> MediumChanged { get; set; }
// Cut-only — bound through to CutFields. Ignored for Session/Mix.
[Parameter] public ReleaseType ReleaseType { get; set; } = ReleaseType.Single;
[Parameter] public EventCallback<ReleaseType> ReleaseTypeChanged { get; set; }
// Session-only — the held hero-image file, uploaded after create. Ignored for Cut/Mix.
[Parameter] public IBrowserFile? HeroImageFile { get; set; }
[Parameter] public EventCallback<IBrowserFile?> HeroImageFileChanged { get; set; }
[Parameter] public bool Disabled { get; set; }
}