137 lines
7.1 KiB
Plaintext
137 lines
7.1 KiB
Plaintext
@using System.Text
|
|
@using WatchIt.Website.Components.Subcomponents.Common
|
|
@using WatchIt.Website.Components.Panels.Common
|
|
@using WatchIt.Website.Components.Panels.Pages.MediumPage
|
|
@using Blazorise
|
|
@using Blazorise.Snackbar
|
|
@using Refit
|
|
@using WatchIt.DTO.Models.Controllers.People.Person
|
|
@using WatchIt.DTO.Models.Controllers.Roles.Role.Query
|
|
@using WatchIt.DTO.Models.Controllers.Roles.Role.Response
|
|
@using WatchIt.DTO.Models.Controllers.Roles.RoleActorType
|
|
@using WatchIt.DTO.Models.Controllers.Roles.RoleCreatorType
|
|
|
|
@inherits Page
|
|
|
|
@page "/media/{id:long}"
|
|
|
|
@{
|
|
StringBuilder sb = new StringBuilder(" - WatchIt");
|
|
|
|
if (!_loaded) sb.Insert(0, "Loading...");
|
|
else if (_data is null) sb.Insert(0, "Error");
|
|
else
|
|
{
|
|
if (_data.ReleaseDate.HasValue) sb.Insert(0, $" ({_data.ReleaseDate.Value.Year})");
|
|
sb.Insert(0, _data.Title);
|
|
}
|
|
|
|
<PageTitle>@(sb.ToString())</PageTitle>
|
|
}
|
|
|
|
|
|
|
|
@if (!_loaded)
|
|
{
|
|
<div class="m-5">
|
|
<Loading/>
|
|
</div>
|
|
}
|
|
else if (_data is null)
|
|
{
|
|
<ErrorPanel ErrorMessage="@($"Medium with ID {Id} was not found")"/>
|
|
}
|
|
else
|
|
{
|
|
<div class="vstack gap-default">
|
|
<ItemPageHeaderPanel Name="@(_data.Title)"
|
|
Description="@(_data.Description)"
|
|
Subname="@(_data.OriginalTitle)"
|
|
Poster="@(_data.Picture)"
|
|
PosterPlaceholder="/assets/placeholders/medium.png"/>
|
|
<div class="container-grid">
|
|
<div class="row gx-default">
|
|
<div class="col">
|
|
<MetadataPanel Data="@(_data)"/>
|
|
</div>
|
|
<div class="col-auto">
|
|
<RatingPanel Data="@(_data)"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<Tabs Pills
|
|
RenderMode="TabsRenderMode.LazyLoad"
|
|
SelectedTab="actors"
|
|
Class="panel panel-menu panel-background-menu justify-content-center">
|
|
<Items>
|
|
<Tab Name="actors">Actors</Tab>
|
|
<Tab Name="creators">Creators</Tab>
|
|
</Items>
|
|
<Content>
|
|
<TabPanel Name="actors">
|
|
<RolesPanel TRole="RoleActorResponse"
|
|
TRoleParent="PersonResponse"
|
|
Title="Actors"
|
|
RoleParents="@(_people)"
|
|
ParentName="People"
|
|
ParentFunc="@((role, parents) => parents.First(x => x.Id == role.PersonId))"
|
|
NameFunc="@((_, parent) => parent.Name)"
|
|
AdditionalInfoFunc="@((role, _) => $" as {role.Name}")"
|
|
PicturePlaceholder="/assets/placeholders/person.png"
|
|
PictureFunc="@((_, parent) => Task.FromResult(parent.Picture))"
|
|
UrlFunc="@((_, parent) => $"people/{parent.Id}")"
|
|
GlobalRatingFunc="@((_, parent) => parent.Rating)"
|
|
GetRoleTypesMethod="@(async () =>
|
|
{
|
|
IApiResponse<IEnumerable<RoleActorTypeResponse>> response = await RolesClient.GetRoleActorTypes();
|
|
if (!response.IsSuccessful)
|
|
{
|
|
await Base.SnackbarStack.PushAsync("An error occured. Actor role types could not be loaded.", SnackbarColor.Danger);
|
|
}
|
|
return response.Content;
|
|
})"
|
|
GetRolesMethod="@(async () =>
|
|
{
|
|
IApiResponse<IEnumerable<RoleActorResponse>> response = await RolesClient.GetRoleActors(new RoleActorFilterQuery { MediumId = _data.Id });
|
|
if (!response.IsSuccessful)
|
|
{
|
|
await Base.SnackbarStack.PushAsync("An error occured. Actor roles could not be loaded.", SnackbarColor.Danger);
|
|
}
|
|
return response.Content;
|
|
})"/>
|
|
</TabPanel>
|
|
<TabPanel Name="creators">
|
|
<RolesPanel TRole="RoleCreatorResponse"
|
|
TRoleParent="PersonResponse"
|
|
Title="Creators"
|
|
RoleParents="@(_people)"
|
|
ParentName="People"
|
|
ParentFunc="@((role, parents) => parents.First(x => x.Id == role.PersonId))"
|
|
NameFunc="@((_, parent) => parent.Name)"
|
|
PicturePlaceholder="/assets/placeholders/person.png"
|
|
PictureFunc="@((_, parent) => Task.FromResult(parent.Picture))"
|
|
UrlFunc="@((_, parent) => $"people/{parent.Id}")"
|
|
GlobalRatingFunc="@((_, parent) => parent.Rating)"
|
|
GetRoleTypesMethod="@(async () =>
|
|
{
|
|
IApiResponse<IEnumerable<RoleCreatorTypeResponse>> response = await RolesClient.GetRoleCreatorTypes();
|
|
if (!response.IsSuccessful)
|
|
{
|
|
await Base.SnackbarStack.PushAsync("An error occured. Creator role types could not be loaded.", SnackbarColor.Danger);
|
|
}
|
|
return response.Content;
|
|
})"
|
|
GetRolesMethod="@(async () =>
|
|
{
|
|
IApiResponse<IEnumerable<RoleCreatorResponse>> response = await RolesClient.GetRoleCreators(new RoleCreatorFilterQuery { MediumId = _data.Id });
|
|
if (!response.IsSuccessful)
|
|
{
|
|
await Base.SnackbarStack.PushAsync("An error occured. Creator roles could not be loaded.", SnackbarColor.Danger);
|
|
}
|
|
return response.Content;
|
|
})"/>
|
|
</TabPanel>
|
|
</Content>
|
|
</Tabs>
|
|
</div>
|
|
} |