98 lines
3.9 KiB
Plaintext
98 lines
3.9 KiB
Plaintext
@page "/sessions/{EntryKey}"
|
|
@using DeepDrftModels.DTOs
|
|
@using DeepDrftPublic.Client.Controls
|
|
@using DeepDrftPublic.Client.Services
|
|
@inherits ReleaseDetailBase
|
|
|
|
<PageTitle>@(ViewModel.Release?.Title ?? "Session") - DeepDrft</PageTitle>
|
|
|
|
@if (ViewModel.IsLoading)
|
|
{
|
|
<div class="deepdrft-track-detail-container">
|
|
<div class="deepdrft-track-detail-cover">
|
|
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Width="100%" Height="320px" />
|
|
</div>
|
|
<div class="deepdrft-track-detail-masthead">
|
|
<MudSkeleton SkeletonType="SkeletonType.Text" Width="70%" Height="56px" />
|
|
<MudSkeleton SkeletonType="SkeletonType.Text" Width="40%" Height="32px" />
|
|
</div>
|
|
</div>
|
|
}
|
|
else if (ViewModel.NotFound || ViewModel.Release is null)
|
|
{
|
|
<div class="deepdrft-track-detail-container">
|
|
<div class="deepdrft-track-detail-masthead">
|
|
<MudText Typo="Typo.h4" Align="Align.Center">Session not found.</MudText>
|
|
<div class="d-flex justify-center mt-4">
|
|
<MudButton Href="/sessions"
|
|
Variant="Variant.Text"
|
|
StartIcon="@Icons.Material.Filled.ArrowBack">
|
|
All sessions
|
|
</MudButton>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
var release = ViewModel.Release;
|
|
var heroKey = release.SessionMetadata?.HeroImageEntryKey;
|
|
// Hero image precedence: the session's dedicated hero, then the release cover, then a placeholder.
|
|
var heroImage = !string.IsNullOrEmpty(heroKey) ? heroKey : release.ImagePath;
|
|
|
|
<MudContainer MaxWidth="MaxWidth.Large" Class="session-detail-page">
|
|
|
|
<MudLink Href="/sessions" Typo="Typo.body2" Class="deepdrft-track-detail-back">
|
|
← All sessions
|
|
</MudLink>
|
|
|
|
@* The overlay shows the cover thumbnail only when it differs from the resolved hero image —
|
|
when there is no dedicated hero, heroImage already falls back to release.ImagePath, so the
|
|
thumb would duplicate the background. That logic lives in ReleaseHeroOverlay. *@
|
|
<ReleaseHeroOverlay HeroImageKey="@heroImage"
|
|
CoverThumbKey="@release.ImagePath"
|
|
PlaceholderIcon="@Icons.Material.Filled.Piano"
|
|
Title="@release.Title"
|
|
Artist="@release.Artist"
|
|
Genre="@release.Genre"
|
|
ReleaseDate="@release.ReleaseDate">
|
|
<ShareContent>
|
|
@* Release-mode share: copies the canonical /sessions/{entryKey} URL, not a single track (§3b). *@
|
|
<SharePopover ReleaseEntryKey="@release.EntryKey" ReleaseMedium="@release.Medium" />
|
|
</ShareContent>
|
|
<PlayContent>
|
|
@if (ViewModel.Track is not null)
|
|
{
|
|
<PlayStateIcon Track="@ViewModel.Track" Size="Size.Large" Color="Color.Secondary" OnToggle="@PlayTrack" />
|
|
}
|
|
</PlayContent>
|
|
</ReleaseHeroOverlay>
|
|
|
|
</MudContainer>
|
|
}
|
|
|
|
@code {
|
|
protected override string PersistKey => "session-detail";
|
|
|
|
[CascadingParameter] public IStreamingPlayerService? PlayerService { get; set; }
|
|
|
|
// Mirrors the play-toggle wiring the shared scaffold owns. Session detail composes the player
|
|
// affordance directly (it diverges from ReleaseDetailScaffold for the overlay layout), so the
|
|
// toggle logic lives here: toggle if this track is already active, otherwise start a fresh stream.
|
|
private async Task PlayTrack()
|
|
{
|
|
var track = ViewModel.Track;
|
|
if (track is null || PlayerService is null) return;
|
|
|
|
var isThisTrack = PlayerService.CurrentTrack?.Id == track.Id;
|
|
if (isThisTrack && (PlayerService.IsPlaying || PlayerService.IsPaused))
|
|
{
|
|
await PlayerService.TogglePlayPause();
|
|
}
|
|
else
|
|
{
|
|
await PlayerService.SelectTrackStreaming(track);
|
|
}
|
|
}
|
|
}
|