From 07942dcd04f7b86e942749848d5d37259a415c0f Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Sun, 4 Oct 2020 22:32:26 +0100 Subject: [PATCH] Finished the additional grid option --- .../actor/discover-actor.component.ts | 5 +- .../card/discover-card-details.component.html | 36 ++++---- .../discover-collections.component.ts | 3 +- .../discover/discover.component.html | 4 +- .../components/discover/discover.component.ts | 14 ++- .../grid/discover-grid.component.html | 91 ++++++++++++++++++- .../grid/discover-grid.component.scss | 32 +++++++ .../grid/discover-grid.component.ts | 65 +++++++++++-- .../ClientApp/src/app/discover/interfaces.ts | 1 + src/Ombi/ClientApp/src/index.html | 2 +- src/Ombi/ClientApp/src/styles/shared.scss | 4 + 11 files changed, 218 insertions(+), 39 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/discover/components/actor/discover-actor.component.ts b/src/Ombi/ClientApp/src/app/discover/components/actor/discover-actor.component.ts index 4cebae814..aba34bff9 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/actor/discover-actor.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/actor/discover-actor.component.ts @@ -45,9 +45,9 @@ export class DiscoverActorComponent implements AfterViewInit { this.discoverResults = []; this.actorCredits.cast.forEach(m => { this.discoverResults.push({ - available: false, + available: false, posterPath: m.poster_path ? `https://image.tmdb.org/t/p/w300/${m.poster_path}` : "../../../images/default_movie_poster.png", - requested: false, + requested: false, title: m.title, type: RequestType.movie, id: m.id, @@ -56,6 +56,7 @@ export class DiscoverActorComponent implements AfterViewInit { overview: m.overview, approved: false, imdbid: "", + denied: false }); }); } diff --git a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html index 1a67b243e..877d799d0 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html @@ -76,24 +76,24 @@ [translate]="'Common.NotRequested'"> -
- {{'Discovery.CardDetails.Director' | translate}}: - {{movie.credits.crew[0].name}} - Director: - {{tvCreator}} -
-
- {{'Discovery.CardDetails.InCinemas' | translate}}: - {{movie.releaseDate | amLocal | amDateFormat: 'LL'}} - {{'Discovery.CardDetails.FirstAired' | translate}}: - {{tv.firstAired | amLocal | amDateFormat: 'LL'}} -
-
- {{'Discovery.CardDetails.Writer' | translate}}: - {{movie.credits.crew[1].name}} - {{'Discovery.CardDetails.ExecProducer' | translate}}: - {{tvProducer}} -
+
+ {{'Discovery.CardDetails.Director' | translate}}: + {{movie.credits.crew[0].name}} + Director: + {{tvCreator}} +
+
+ {{'Discovery.CardDetails.InCinemas' | translate}}: + {{movie.releaseDate | amLocal | amDateFormat: 'LL'}} + {{'Discovery.CardDetails.FirstAired' | translate}}: + {{tv.firstAired | amLocal | amDateFormat: 'LL'}} +
+
+ {{'Discovery.CardDetails.Writer' | translate}}: + {{movie.credits.crew[1].name}} + {{'Discovery.CardDetails.ExecProducer' | translate}}: + {{tvProducer}} +
diff --git a/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts b/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts index 2fdca057a..108db606c 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts @@ -54,10 +54,11 @@ export class DiscoverCollectionsComponent implements OnInit { overview: m.overview, approved: m.approved, imdbid: m.imdbId, + denied:false }); }); } - + private loading() { this.loadingFlag = true; } diff --git a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html index 5c5f09c1d..cb95a7524 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html @@ -1,7 +1,7 @@
- + dashboard calendar_view_day @@ -31,7 +31,7 @@
-
+
diff --git a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts index d00f66113..c604a3b31 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts @@ -26,7 +26,7 @@ export class DiscoverComponent implements OnInit { public discoverOptions: DiscoverOption = DiscoverOption.Combined; public DiscoverOption = DiscoverOption; - public displayOption: DisplayOption = DisplayOption.List; + public displayOption: DisplayOption = DisplayOption.Card; public DisplayOption = DisplayOption; public defaultTvPoster: string; @@ -43,6 +43,7 @@ export class DiscoverComponent implements OnInit { private contentLoaded: number; private isScrolling: boolean = false; private mediaTypeStorageKey = "DiscoverOptions"; + private displayOptionsKey = "DiscoverDisplayOptions"; constructor(private searchService: SearchV2Service, private storageService: StorageService, @@ -55,6 +56,10 @@ export class DiscoverComponent implements OnInit { if (localDiscoverOptions) { this.discoverOptions = DiscoverOption[DiscoverOption[localDiscoverOptions]]; } + const localDisplayOptions = +this.storageService.get(this.displayOptionsKey); + if (localDisplayOptions) { + this.displayOption = DisplayOption[DisplayOption[localDisplayOptions]]; + } this.scrollDisabled = true; switch (this.discoverOptions) { case DiscoverOption.Combined: @@ -225,6 +230,7 @@ export class DiscoverComponent implements OnInit { public changeView(view: DisplayOption) { this.displayOption = view; + this.storageService.save(this.displayOptionsKey, view.toString()); } private createModel() { @@ -263,7 +269,8 @@ export class DiscoverComponent implements OnInit { rating: m.voteAverage, overview: m.overview, approved: m.approved, - imdbid: m.imdbId + imdbid: m.imdbId, + denied: false }); }); return tempResults; @@ -283,7 +290,8 @@ export class DiscoverComponent implements OnInit { rating: +m.rating, overview: m.overview, approved: m.approved, - imdbid: m.imdbId + imdbid: m.imdbId, + denied: false }); }); return tempResults; diff --git a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html index 9f3bf3d76..5c6039258 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html @@ -14,13 +14,13 @@
--> -
+
-
+
{{result.title}}
-
+

{{result.title}}

@@ -38,16 +38,99 @@ {{'Common.RequestDenied' | translate}} - + {{'Common.PendingApproval' | translate}} + play_circle_outline + play_circle_outline + play_circle_outline + play_circle_outline
+ + + {{'Discovery.CardDetails.Studio' | translate}}: {{movie.productionCompanies[0].name}} + + {{'Discovery.CardDetails.Network' | translate}}: {{tv.network.name}} + + {{'Discovery.CardDetails.Director' | translate}}: {{movie.credits.crew[0].name}} + + Director: {{tvCreator}} + + {{'Discovery.CardDetails.InCinemas' | translate}}: {{movie.releaseDate | amLocal | amDateFormat: 'LL'}} + + {{'Discovery.CardDetails.FirstAired' | translate}}: {{tv.firstAired | amLocal | amDateFormat: 'LL'}} + + {{'Discovery.CardDetails.Writer' | translate}}: {{movie.credits.crew[1].name}} + + {{'Discovery.CardDetails.ExecProducer' | translate}}: {{tvProducer}} + + + + + +
+

{{result.overview}}

+ +
+
+ +
+ + + + + + + + + + +
+ +
+ + + + + + + + {{'Search.ViewOnPlex' | + translate}} + {{'Search.ViewOnEmby' | + translate}} + +
+
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.scss b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.scss index 748c668e2..3e05e3c48 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.scss +++ b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.scss @@ -1,6 +1,31 @@ $ombi-primary:#3f3f3f; $card-background: #2b2b2b; +$blue: #1976D2; +$pink: #C2185B; +$green:#1DE9B6; +$orange:#F57C00; + +.btn-blue { + background-color: $blue; +} + +.btn-pink { + background-color: $pink; +} + +.btn-green { + background-color: $green; +} + +.btn-orange { + background-color: $orange; +} + +.btn-spacing { + margin-top:10%; +} + #cardImage { border-radius: 5px 5px 0px 0px; height: 75%; @@ -17,6 +42,13 @@ $card-background: #2b2b2b; .card-poster { width: 100%; + border-radius: 8px 0px 0px 8px; + margin-top: -6.5%; + margin-bottom: -6.6%; +} + +.main-container { + margin-left: -2%; } diff --git a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.ts b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.ts index 55ac4870d..6e51985ce 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.ts @@ -1,10 +1,13 @@ import { Component, OnInit, Input } from "@angular/core"; import { IDiscoverCardResult } from "../../interfaces"; -import { RequestType, ISearchTvResult, ISearchMovieResult } from "../../../interfaces"; -import { SearchV2Service } from "../../../services"; +import { RequestType, ISearchTvResult, ISearchMovieResult, ISearchMovieResultContainer } from "../../../interfaces"; +import { RequestService, SearchV2Service } from "../../../services"; import { MatDialog } from "@angular/material/dialog"; import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2"; import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2"; +import { EpisodeRequestComponent } from "../../../shared/episode-request/episode-request.component"; +import { MatSnackBar } from "@angular/material/snack-bar"; +import { Router } from "@angular/router"; @Component({ selector: "discover-grid", @@ -15,8 +18,16 @@ export class DiscoverGridComponent implements OnInit { @Input() public result: IDiscoverCardResult; public RequestType = RequestType; + public requesting: boolean; - constructor(private searchService: SearchV2Service, private dialog: MatDialog) { } + public tv: ISearchTvResultV2; + public tvCreator: string; + public tvProducer: string; + public movie: ISearchMovieResultV2; + + constructor(private searchService: SearchV2Service, private dialog: MatDialog, + private requestService: RequestService, private notification: MatSnackBar, + private router: Router) { } public ngOnInit() { if (this.result.type == RequestType.tvShow) { @@ -28,12 +39,32 @@ export class DiscoverGridComponent implements OnInit { } public async getExtraTvInfo() { - var result = await this.searchService.getTvInfo(this.result.id); - this.setTvDefaults(result); - this.updateTvItem(result); + this.tv = await this.searchService.getTvInfo(this.result.id); + this.setTvDefaults(this.tv); + this.updateTvItem(this.tv); + const creator = this.tv.crew.filter(tv => { + return tv.type === "Creator"; + })[0]; + if (creator && creator.person) { + this.tvCreator = creator.person.name; + } + const crewResult = this.tv.crew.filter(tv => { + return tv.type === "Executive Producer"; + })[0] + if (crewResult && crewResult.person) { + this.tvProducer = crewResult.person.name; + } } + public openDetails() { + if (this.result.type === RequestType.movie) { + this.router.navigate(['/details/movie/', this.result.id]); + } else if (this.result.type === RequestType.tvShow) { + this.router.navigate(['/details/tv/', this.result.id]); + } + } + public getStatusClass(): string { if (this.result.available) { return "available"; @@ -48,12 +79,13 @@ export class DiscoverGridComponent implements OnInit { } private getExtraMovieInfo() { - if (!this.result.imdbid) { + // if (!this.result.imdbid) { this.searchService.getFullMovieDetails(this.result.id) .subscribe(m => { + this.movie = m; this.updateMovieItem(m); }); - } + // } } private updateMovieItem(updated: ISearchMovieResultV2) { @@ -82,4 +114,21 @@ export class DiscoverGridComponent implements OnInit { this.result.url = updated.imdbId; } + public async request() { + this.requesting = true; + if (this.result.type === RequestType.movie) { + const result = await this.requestService.requestMovie({ theMovieDbId: this.result.id, languageCode: "" }).toPromise(); + + if (result.result) { + this.result.requested = true; + this.notification.open(result.message, "Ok"); + } else { + this.notification.open(result.errorMessage, "Ok"); + } + } else if (this.result.type === RequestType.tvShow) { + this.dialog.open(EpisodeRequestComponent, { width: "700px", data: this.tv, panelClass: 'modal-panel' }) + } + this.requesting = false; + } + } diff --git a/src/Ombi/ClientApp/src/app/discover/interfaces.ts b/src/Ombi/ClientApp/src/app/discover/interfaces.ts index bc933379b..f17cd9768 100644 --- a/src/Ombi/ClientApp/src/app/discover/interfaces.ts +++ b/src/Ombi/ClientApp/src/app/discover/interfaces.ts @@ -8,6 +8,7 @@ export interface IDiscoverCardResult { type: RequestType; available: boolean; approved: boolean; + denied: boolean; requested: boolean; rating: number; overview: string; diff --git a/src/Ombi/ClientApp/src/index.html b/src/Ombi/ClientApp/src/index.html index 40ba6a0eb..f7804c77f 100644 --- a/src/Ombi/ClientApp/src/index.html +++ b/src/Ombi/ClientApp/src/index.html @@ -57,7 +57,7 @@ - +