Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search - Remove the number of results #829 #1157

Merged
merged 4 commits into from
Jan 17, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { TemplateRef } from '@angular/core';
import { Observable, EMPTY, timer, BehaviorSubject, Subscription } from 'rxjs';
import { debounce, map } from 'rxjs/operators';

import { ConfigService } from '@igo2/core';
import { EntityState, EntityStore, EntityStoreFilterCustomFuncStrategy, EntityStoreWatcher } from '@igo2/common';

import { IgoMap } from '../../map';
Expand All @@ -39,6 +40,9 @@ export enum SearchResultMode {
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SearchResultsComponent implements OnInit, OnDestroy {

public showValue = true;

/**
* Reference to the SearchResultMode enum
* @internal
Expand Down Expand Up @@ -137,7 +141,9 @@ export class SearchResultsComponent implements OnInit, OnDestroy {
>;

constructor(private cdRef: ChangeDetectorRef,
private searchService: SearchService) {}
private searchService: SearchService,
private configService: ConfigService
) {}

/**
* Bind the search results store to the watcher
Expand All @@ -149,6 +155,10 @@ export class SearchResultsComponent implements OnInit, OnDestroy {
this.settingsChange$$ = this.settingsChange$.subscribe(() => {
this.pageIterator = [];
});

if (this.configService.getConfig('searchResultsNumber') === false) {
this.showValue = false;
}
}

/**
Expand All @@ -169,7 +179,7 @@ export class SearchResultsComponent implements OnInit, OnDestroy {
computeGroupTitle(group: {source: SearchSource; results: SearchResult[]}): string {
const parts = [group.source.title];
const count = group.results.length;
if (count > 1) {
if (count > 1 && this.showValue) {
parts.push(`(${count})`);
}
return parts.join(' ');
Expand Down