fix: 🐛 Hides no results message during search. (#4375)

pull/4366/head
Victor Usoltsev 3 years ago committed by GitHub
parent 881561eaac
commit b819b0e007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,14 +1,13 @@
<div class="small-middle-container" > <div class="small-middle-container" >
<div *ngIf="loadingFlag" class="row justify-content-md-center top-spacing loading-spinner"> <div *ngIf="loadingFlag" class="row justify-content-md-center top-spacing loading-spinner">
<mat-spinner [color]="'accent'"></mat-spinner> <mat-spinner [color]="'accent'"></mat-spinner>
</div> </div>
<div *ngIf="discoverResults && discoverResults.length > 0" class="row full-height discoverResults col" > <div *ngIf="discoverResults.length > 0" class="row full-height discoverResults col" >
<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" *ngFor="let result of discoverResults" data-test="searchResultsCount" attr.search-count="{{discoverResults.length}}">
<discover-card [isAdmin]="isAdmin" [result]="result"></discover-card> <discover-card [isAdmin]="isAdmin" [result]="result"></discover-card>
</div> </div>
</div> </div>
<div *ngIf="!discoverResults || discoverResults.length === 0"> <div *ngIf="!loadingFlag && discoverResults.length === 0">
<div class="row justify-content-md-center top-spacing loading-spinner"> <div class="row justify-content-md-center top-spacing loading-spinner">
<h1 id="noSearchResult"> {{'Discovery.NoSearch' | translate}} <i class="far fa-frown" aria-hidden="true"></i></h1> <h1 id="noSearchResult"> {{'Discovery.NoSearch' | translate}} <i class="far fa-frown" aria-hidden="true"></i></h1>
</div> </div>

@ -50,7 +50,6 @@ export class DiscoverSearchResultsComponent implements OnInit {
this.clear(); this.clear();
this.loadAdvancedData(); this.loadAdvancedData();
}); });
} }
public async ngOnInit() { public async ngOnInit() {
@ -79,8 +78,7 @@ export class DiscoverSearchResultsComponent implements OnInit {
await this.search(); await this.search();
} }
public createInitalModel() { private createInitialModel() {
this.finishLoading();
this.results.forEach(m => { this.results.forEach(m => {
let mediaType = RequestType.movie; let mediaType = RequestType.movie;
@ -119,6 +117,7 @@ export class DiscoverSearchResultsComponent implements OnInit {
tvMovieDb: mediaType === RequestType.tvShow ? true : false tvMovieDb: mediaType === RequestType.tvShow ? true : false
}); });
}); });
this.finishLoading();
} }
private loading() { private loading() {
@ -180,6 +179,6 @@ export class DiscoverSearchResultsComponent implements OnInit {
this.clear(); this.clear();
this.results = await this.searchService this.results = await this.searchService
.multiSearch(this.searchTerm, this.filter).toPromise(); .multiSearch(this.searchTerm, this.filter).toPromise();
this.createInitalModel(); this.createInitialModel();
} }
} }

Loading…
Cancel
Save