order by director, add default image and fix click

This commit is contained in:
tidusjar 2022-08-22 20:21:17 +01:00
commit dbe6c78ea1
4 changed files with 24 additions and 6 deletions

View file

@ -2,7 +2,7 @@ import { Component, OnInit, ViewEncapsulation } from "@angular/core";
import { ImageService, SearchV2Service, RequestService, MessageService, RadarrService, SettingsStateService } from "../../../services"; import { ImageService, SearchV2Service, RequestService, MessageService, RadarrService, SettingsStateService } from "../../../services";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2"; import { ICrewViewModel, ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2";
import { MatDialog } from "@angular/material/dialog"; import { MatDialog } from "@angular/material/dialog";
import { YoutubeTrailerComponent } from "../shared/youtube-trailer.component"; import { YoutubeTrailerComponent } from "../shared/youtube-trailer.component";
import { AuthService } from "../../../auth/auth.service"; import { AuthService } from "../../../auth/auth.service";
@ -82,6 +82,7 @@ export class MovieDetailsComponent implements OnInit{
this.searchService.getMovieByImdbId(this.imdbId).subscribe(async x => { this.searchService.getMovieByImdbId(this.imdbId).subscribe(async x => {
this.movie = x; this.movie = x;
this.checkPoster(); this.checkPoster();
this.movie.credits.crew = this.orderCrew(this.movie.credits.crew);
if (this.movie.requestId > 0) { if (this.movie.requestId > 0) {
// Load up this request // Load up this request
this.hasRequest = true; this.hasRequest = true;
@ -93,6 +94,7 @@ export class MovieDetailsComponent implements OnInit{
this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => { this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => {
this.movie = x; this.movie = x;
this.checkPoster(); this.checkPoster();
this.movie.credits.crew = this.orderCrew(this.movie.credits.crew);
if (this.movie.requestId > 0) { if (this.movie.requestId > 0) {
// Load up this request // Load up this request
this.hasRequest = true; this.hasRequest = true;
@ -319,4 +321,16 @@ export class MovieDetailsComponent implements OnInit{
}); });
} }
private orderCrew(crew: ICrewViewModel[]): ICrewViewModel[] {
return crew.sort((a, b) => {
if (a.job === "Director") {
return -1;
} else if (b.job === "Director") {
return 1;
} else {
return 0;
}
});
}
} }

View file

@ -11,7 +11,7 @@
<a *ngIf="item.profile_path" [routerLink]="'/discover/actor/' + item.id"> <a *ngIf="item.profile_path" [routerLink]="'/discover/actor/' + item.id">
<ombi-image class="cast-profile-img" src="https://image.tmdb.org/t/p/w300{{item.profile_path}}"></ombi-image> <ombi-image class="cast-profile-img" src="https://image.tmdb.org/t/p/w300{{item.profile_path}}"></ombi-image>
</a> </a>
<!-- TODO get profile image default --> <i *ngIf="!item.image && !item.profile_path" class="fa-solid fa-user-large fa-2xl crew-profile-img" aria-hidden="true"></i>
</div> </div>
<div class="col-12"> <div class="col-12">

View file

@ -4,14 +4,14 @@
<p-carousel [value]="crew" easing="easeOutStrong" [responsiveOptions]="responsiveOptions" [numVisible]="5" > <p-carousel [value]="crew" easing="easeOutStrong" [responsiveOptions]="responsiveOptions" [numVisible]="5" >
<ng-template let-item pTemplate="item"> <ng-template let-item pTemplate="item">
<div class="row justify-content-md-center mat-card mat-card-flat carousel-item"> <div class="row justify-content-md-center mat-card mat-card-flat carousel-item">
<div class="bottom-space"> <div [routerLink]="'/discover/actor/' + item.id" class="bottom-space link">
<a *ngIf="item.image" [routerLink]="'/discover/actor/' + item.id"> <a *ngIf="item.image">
<img class="crew-profile-img" src="https://image.tmdb.org/t/p/w300{{item.image}}"> <img class="crew-profile-img" src="https://image.tmdb.org/t/p/w300{{item.image}}">
</a> </a>
<a *ngIf="item.profile_path" [routerLink]="'/discover/actor/' + item.id"> <a *ngIf="item.profile_path">
<img class="crew-profile-img" src="https://image.tmdb.org/t/p/w300{{item.profile_path}}"> <img class="crew-profile-img" src="https://image.tmdb.org/t/p/w300{{item.profile_path}}">
</a> </a>
<!-- TODO get profile image default --> <i *ngIf="!item.image && !item.profile_path" class="fa-solid fa-user-large fa-2xl crew-profile-img" aria-hidden="true"></i>
</div> </div>
<div class="col-12"> <div class="col-12">

View file

@ -80,4 +80,8 @@ body .ui-carousel .ui-carousel-content .ui-carousel-next:not(.ui-state-disabled)
max-height: 100px; max-height: 100px;
object-fit: cover; object-fit: cover;
} }
}
.link {
cursor: pointer;
} }