mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* update tv show ui * update tv season ui * list episode details on tv season page * remove episode page * remove breadcrumbs * move home link * code cleanup * update screenshotspull/57/head
19 changed files with 245 additions and 302 deletions
@ -1,4 +1,11 @@ |
|||||||
namespace ErsatzTV.Application.Television |
namespace ErsatzTV.Application.Television |
||||||
{ |
{ |
||||||
public record TelevisionSeasonViewModel(int Id, int ShowId, string Title, string Year, string Plot, string Poster); |
public record TelevisionSeasonViewModel( |
||||||
|
int Id, |
||||||
|
int ShowId, |
||||||
|
string Title, |
||||||
|
string Year, |
||||||
|
string Name, |
||||||
|
string Poster, |
||||||
|
string FanArt); |
||||||
} |
} |
||||||
|
|||||||
@ -1,4 +1,4 @@ |
|||||||
namespace ErsatzTV.Application.Television |
namespace ErsatzTV.Application.Television |
||||||
{ |
{ |
||||||
public record TelevisionShowViewModel(int Id, string Title, string Year, string Plot, string Poster); |
public record TelevisionShowViewModel(int Id, string Title, string Year, string Plot, string Poster, string FanArt); |
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,22 @@ |
|||||||
|
using System; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using Microsoft.AspNetCore.Components; |
||||||
|
using Microsoft.JSInterop; |
||||||
|
|
||||||
|
namespace ErsatzTV.Extensions |
||||||
|
{ |
||||||
|
public static class NavigationManagerExtensions |
||||||
|
{ |
||||||
|
public static ValueTask NavigateToFragmentAsync(this NavigationManager navigationManager, IJSRuntime jSRuntime) |
||||||
|
{ |
||||||
|
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri); |
||||||
|
|
||||||
|
if (uri.Fragment.Length == 0) |
||||||
|
{ |
||||||
|
return default; |
||||||
|
} |
||||||
|
|
||||||
|
return jSRuntime.InvokeVoidAsync("blazorHelpers.scrollToFragment", uri.Fragment.Substring(1)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -1,84 +0,0 @@ |
|||||||
@page "/media/tv/episodes/{EpisodeId:int}" |
|
||||||
@using ErsatzTV.Application.Television |
|
||||||
@using ErsatzTV.Application.Television.Queries |
|
||||||
@using ErsatzTV.Application.MediaCollections |
|
||||||
@using ErsatzTV.Application.MediaCollections.Commands |
|
||||||
@inject IMediator Mediator |
|
||||||
@inject IDialogService Dialog |
|
||||||
@inject NavigationManager NavigationManager |
|
||||||
|
|
||||||
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8"> |
|
||||||
<MudContainer MaxWidth="MaxWidth.Large"> |
|
||||||
<MudBreadcrumbs Items="_breadcrumbs" Class="mb-6"></MudBreadcrumbs> |
|
||||||
<MudCard Class="mb-6"> |
|
||||||
<div style="display: flex; flex-direction: row;"> |
|
||||||
@if (!string.IsNullOrWhiteSpace(_episode.Poster)) |
|
||||||
{ |
|
||||||
<MudPaper style="display: flex; flex-direction: column"> |
|
||||||
<MudCardMedia Image="@($"/artwork/thumbnails/{_episode.Poster}")" Style="flex-grow: 1; height: 220px; width: 392px;"/> |
|
||||||
</MudPaper> |
|
||||||
} |
|
||||||
<MudCardContent Class="ml-3"> |
|
||||||
<div style="display: flex; flex-direction: column; height: 100%"> |
|
||||||
<MudText Typo="Typo.h4">@_episode.Title</MudText> |
|
||||||
<MudText Typo="Typo.subtitle1" Class="mb-6 mud-text-secondary">@_season.Plot</MudText> |
|
||||||
<MudText Style="flex-grow: 1">@_episode.Plot</MudText> |
|
||||||
<div class="mt-6"> |
|
||||||
<MudButton Variant="Variant.Filled" |
|
||||||
Color="Color.Primary" |
|
||||||
StartIcon="@Icons.Material.Filled.Add" |
|
||||||
OnClick="@AddToCollection"> |
|
||||||
Add To Collection |
|
||||||
</MudButton> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</MudCardContent> |
|
||||||
</div> |
|
||||||
</MudCard> |
|
||||||
</MudContainer> |
|
||||||
</MudContainer> |
|
||||||
|
|
||||||
@code { |
|
||||||
|
|
||||||
[Parameter] |
|
||||||
public int EpisodeId { get; set; } |
|
||||||
|
|
||||||
private TelevisionEpisodeViewModel _episode; |
|
||||||
private TelevisionSeasonViewModel _season; |
|
||||||
|
|
||||||
private List<BreadcrumbItem> _breadcrumbs; |
|
||||||
|
|
||||||
protected override Task OnParametersSetAsync() => RefreshData(); |
|
||||||
|
|
||||||
private async Task RefreshData() |
|
||||||
{ |
|
||||||
await Mediator.Send(new GetTelevisionEpisodeById(EpisodeId)) |
|
||||||
.IfSomeAsync(vm => _episode = vm); |
|
||||||
|
|
||||||
await Mediator.Send(new GetTelevisionSeasonById(_episode.SeasonId)) |
|
||||||
.IfSomeAsync(vm => _season = vm); |
|
||||||
|
|
||||||
_breadcrumbs = new List<BreadcrumbItem> |
|
||||||
{ |
|
||||||
new("TV Shows", "/media/tv/shows"), |
|
||||||
new($"{_season.Title} ({_season.Year})", $"/media/tv/shows/{_season.ShowId}"), |
|
||||||
new(_season.Plot, $"/media/tv/seasons/{_episode.SeasonId}"), |
|
||||||
new($"Episode {_episode.Episode}", null, true) |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
private async Task AddToCollection() |
|
||||||
{ |
|
||||||
var parameters = new DialogParameters { { "EntityType", "episode" }, { "EntityName", _episode.Title } }; |
|
||||||
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall }; |
|
||||||
|
|
||||||
IDialogReference dialog = Dialog.Show<AddToCollectionDialog>("Add To Collection", parameters, options); |
|
||||||
DialogResult result = await dialog.Result; |
|
||||||
if (!result.Cancelled && result.Data is MediaCollectionViewModel collection) |
|
||||||
{ |
|
||||||
await Mediator.Send(new AddEpisodeToCollection(collection.Id, EpisodeId)); |
|
||||||
NavigationManager.NavigateTo($"/media/collections/{collection.Id}"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
Before Width: | Height: | Size: 217 KiB After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 436 KiB |
Loading…
Reference in new issue