-
-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(discover): 🚸 Improved the new Genre buttons, it now includes TV r…
…esults
- Loading branch information
Showing
8 changed files
with
36 additions
and
26 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
src/Ombi/ClientApp/src/app/discover/components/genre/genre-button-select.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 15 additions & 16 deletions
31
src/Ombi/ClientApp/src/app/discover/components/genre/genre-button-select.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,49 @@ | ||
import { Component, OnInit } from "@angular/core"; | ||
import { SearchV2Service } from "../../../services"; | ||
import { AuthService } from "../../../auth/auth.service"; | ||
import { IMovieDbKeyword } from "../../../interfaces"; | ||
import { MatButtonToggleChange } from "@angular/material/button-toggle"; | ||
import { CarouselListComponent } from "../carousel-list/carousel-list.component"; | ||
import { RequestType } from "../../../interfaces"; | ||
import { AdvancedSearchDialogDataService } from "app/shared/advanced-search-dialog/advanced-search-dialog-data.service"; | ||
import { Router } from "@angular/router"; | ||
import { map, Observable } from "rxjs"; | ||
|
||
interface IGenreSelect { | ||
name: string; | ||
id: number; | ||
type: "movie"|"tv"; | ||
} | ||
@Component({ | ||
selector: "genre-button-select", | ||
templateUrl: "./genre-button-select.component.html", | ||
styleUrls: ["./genre-button-select.component.scss"], | ||
}) | ||
export class GenreButtonSelectComponent implements OnInit { | ||
public genreList: IMovieDbKeyword[] = []; | ||
public selectedGenre: IMovieDbKeyword; | ||
public mediaType: string = "movie"; | ||
public movieGenreList$: Observable<IGenreSelect[]> = null; | ||
public tvGenreList$: Observable<IGenreSelect[]> = null; | ||
|
||
isLoading: boolean = false; | ||
|
||
constructor(private searchService: SearchV2Service, | ||
constructor(private searchService: SearchV2Service, | ||
private advancedSearchService: AdvancedSearchDialogDataService, | ||
private router: Router) { } | ||
|
||
public ngOnInit(): void { | ||
this.searchService.getGenres(this.mediaType).subscribe(results => { | ||
this.genreList = results; | ||
}); | ||
this.movieGenreList$ = this.searchService.getGenres("movie").pipe(map(x => x.slice(0, 10).map(y => ({ name: y.name, id: y.id, type: "movie" })))); | ||
this.tvGenreList$ = this.searchService.getGenres("tv").pipe(map(x => x.slice(0, 10).map(y => ({ name: y.name, id: y.id, type: "tv" })))); | ||
} | ||
|
||
public async toggleChanged(event: MatButtonToggleChange) { | ||
public async toggleChanged(event: MatButtonToggleChange, type: "movie"|"tv") { | ||
this.isLoading = true; | ||
|
||
const genres: number[] = [event.value]; | ||
const data = await this.searchService.advancedSearch({ | ||
watchProviders: [], | ||
genreIds: genres, | ||
keywordIds: [], | ||
type: this.mediaType, | ||
type: type, | ||
}, 0, 30); | ||
|
||
this.advancedSearchService.setData(data, RequestType.movie); | ||
this.advancedSearchService.setOptions([], genres, [], null, RequestType.movie, 30); | ||
this.advancedSearchService.setData(data, type == "movie" ? RequestType.movie : RequestType.tvShow); | ||
this.advancedSearchService.setOptions([], genres, [], null, type == "movie" ? RequestType.movie : RequestType.tvShow, 30); | ||
this.router.navigate([`discover/advanced/search`]); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
|
||
.loading-spinner { | ||
margin: 10%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters