Skip to content

Commit

Permalink
abc-371 'Nothing was found' fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mil-m committed Jul 31, 2024
1 parent 6b250ef commit 00a9483
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/app/globalsearch/globalsearch.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ <h2>FAANG Global Search</h2>
<ng-container *ngTemplateOutlet="commonTemplate; context: { hits: item.value?.totalHits, key: item.key }"></ng-container>
}
<ng-template #commonTemplate let-hits="hits" let-key="key">
<p [ngPlural]="hits" class="common-text">
<ng-template ngPluralCase="one">
{{ hits }} {{ changeKey(key) }}
</ng-template>
<ng-template ngPluralCase="other">
{{ hits }} {{ key === 'analysis' ? 'analyses' : changeKey(key) + 's' }}
</ng-template>
<p class="common-text">
{{ hits }}
@if (hits === 1) {
{{ changeKey(key) }}
} @else if (key === 'analysis') {
{{ 'analyses' }}
} @else {
{{ changeKey(key) + 's' }}
}
</p>
</ng-template>
@if (searchTermsBool(item)) {
Expand Down
3 changes: 2 additions & 1 deletion src/app/globalsearch/globalsearch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ export class GlobalSearchComponent implements OnInit {
this.dataService.getGSearchData(this.searchText).subscribe(json_data => {
this.showSpinner = false;
this.jsonData = json_data;
this.showResults = true;
});
}, time);
} else {
this.jsonData = {};
this.showResults = false;
}
this.showResults = true;
void this.router.navigate([], {
relativeTo: this.route,
queryParams: { searchText: this.searchText },
Expand Down

0 comments on commit 00a9483

Please sign in to comment.