From 89ce55f08b1d891748a1157095aff802941413a5 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 24 Feb 2025 15:01:41 +0100 Subject: [PATCH] fix: fix minor icon misalignment (#1755) ## Description - Added enter and escape key handlers for text search input - Removed unused edit mode state in datasets filter - Reduced debounce time for text filter to improve responsiveness - Adjusted cart icon position image ## Motivation Background on use case, changes needed ## Fixes: Please provide a list of the fixes implemented in this PR * Items added ## Changes: Please provide a list of the changes implemented by this PR * changes made ## Tests included - [ ] Included for each change/fix? - [ ] Passing? (Merge will not be approved unless this is checked) ## Documentation - [ ] swagger documentation updated \[required\] - [ ] official documentation updated \[nice-to-have\] ### official documentation info If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included ## Backend version - [ ] Does it require a specific version of the backend - which version of the backend is required: ## Summary by Sourcery This pull request enhances the search functionality and improves filter performance. It adds keyboard support to the search bar, improves the responsiveness of the text filter, and removes an unused state variable. New Features: - The search bar now supports submitting the search query by pressing the Enter key. - The search bar now supports clearing the search query by pressing the Escape key. Bug Fixes: - Removed unused `isInEditMode` state in the datasets filter component. Enhancements: - Improved the responsiveness of the text filter by reducing the debounce time. --- .../_layout/app-header/app-header.component.html | 16 +++++++--------- .../full-text-search-bar.component.html | 2 ++ .../datasets-filter/datasets-filter.component.ts | 3 --- .../modules/filters/text-filter.component.ts | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/app/_layout/app-header/app-header.component.html b/src/app/_layout/app-header/app-header.component.html index b844e8659..c19064f56 100644 --- a/src/app/_layout/app-header/app-header.component.html +++ b/src/app/_layout/app-header/app-header.component.html @@ -94,15 +94,13 @@
- diff --git a/src/app/datasets/dashboard/full-text-search/full-text-search-bar.component.html b/src/app/datasets/dashboard/full-text-search/full-text-search-bar.component.html index f9895119c..c31289539 100644 --- a/src/app/datasets/dashboard/full-text-search/full-text-search-bar.component.html +++ b/src/app/datasets/dashboard/full-text-search/full-text-search-bar.component.html @@ -8,6 +8,8 @@ type="search" [(ngModel)]="searchTerm" (ngModelChange)="onSearchTermChange($event)" + (keydown.enter)="onSearch()" + (keydown.escape)="onClear()" />
diff --git a/src/app/datasets/datasets-filter/datasets-filter.component.ts b/src/app/datasets/datasets-filter/datasets-filter.component.ts index 14562efaf..973aca8e3 100644 --- a/src/app/datasets/datasets-filter/datasets-filter.component.ts +++ b/src/app/datasets/datasets-filter/datasets-filter.component.ts @@ -78,8 +78,6 @@ export class DatasetsFilterComponent implements OnInit, OnDestroy { hasAppliedFilters$ = this.store.select(selectHasAppliedFilters); - isInEditMode = false; - labelMaps: { [key: string]: string } = {}; constructor( @@ -176,7 +174,6 @@ export class DatasetsFilterComponent implements OnInit, OnDestroy { } applyFilters() { - this.isInEditMode = false; this.store.dispatch(fetchDatasetsAction()); this.store.dispatch(fetchFacetCountsAction()); } diff --git a/src/app/shared/modules/filters/text-filter.component.ts b/src/app/shared/modules/filters/text-filter.component.ts index 356c58984..5307b3bed 100644 --- a/src/app/shared/modules/filters/text-filter.component.ts +++ b/src/app/shared/modules/filters/text-filter.component.ts @@ -35,7 +35,7 @@ export class TextFilterComponent this.subscription = this.textSubject .pipe( skipWhile((terms) => terms === ""), - debounceTime(500), + debounceTime(200), distinctUntilChanged(), ) .subscribe((terms) => {