mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
minor code cleanuo
This commit is contained in:
parent
938e8439bc
commit
2ffec6b1e6
6 changed files with 9 additions and 112 deletions
|
@ -1,9 +1,9 @@
|
|||
<div class="card-spacing box" *ngIf="result" [style.display]="hide ? 'none' : 'block'">
|
||||
<mat-card class="mat-elevation-z8 dark-card">
|
||||
<mat-card class="mat-elevation-z8 dark-card" [routerLink]="result.type === RequestType.movie ? '/details/movie/' + result.id : '/details/tv/' + result.id">
|
||||
<div class="ribbon {{getStatusClass()}} ribbon-top-right"><span>
|
||||
{{getAvailbilityStatus()}}
|
||||
</span></div>
|
||||
<a [routerLink]="result.type === RequestType.movie ? '/details/movie/' + result.id : '/details/tv/' + result.id">
|
||||
<a>
|
||||
<img id="cardImage" mat-card-image src="{{result.posterPath}}" class="card-poster" alt="{{result.title}}">
|
||||
</a>
|
||||
<mat-card-content (click)="openDetails(result);">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
<div *ngIf="!discoverResults || discoverResults.length === 0">
|
||||
<div class="row justify-content-md-center top-spacing loading-spinner">
|
||||
<h1>Sorry, nothing matches your search! <i class="fa fa-frown-o" aria-hidden="true"></i></h1>
|
||||
<h1> {{'Discovery.NoSearch' | translate}} <i class="fa fa-frown-o" aria-hidden="true"></i></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -85,44 +85,9 @@ export class DiscoverSearchResultsComponent implements OnInit {
|
|||
available: false,
|
||||
tvMovieDb: mediaType === RequestType.tvShow ? true : false
|
||||
});
|
||||
|
||||
// switch (mediaType) {
|
||||
// case RequestType.movie:
|
||||
// this.searchService.getFullMovieDetails(+m.id)
|
||||
// .subscribe(x => {
|
||||
// const index = this.discoverResults.findIndex((obj => obj.id === +m.id));
|
||||
// this.discoverResults[index].available = x.available;
|
||||
// this.discoverResults[index].requested = x.requested;
|
||||
// this.discoverResults[index].requested = x.requested;
|
||||
// this.discoverResults[index].requested = x.requested;
|
||||
// this.discoverResults[index].requested = x.requested;
|
||||
// this.discoverResults[index].requested = x.requested;
|
||||
// });
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
// private createModel() {
|
||||
// this.finishLoading();
|
||||
// this.collection.collection.forEach(m => {
|
||||
// this.discoverResults.push({
|
||||
// available: m.available,
|
||||
// posterPath: `https://image.tmdb.org/t/p/w300/${m.posterPath}`,
|
||||
// requested: m.requested,
|
||||
// title: m.title,
|
||||
// type: RequestType.movie,
|
||||
// id: m.id,
|
||||
// url: `http://www.imdb.com/title/${m.imdbId}/`,
|
||||
// rating: 0,
|
||||
// overview: m.overview,
|
||||
// approved: m.approved,
|
||||
// imdbid: m.imdbId,
|
||||
// denied:false,
|
||||
// background: ""
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
private loading() {
|
||||
this.loadingFlag = true;
|
||||
}
|
||||
|
|
|
@ -1,42 +1,5 @@
|
|||
<!-- <input class="form-control quater-width search-bar" type="text" [(ngModel)]="selectedItem" placeholder="{{'NavigationBar.Search' | translate}}"
|
||||
aria-label="Search" [ngbTypeahead]="searchModel" [resultFormatter]="formatter" [inputFormatter]="formatter" [resultTemplate]="template" (selectItem)="selected($event)">
|
||||
|
||||
<ng-template #template let-result="result">
|
||||
</ng-template> -->
|
||||
|
||||
<form [formGroup]='searchForm'>
|
||||
<mat-form-field floatLabel="never" style="width: 100%;">
|
||||
<input id="nav-search" matInput placeholder="{{'NavigationBar.Search' | translate}}" [matAutocomplete]="auto" formControlName='input'>
|
||||
<input id="nav-search" matInput placeholder="{{'NavigationBar.Search' | translate}}" formControlName='input'>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)" [displayWith]="displayFn">
|
||||
<mat-option *ngIf="searching" color="warn">
|
||||
<mat-spinner diameter="50"></mat-spinner>
|
||||
</mat-option>
|
||||
<ng-container *ngIf="!searching">
|
||||
<mat-option class="option" *ngFor="let result of results" [value]="result">
|
||||
<img *ngIf="result.poster" class="option-img" aria-hidden [src]="'https://image.tmdb.org/t/p/w300/'+result.poster" height="75">
|
||||
<span *ngIf="result.mediaType === 'movie'">
|
||||
<i *ngIf="!result.poster" class="fa fa-film"></i>
|
||||
<span>{{result.title}}</span>
|
||||
</span>
|
||||
<span *ngIf="result.mediaType === 'tv'">
|
||||
<i *ngIf="!result.poster" class="fa fa-tv"></i>
|
||||
|
||||
<span>{{result.title}}</span>
|
||||
</span>
|
||||
|
||||
<span *ngIf="result.mediaType === 'Artist'">
|
||||
<i *ngIf="!result.poster" class="fa fa-music"></i>
|
||||
|
||||
<span>{{result.title}}</span>
|
||||
</span>
|
||||
|
||||
<span *ngIf="result.mediaType === 'person'">
|
||||
<i *ngIf="!result.poster" class="fa fa-user"></i>
|
||||
<span>{{result.title}}</span>
|
||||
</span>
|
||||
</mat-option>
|
||||
</ng-container>
|
||||
</mat-autocomplete>
|
||||
</form>
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import {
|
||||
debounceTime,
|
||||
switchMap,
|
||||
|
@ -7,12 +7,8 @@ import {
|
|||
} from "rxjs/operators";
|
||||
|
||||
import { empty} from "rxjs";
|
||||
import { IMultiSearchResult } from "../interfaces";
|
||||
import { Router } from "@angular/router";
|
||||
import { FormGroup, FormBuilder } from "@angular/forms";
|
||||
import { MatAutocompleteSelectedEvent } from "@angular/material/autocomplete";
|
||||
import { SearchFilter } from "./SearchFilter";
|
||||
import { FilterService } from "../discover/services/filter-service";
|
||||
|
||||
@Component({
|
||||
selector: "app-nav-search",
|
||||
|
@ -20,9 +16,6 @@ import { FilterService } from "../discover/services/filter-service";
|
|||
styleUrls: ["./nav-search.component.scss"],
|
||||
})
|
||||
export class NavSearchComponent implements OnInit {
|
||||
public selectedItem: string;
|
||||
public results: IMultiSearchResult[];
|
||||
public searching = false;
|
||||
|
||||
public searchForm: FormGroup;
|
||||
|
||||
|
@ -40,38 +33,13 @@ export class NavSearchComponent implements OnInit {
|
|||
.get("input")
|
||||
.valueChanges.pipe(
|
||||
debounceTime(1300),
|
||||
tap(() => (this.searching = true)),
|
||||
switchMap((value: string) => {
|
||||
if (value) {
|
||||
this.router.navigate([`discover`, value]);
|
||||
// return this.searchService
|
||||
// .multiSearch(value, this.filter)
|
||||
// .pipe(finalize(() => (this.searching = false)));
|
||||
}
|
||||
return empty().pipe(finalize(() => (this.searching = false)));
|
||||
return empty();;
|
||||
})
|
||||
)
|
||||
.subscribe((r) => (this.results = r));
|
||||
}
|
||||
|
||||
public selected(event: MatAutocompleteSelectedEvent) {
|
||||
this.searchForm.controls.input.setValue(null);
|
||||
const val = event.option.value as IMultiSearchResult;
|
||||
if (val.mediaType == "movie") {
|
||||
this.router.navigate([`details/movie/${val.id}`]);
|
||||
return;
|
||||
} else if (val.mediaType == "tv") {
|
||||
this.router.navigate([`details/tv/${val.id}/true`]);
|
||||
return;
|
||||
} else if (val.mediaType == "person") {
|
||||
this.router.navigate([`discover/actor/${val.id}`]);
|
||||
return;
|
||||
} else if (val.mediaType == "Artist") {
|
||||
this.router.navigate([`details/artist/${val.id}`]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
displayFn(result: IMultiSearchResult) {
|
||||
if (result) { return result.title; }
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -296,7 +296,8 @@
|
|||
"FirstAired": "First Aired",
|
||||
"Writer": "Writer",
|
||||
"ExecProducer": "Exec Producer"
|
||||
}
|
||||
},
|
||||
"NoSearch":"Sorry, nothing matches your search!"
|
||||
},
|
||||
"UserPreferences": {
|
||||
"Welcome": "Welcome {{username}}!",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue