Skip to content

Commit

Permalink
#939
Browse files Browse the repository at this point in the history
  • Loading branch information
amirbashan committed Jan 22, 2025
1 parent 3604ee8 commit 1e46204
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
3 changes: 3 additions & 0 deletions projects/srm/src/app/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { ReplaySubject, timer } from 'rxjs';
import { delay, filter, tap } from 'rxjs/operators';
import { FiltersState } from '../search-filters/filters-state';
import { AreaSearchState } from '../area-search-selector/area-search-state';


@Injectable({
Expand Down Expand Up @@ -45,6 +46,7 @@ export class MenuComponent implements AfterViewInit {

@ViewChild('menu') menuEl: ElementRef;
@Input() filtersState: FiltersState;
@Input() areaSearchState: AreaSearchState;

active = false;
visible = false;
Expand Down Expand Up @@ -94,5 +96,6 @@ export class MenuComponent implements AfterViewInit {

clearFilters(){
this.filtersState.clearFilters();
this.areaSearchState.selectNationWide(true)
}
}
2 changes: 1 addition & 1 deletion projects/srm/src/app/page/page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
></app-landing-page-overlay>
}
</div>
<app-menu [filtersState]='filtersState'></app-menu>
<app-menu [filtersState]='filtersState' [areaSearchState]='areaSearchState'></app-menu>

<app-menu-popup-contact *ngIf='stage === "about:contact"'></app-menu-popup-contact>
<app-menu-popup-partners *ngIf='stage === "about:partners"'></app-menu-popup-partners>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@for (item of filtersState.staticFilters; track item.key) {
@if (item.key?.indexOf('human_situation') === 0 && item.key && filtersState.situationsMap[item.key]) {
<app-situation
*ngIf='isShowFilter(item)'
[situation]='filtersState.situationsMap[item.key]'
[selected]='(filtersState.allFilteredSituations || []).indexOf(item.key) > -1'
[selectable]='true'
Expand All @@ -22,7 +21,6 @@
></app-situation>
} @else if (item.key?.indexOf('human_service') === 0 && item.key && filtersState.responsesMap[item.key]) {
<app-response
*ngIf='isShowFilter(item)'
[response]='filtersState.responsesMap[item.key]'
[selected]='(filtersState.currentSearchParams.filter_responses || []).indexOf(item.key) > -1'
[dynamic]='true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,4 @@ export class SearchFiltersBarComponent implements OnInit {

ngOnInit(): void {
}

isShowFilter(item: any): boolean {
if (!item) return false;
const isSituationSelected = this.filtersState.allFilteredSituations.includes(item.key);
const isResponseSelected = this.filtersState.allFilteredResponses.includes(item.key);
return isSituationSelected || isResponseSelected || item.doc_count > 0;
}
}

0 comments on commit 1e46204

Please sign in to comment.