mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-22 06:13:22 -07:00
Include radio select for type
Have added a radio select to choose what type either 'tv' or 'movie' of genre instead of listing both categories lists. Built on top of improvement made.
This commit is contained in:
parent
2c35b0221c
commit
fb0d9f819f
8 changed files with 11026 additions and 18135 deletions
|
@ -1,7 +1,7 @@
|
||||||
<div class="small-middle-container">
|
<div class="small-middle-container">
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2>Jump to Genre</h2>
|
<h2 id="genreHeading" data-toggle="collapse" href="#genreCollapse" role="button">{{'Discovery.Genres' | translate}}</h2>
|
||||||
<genre-button-select></genre-button-select>
|
<genre-button-select class="collapse show" id="genreCollapse"></genre-button-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2>{{'Discovery.RecentlyRequestedTab' | translate}}</h2>
|
<h2>{{'Discovery.RecentlyRequestedTab' | translate}}</h2>
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
<div class="genre-container">
|
<div class="type-select-container">
|
||||||
<mat-button-toggle-group name="discoverMode" (change)="toggleChanged($event)" *ngFor="let genre of genreList"
|
<input type="radio" id="Movies" name="Movies" [checked]="this.selectedType == 'movie'"
|
||||||
|
(change)="onTypeChange('movie')">
|
||||||
|
<label for="Movies">Movies</label>
|
||||||
|
<input type="radio" id="TvShows" name="TvShows" [checked]="this.selectedType == 'tv'" (change)="onTypeChange('tv')">
|
||||||
|
<label for="TvShows">Tv Shows</label>
|
||||||
|
</div>
|
||||||
|
<div class="genre-container" *ngIf="movieGenreList$ | async as movies"
|
||||||
|
[ngClass]="{'hidden' : this.selectedType != 'movie' }">
|
||||||
|
<mat-button-toggle-group name="discoverMode" (change)="toggleChanged($event, genre.type)"
|
||||||
|
*ngFor="let genre of movies" class="discover-filter-buttons-group">
|
||||||
|
<mat-button-toggle value="{{genre.id}}" class="discover-filter-button">{{genre.name}}</mat-button-toggle>
|
||||||
|
</mat-button-toggle-group>
|
||||||
|
</div>
|
||||||
|
<div class="genre-container" *ngIf="tvGenreList$ | async as tv" [ngClass]="{'hidden' : this.selectedType != 'tv' }">
|
||||||
|
<mat-button-toggle-group name="discoverMode" (change)="toggleChanged($event, genre.type)" *ngFor="let genre of tv"
|
||||||
class="discover-filter-buttons-group">
|
class="discover-filter-buttons-group">
|
||||||
<mat-button-toggle value="{{genre.id}}" class="discover-filter-button">{{genre.name}}</mat-button-toggle>
|
<mat-button-toggle value="{{genre.id}}" class="discover-filter-button">{{genre.name}}</mat-button-toggle>
|
||||||
</mat-button-toggle-group>
|
</mat-button-toggle-group>
|
||||||
|
|
|
@ -6,22 +6,28 @@ h2{
|
||||||
}
|
}
|
||||||
|
|
||||||
.discover-filter-buttons-group {
|
.discover-filter-buttons-group {
|
||||||
border: 1px solid #293a4c;
|
border: 1px solid #293a4c;
|
||||||
|
border-radius: 30px;
|
||||||
|
border-radius: 15px;
|
||||||
|
color:#fff;
|
||||||
|
margin-bottom:10px;
|
||||||
|
margin-bottom:5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
|
||||||
|
.discover-filter-button{
|
||||||
|
|
||||||
|
transform: scale(0.9);
|
||||||
|
background:inherit;
|
||||||
|
color:inherit;
|
||||||
|
padding:0 0px;
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
color:#fff;
|
padding-left: 20px;
|
||||||
margin-bottom:10px;
|
padding-right: 20px;
|
||||||
|
padding-left: 10px;
|
||||||
.discover-filter-button{
|
padding-right: 10px;
|
||||||
background:inherit;
|
border-left:none;
|
||||||
color:inherit;
|
}
|
||||||
padding:0 0px;
|
|
||||||
border-radius: 30px;
|
|
||||||
padding-left: 20px;
|
|
||||||
padding-right: 20px;
|
|
||||||
border-left:none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-active{
|
.button-active{
|
||||||
background:#293a4c;
|
background:#293a4c;
|
||||||
}
|
}
|
||||||
|
@ -30,3 +36,22 @@ h2{
|
||||||
margin-left: 35px;
|
margin-left: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.type-select-container {
|
||||||
|
margin-left: 40px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-select-container label {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-select-container input {
|
||||||
|
margin-right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
|
@ -1,36 +1,42 @@
|
||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, Injectable, OnInit } from "@angular/core";
|
||||||
import { SearchV2Service } from "../../../services";
|
import { SearchV2Service } from "../../../services";
|
||||||
import { AuthService } from "../../../auth/auth.service";
|
|
||||||
import { IMovieDbKeyword } from "../../../interfaces";
|
|
||||||
import { MatButtonToggleChange } from "@angular/material/button-toggle";
|
import { MatButtonToggleChange } from "@angular/material/button-toggle";
|
||||||
import { CarouselListComponent } from "../carousel-list/carousel-list.component";
|
|
||||||
import { RequestType } from "../../../interfaces";
|
import { RequestType } from "../../../interfaces";
|
||||||
import { AdvancedSearchDialogDataService } from "app/shared/advanced-search-dialog/advanced-search-dialog-data.service";
|
import { AdvancedSearchDialogDataService } from "app/shared/advanced-search-dialog/advanced-search-dialog-data.service";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
|
import { Observable, map } from "rxjs";
|
||||||
|
|
||||||
|
interface IGenreSelect {
|
||||||
|
name: string;
|
||||||
|
id: number;
|
||||||
|
type: "movie"|"tv";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: "root"
|
||||||
|
})
|
||||||
@Component({
|
@Component({
|
||||||
selector: "genre-button-select",
|
selector: "genre-button-select",
|
||||||
templateUrl: "./genre-button-select.component.html",
|
templateUrl: "./genre-button-select.component.html",
|
||||||
styleUrls: ["./genre-button-select.component.scss"],
|
styleUrls: ["./genre-button-select.component.scss"],
|
||||||
})
|
})
|
||||||
export class GenreButtonSelectComponent implements OnInit {
|
export class GenreButtonSelectComponent implements OnInit {
|
||||||
public genreList: IMovieDbKeyword[] = [];
|
public movieGenreList$: Observable<IGenreSelect[]> = null;
|
||||||
public selectedGenre: IMovieDbKeyword;
|
public tvGenreList$: Observable<IGenreSelect[]> = null;
|
||||||
public mediaType: string = "movie";
|
|
||||||
|
|
||||||
isLoading: boolean = false;
|
isLoading: boolean = false;
|
||||||
|
selectedType: string = "movie";
|
||||||
|
|
||||||
constructor(private searchService: SearchV2Service,
|
constructor(private searchService: SearchV2Service,
|
||||||
private advancedSearchService: AdvancedSearchDialogDataService,
|
private advancedSearchService: AdvancedSearchDialogDataService,
|
||||||
private router: Router) { }
|
private router: Router) { }
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
this.searchService.getGenres(this.mediaType).subscribe(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.genreList = results;
|
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;
|
this.isLoading = true;
|
||||||
|
|
||||||
const genres: number[] = [event.value];
|
const genres: number[] = [event.value];
|
||||||
|
@ -38,13 +44,17 @@ export class GenreButtonSelectComponent implements OnInit {
|
||||||
watchProviders: [],
|
watchProviders: [],
|
||||||
genreIds: genres,
|
genreIds: genres,
|
||||||
keywordIds: [],
|
keywordIds: [],
|
||||||
type: this.mediaType,
|
type: type,
|
||||||
}, 0, 30);
|
}, 0, 30);
|
||||||
|
|
||||||
this.advancedSearchService.setData(data, RequestType.movie);
|
this.advancedSearchService.setData(data, type === "movie" ? RequestType.movie : RequestType.tvShow);
|
||||||
this.advancedSearchService.setOptions([], genres, [], null, RequestType.movie, 30);
|
this.advancedSearchService.setOptions([], genres, [], null, type === "movie" ? RequestType.movie : RequestType.tvShow, 30);
|
||||||
this.router.navigate([`discover/advanced/search`]);
|
this.router.navigate([`discover/advanced/search`]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onTypeChange(value) {
|
||||||
|
this.selectedType = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
[infiniteScrollDistance]="3"
|
[infiniteScrollDistance]="3"
|
||||||
[infiniteScrollThrottle]="200"
|
[infiniteScrollThrottle]="200"
|
||||||
(scrolled)="onScroll()">
|
(scrolled)="onScroll()">
|
||||||
<div id="searchResults" class="col-xl-2 col-lg-3 col-md-3 col-6 col-sm-4 small-padding" *ngFor="let result of discoverResults" data-test="searchResultsCount" attr.search-count="{{discoverResults.length}}">
|
<div id="searchResults" class="col-xl-2 col-lg-3 col-md-3 col-6 col-sm-4 small-padding card-container" *ngFor="let result of discoverResults" data-test="searchResultsCount" attr.search-count="{{discoverResults.length}}">
|
||||||
<discover-card [isAdmin]="isAdmin" [result]="result" [is4kEnabled]="is4kEnabled"></discover-card>
|
<discover-card [isAdmin]="isAdmin" [result]="result" [is4kEnabled]="is4kEnabled"></discover-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -63,6 +63,7 @@ $ombi-accent: #258a6d;
|
||||||
|
|
||||||
::ng-deep .discoverResults{
|
::ng-deep .discoverResults{
|
||||||
margin-top:40px;
|
margin-top:40px;
|
||||||
|
margin-left: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::ng-deep button:focus{
|
::ng-deep button:focus{
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -403,7 +403,8 @@
|
||||||
"RecentlyRequestedTab": "Recently Requested",
|
"RecentlyRequestedTab": "Recently Requested",
|
||||||
"Movies": "Movies",
|
"Movies": "Movies",
|
||||||
"Combined": "Combined",
|
"Combined": "Combined",
|
||||||
"Tv": "TV",
|
"Tv": "TV",
|
||||||
|
"Genres": "Genres",
|
||||||
"CardDetails": {
|
"CardDetails": {
|
||||||
"Availability": "Availability",
|
"Availability": "Availability",
|
||||||
"Studio": "Studio",
|
"Studio": "Studio",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue