more refactoring around the details pages !wip

This commit is contained in:
Jamie Rees 2019-03-08 10:32:21 +00:00
parent 7bf7d558a3
commit b7f74d9f96
8 changed files with 267 additions and 272 deletions

View file

@ -5,6 +5,8 @@ import { MovieInformationPanelComponent } from "./movie/panels/movie-information
import { TvInformationPanelComponent } from "./tv/panels/tv-information-panel.component"; import { TvInformationPanelComponent } from "./tv/panels/tv-information-panel.component";
import { TopBannerComponent } from "./shared/top-banner/top-banner.component"; import { TopBannerComponent } from "./shared/top-banner/top-banner.component";
import { SocialIconsComponent } from "./shared/social-icons/social-icons.component"; import { SocialIconsComponent } from "./shared/social-icons/social-icons.component";
import { MediaPosterComponent } from "./shared/media-poster/media-poster.component";
import { CastCarouselComponent } from "./shared/cast-carousel/cast-carousel.component";
export const components: any[] = [ export const components: any[] = [
MovieDetailsComponent, MovieDetailsComponent,
@ -14,4 +16,6 @@ export const components: any[] = [
TvInformationPanelComponent, TvInformationPanelComponent,
TopBannerComponent, TopBannerComponent,
SocialIconsComponent, SocialIconsComponent,
MediaPosterComponent,
CastCarouselComponent,
]; ];

View file

@ -1,7 +1,7 @@
<div *ngIf="movie" class="dark-theme"> <div *ngIf="movie" class="dark-theme">
<top-banner [background]="movie.background" [available]="movie.available" <top-banner [background]="movie.background" [available]="movie.available" [title]="movie.title" [releaseDate]="movie.releaseDate"
[title]="movie.title" [releaseDate]="movie.releaseDate" [tagline]="movie.tagline"></top-banner> [tagline]="movie.tagline"></top-banner>
@ -9,42 +9,33 @@
<div class="small-middle-container"> <div class="small-middle-container">
<div class="row"> <div class="row">
<div class="col-md-2 col-sm-3 hidden-xs">
<div class="sidebar sidebar-poster affixable affix-top"> <media-poster [posterPath]="'https://image.tmdb.org/t/p/w300/' + movie.posterPath"></media-poster>
<div class="poster">
<img class="real" src="https://image.tmdb.org/t/p/w300/{{movie.posterPath}}" alt="Poster"
style="display: block;">
</div>
<!--Underneith poster-->
<br />
</div>
</div>
<!--Next to poster--> <!--Next to poster-->
<div class="col-10 col-lg-3 col-xl-3 media-row"> <div class="col-10 col-lg-3 col-xl-3 media-row">
<social-icons [homepage]="movie.homepage" [theMoviedbId]="movie.id" [hasTrailer]="movie.videos.results.length > 0" <social-icons [homepage]="movie.homepage" [theMoviedbId]="movie.id" [hasTrailer]="movie.videos.results.length > 0"
(openTrailer)="openDialog()" [imdbId]="movie.imdbId" [twitter]="movie.externalIds.twitterId" (openTrailer)="openDialog()" [imdbId]="movie.imdbId" [twitter]="movie.externalIds.twitterId" [facebook]="movie.externalIds.facebookId"
[facebook]="movie.externalIds.facebookId" [instagram]="movie.externalIds.instagramId" [available]="movie.available" [instagram]="movie.externalIds.instagramId" [available]="movie.available" [plexUrl]="movie.plexUrl"
[plexUrl]="movie.plexUrl" [embyUrl]="movie.embyUrl"></social-icons> [embyUrl]="movie.embyUrl"></social-icons>
</div> </div>
<div class="col-12 col-lg-7 col-xl-7 media-row"> <div class="col-12 col-lg-6 col-xl-6 media-row">
<button mat-raised-button class="btn-green btn-spacing" *ngIf="movie.available"> {{ <button mat-raised-button class="btn-green btn-spacing" *ngIf="movie.available"> {{
'Common.Available' | translate }}</button> 'Common.Available' | translate }}</button>
<span *ngIf="!movie.available"> <span *ngIf="!movie.available">
<span *ngIf="movie.requested || movie.approved; then requestedBtn else notRequestedBtn"></span> <span *ngIf="movie.requested || movie.approved; then requestedBtn else notRequestedBtn"></span>
<ng-template #requestedBtn> <ng-template #requestedBtn>
<button mat-raised-button class="btn-spacing btn-orange" [disabled]><i <button mat-raised-button class="btn-spacing btn-orange" [disabled]><i class="fa fa-check"></i>
class="fa fa-check"></i>
{{ 'Common.Requested' | translate }}</button> {{ 'Common.Requested' | translate }}</button>
</ng-template> </ng-template>
<ng-template #notRequestedBtn> <ng-template #notRequestedBtn>
<button mat-raised-button class="btn-spacing" (click)="request()"> <button mat-raised-button class="btn-spacing" (click)="request()">
<i *ngIf="movie.requestProcessing" class="fa fa-circle-o-notch fa-spin fa-fw"></i> <i <i *ngIf="movie.requestProcessing" class="fa fa-circle-o-notch fa-spin fa-fw"></i> <i *ngIf="!movie.requestProcessing && !movie.processed"
*ngIf="!movie.requestProcessing && !movie.processed" class="fa fa-plus"></i> class="fa fa-plus"></i>
<i *ngIf="movie.processed && !movie.requestProcessing" class="fa fa-check"></i> {{ <i *ngIf="movie.processed && !movie.requestProcessing" class="fa fa-check"></i> {{
'Common.Request' | translate }}</button> 'Common.Request' | translate }}</button>
</ng-template> </ng-template>
@ -54,8 +45,8 @@
<i class="fa fa-plus"></i> {{ 'Common.Approve' | translate }} <i class="fa fa-plus"></i> {{ 'Common.Approve' | translate }}
</button> </button>
<button mat-raised-button class="btn-spacing" color="warn" <button mat-raised-button class="btn-spacing" color="warn" (click)="deny()"> <i class="fa fa-times"></i> {{
(click)="deny()"> <i class="fa fa-times"></i> {{ 'Requests.Deny' | translate }}</button></span> 'Requests.Deny' | translate }}</button></span>
</div> </div>
</div> </div>
@ -63,8 +54,7 @@
<div class="row"> <div class="row">
<div class="col-12 col-md-2"> <div class="col-12 col-md-2">
<button *ngIf="movie.belongsToCollection" mat-raised-button <button *ngIf="movie.belongsToCollection" mat-raised-button class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
<mat-card class="mat-elevation-z8"> <mat-card class="mat-elevation-z8">
<mat-card-content class="medium-font"> <mat-card-content class="medium-font">
@ -87,28 +77,8 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<mat-card class="mat-elevation-z8 spacing-below"> <cast-carousel [cast]="movie.credits.cast"></cast-carousel>
<mat-card-header>Cast</mat-card-header>
<mat-card-content>
<p-carousel [value]="movie.credits.cast" [numVisible]="5" easing="easeOutStrong">
<ng-template let-item pTemplate="item">
<div class="row justify-content-md-center">
<div class="col-12">
<img class="cast-profile-img" *ngIf="item.profile_path"
src="https://image.tmdb.org/t/p/w300/{{item.profile_path}}">
<!-- TODO get profile image default -->
</div>
<div class="col-12">
<span><strong>Character:</strong> {{item.character}}</span>
</div>
<div class="col-12">
<span><strong>Actor:</strong> {{item.name}}</span>
</div>
</div>
</ng-template>
</p-carousel>
</mat-card-content>
</mat-card>
</div> </div>
</div> </div>
@ -128,8 +98,7 @@
<div class="sidebar affixable affix-top preview-poster"> <div class="sidebar affixable affix-top preview-poster">
<div class="poster"> <div class="poster">
<a [routerLink]="'/details/movie/'+r.id"> <a [routerLink]="'/details/movie/'+r.id">
<img class="real grow" matTooltip="{{r.title}}" <img class="real grow" matTooltip="{{r.title}}" src="https://image.tmdb.org/t/p/w300/{{r.poster_path}}"
src="https://image.tmdb.org/t/p/w300/{{r.poster_path}}"
alt="Poster" style="display: block;"> alt="Poster" style="display: block;">
</a> </a>
</div> </div>
@ -151,8 +120,7 @@
<div class="sidebar affixable affix-top preview-poster"> <div class="sidebar affixable affix-top preview-poster">
<div class="poster "> <div class="poster ">
<a [routerLink]="'/details/movie/'+r.id"> <a [routerLink]="'/details/movie/'+r.id">
<img class="real grow" matTooltip="{{r.title}}" <img class="real grow" matTooltip="{{r.title}}" src="https://image.tmdb.org/t/p/w300/{{r.poster_path}}"
src="https://image.tmdb.org/t/p/w300/{{r.poster_path}}"
alt="Poster" style="display: block;"> alt="Poster" style="display: block;">
</a> </a>
</div> </div>
@ -171,10 +139,8 @@
<div class="row card-spacer" *ngIf="movie.videos.results.length > 0"> <div class="row card-spacer" *ngIf="movie.videos.results.length > 0">
<div class="col-md-6" *ngFor="let video of movie.videos.results"> <div class="col-md-6" *ngFor="let video of movie.videos.results">
<iframe width="100%" height="315px" <iframe width="100%" height="315px" [src]="'https://www.youtube.com/embed/' + video.key | safe"
[src]="'https://www.youtube.com/embed/' + video.key | safe" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe> allowfullscreen></iframe>
</div> </div>
</div> </div>

View file

@ -0,0 +1,24 @@
<mat-card class="mat-elevation-z8 spacing-below">
<mat-card-header>Cast</mat-card-header>
<mat-card-content>
<p-carousel [value]="cast" [numVisible]="5" easing="easeOutStrong">
<ng-template let-item pTemplate="item">
<div class="row justify-content-md-center">
<div class="col-12">
<img class="cast-profile-img" *ngIf="item.profile_path" src="https://image.tmdb.org/t/p/w300/{{item.profile_path}}">
<img class="cast-profile-img" *ngIf="item.character?.image?.medium" [src]="item.character.image.medium">
<!-- TODO get profile image default -->
</div>
<div class="col-12">
<span *ngIf="!item.character?.name"><strong>Character:</strong> {{item.character}}</span>
<span *ngIf="item.character.name"><strong>Character:</strong> {{item.character.name}}</span>
</div>
<div class="col-12">
<span *ngIf="item.name"><strong>Actor:</strong> {{item.name}}</span>
<span *ngIf="item.person?.name"><strong>Actor:</strong> {{item.person.name}}</span>
</div>
</div>
</ng-template>
</p-carousel>
</mat-card-content>
</mat-card>

View file

@ -0,0 +1,10 @@
import { Component, Input } from "@angular/core";
@Component({
selector: "cast-carousel",
templateUrl: "./cast-carousel.component.html",
})
export class CastCarouselComponent {
@Input() cast: any[];
}

View file

@ -0,0 +1,10 @@
<div class="col-md-2 col-sm-3 hidden-xs">
<div class="sidebar sidebar-poster affixable affix-top">
<div class="poster">
<img class="real" src="{{posterPath}}" alt="Poster"
style="display: block;">
</div>
<!--Underneith poster-->
<br />
</div>
</div>

View file

@ -0,0 +1,10 @@
import { Component, Inject, Input, Output, EventEmitter } from "@angular/core";
@Component({
selector: "media-poster",
templateUrl: "./media-poster.component.html",
})
export class MediaPosterComponent {
@Input() posterPath: string;
}

View file

@ -18,10 +18,10 @@ export class SocialIconsComponent {
@Input() plexUrl: string; @Input() plexUrl: string;
@Input() embyUrl: string; @Input() embyUrl: string;
@Output() openTrailer: EventEmitter<any>; @Output() openTrailer: EventEmitter<any> = new EventEmitter();
public openDialog() { public openDialog() {
this.openTrailer.emit; this.openTrailer.emit();
} }
} }

View file

@ -1,34 +1,26 @@
<div *ngIf="tv"> <div *ngIf="tv">
<top-banner [background]="tv.background" [available]="tv.available" <top-banner [background]="tv.background" [available]="tv.available" [title]="tv.title" [releaseDate]="tv.firstAired"
[title]="tv.title" [releaseDate]="tv.firstAired" [tagline]="tv.certification"></top-banner> [tagline]="tv.certification"></top-banner>
<section id="info-wrapper"> <section id="info-wrapper">
<div class="small-middle-container"> <div class="small-middle-container">
<div class="row"> <div class="row">
<div class="col-md-2 col-sm-3 hidden-xs">
<div class="sidebar sidebar-poster affixable affix-top"> <media-poster [posterPath]="tv.images.medium"></media-poster>
<div class="poster">
<img class="real" [src]="tv.images.medium" alt="Poster" style="display: block;">
</div>
<!--Underneith poster-->
<br />
</div>
</div>
<!--Next to poster--> <!--Next to poster-->
<div class="col-10 col-lg-3 col-xl-3 media-row"> <div class="col-12 col-lg-3 col-xl-3 media-row">
<social-icons [homepage]="tv.homepage" [tvdbId]="tv.id" [hasTrailer]="tv.trailer" <social-icons [homepage]="tv.homepage" [tvdbId]="tv.id" [hasTrailer]="tv.trailer" (openTrailer)="openDialog()"
(openTrailer)="openDialog()" [imdbId]="tv.imdbId" [available]="tv.available" [imdbId]="tv.imdbId" [available]="tv.available" [plexUrl]="tv.plexUrl" [embyUrl]="tv.embyUrl"></social-icons>
[plexUrl]="tv.plexUrl" [embyUrl]="tv.embyUrl"></social-icons>
</div> </div>
<div class="col-12 col-lg-7 col-xl-7 media-row"> <div class="col-12 col-lg-6 col-xl-6 media-row">
<button *ngIf="!tv.fullyAvailable" mat-raised-button class="btn-spacing mat-warn" <button *ngIf="!tv.fullyAvailable" mat-raised-button class="btn-spacing mat-warn" (click)="request()"><i
(click)="request()"><i class="fa fa-plus"></i> class="fa fa-plus"></i>
{{ 'Common.Request' | translate }}</button> {{ 'Common.Request' | translate }}</button>
<button *ngIf="tv.fullyAvailable" mat-raised-button class="btn-spacing mat-primary" [disabled]> <button *ngIf="tv.fullyAvailable" mat-raised-button class="btn-spacing mat-primary" [disabled]>
@ -58,28 +50,7 @@
</mat-card> </mat-card>
</div> </div>
<div class="col-12"> <div class="col-12">
<mat-card class="mat-elevation-z8 spacing-below"> <cast-carousel [cast]="tv.cast"></cast-carousel>
<mat-card-header>Cast</mat-card-header>
<mat-card-content>
<p-carousel [value]="tv.cast" [numVisible]="5" easing="easeOutStrong">
<ng-template let-item pTemplate="item">
<div class="row justify-content-md-center">
<div class="col-12">
<img class="cast-profile-img" *ngIf="item.character.image.medium"
[src]="item.character.image.medium">
<!-- TODO get profile image default -->
</div>
<div class="col-12">
<span><strong>Character:</strong> {{item.character.name}}</span>
</div>
<div class="col-12">
<span><strong>Actor:</strong> {{item.person.name}}</span>
</div>
</div>
</ng-template>
</p-carousel>
</mat-card-content>
</mat-card>
</div> </div>
</div> </div>